:root {
    --bg-color: #ffffff;
    --text-color: #202124;
    --card-bg-color: #f8f9fa; 
    --card-border-color: #ddd;
    --accent-color: #4285f4;
    --tab-bar-bg: #e6e6e6;
    --tab-active-bg: var(--accent-color);
    --sub-tab-active-bg: rgba(66, 133, 244, 0.5);
    --tab-hover-bg: #e0e0e0;
    --tab-active-text: #fff;
    --tab-text-color: #495057;
    --link-color: #1a73e8;
    --link-hover-bg: #f1f3f4;
    /* Themed button colors (folder mgmt) */
    --btn-info-bg: #34a853;
    --btn-info-hover: #2d9247;
    --btn-danger-bg: #ea4335;
    --btn-danger-hover: #d33828;
    /* Link card background surface (contrast against folder card) */
    --link-card-bg: var(--card-bg-color);
}

html[data-theme='dark'], body.dark-theme {
    --bg-color: #202124;
    --text-color: #e8eaed;
    --card-bg-color: #303134;
    --card-border-color: #5f6368;
    --accent-color: #8ab4f8;
    --tab-bar-bg: #3c4043;
    --tab-active-bg: #3367d6;
    --sub-tab-active-bg: #4a7ac4;
    --tab-hover-bg: #4a4a4a;
    --tab-active-text: #e8eaed;
    --link-color: #8ab4f8;
    --link-hover-bg: #3c4043;
    /* Keep brand colors consistent in dark theme; override if needed */
    --btn-info-bg: #34a853;
    --btn-info-hover: #2d9247;
    --btn-danger-bg: #ea4335;
    --btn-danger-hover: #d33828;
    /* Link card background surface in dark theme */
    --link-card-bg: var(--card-bg-color);
}

/* 전체 레이아웃 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Malgun Gothic', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 검색 영역 - 구글 스타일 */
.search-section {
    text-align: center;
    padding: 80px 0px 100px;
}

.logo h1 {
    font-size: 48px;
    font-weight: 400;
    color: var(--accent-color);
    margin-bottom: 50px;
}

.search-form {
    max-width: 800px; /* 기본 검색 영역 가로폭 확대 */
    margin: 0 auto;
}

.search-box {
    display: flex; /* 입력+버튼을 하나의 그룹(인라인 플렉스)으로 */
    align-items: stretch; /* 높이 동일하게 맞춤 */
    gap: 10px;
    flex-wrap: nowrap; /* 줄바꿈 방지 */
    white-space: nowrap; /* 내부 줄바꿈 금지(안전장치) */
}

.search-input-wrapper {
    position: relative;
    /* 기본 가로폭을 넉넉히 확보하되 줄바꿈은 방지 */
    flex: 1 1 600px; /* 기본 선호 폭 확대 */
    display: flex;
    align-items: center;
    min-width: 0; /* 자식 input이 줄어들 수 있도록 */
}

.search-input {
    width: 100%;
    padding-right: 40px; /* Space for the clear button */
    min-width: 0; /* flex 수축 허용 */
}

.search-submit {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    padding: 0px 5px;
    margin: -2px 0px;
    z-index: 2;
}

.clear-button {
    position: absolute;
    right: 45px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    padding: 0 5px;
    z-index: 2;
}

.clear-button:hover {
    color: #333;
}

/* 다크모드에서 검색어 삭제(X) 버튼 가독성 개선 */
html[data-theme='dark'] .clear-button,
body.dark-theme .clear-button {
    color: #e8eaed; /* 더 높은 대비 */
    opacity: 0.9;
}
html[data-theme='dark'] .clear-button:hover,
body.dark-theme .clear-button:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08); /* 입력 배경과 구분되는 약한 배경 */
    border-radius: 16px;
}

/* 키보드 접근성 향상 */
.clear-button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.search-input {
    flex: 1;
    padding: 14px 24px; /* 기본 높이/가로 여백 확대 */
    padding-right: 44px; /* 지우기 버튼 공간 확보 */
    font-size: 18px; /* 기본 글자 크기 확대 */
    line-height: 1; /* 줄간격 증가 방지 */
    border: 2px solid var(--card-border-color);
    border-radius: 28px;
    outline: none;
    transition: box-shadow 0.2s;
    background-color: var(--card-bg-color);
    color: var(--text-color);
}

.search-input:hover {
    border-color: #dadce0; /* This can be a variable too, but let's keep it simple for now */
    box-shadow: 0 1px 6px rgba(32,33,36,.28);
}

.search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 1px 6px rgba(32,33,36,.28);
}

.search-button {
    line-height: 1; /* 텍스트 줄간격 영향 제거 */
    flex: 0 0 auto; /* 버튼 크기 고정, 줄바꿈 방지 */
    align-self: stretch; /* 입력창과 동일한 세로 높이 */
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.6em 1em; /* 글자 크기에 비례하여 크기 확장 */
    font-size: 14px;
    background-color: var(--accent-color);
    color: #fff; /* White text on accent is usually fine */
    border: none;
    border-radius: 28px; /* 입력창과 동일한 라운드로 통일 */
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    max-width: none; /* 글자 커짐에 따라 버튼도 확장 */
    box-sizing: border-box;
}

.search-button:hover {
    background-color: #357ae8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Engine selection cards */
.engine-cards {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.engine-card {
    padding: 4px 16px;
    border: 1px solid var(--card-border-color);
    border-radius: 20px;
    cursor: pointer;
    background-color: var(--card-bg-color);
    font-size: 14px;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 8px;
}

.engine-card:hover {
    background-color: var(--tab-bar-bg);
    border-color: var(--accent-color);
}

.engine-card.active {
    background-color: var(--accent-color);
    color: var(--tab-active-text);
    border-color: var(--accent-color);
    font-weight: bold;
}

.engine-card img {
    width: 16px;
    height: 16px;
}

/* 관리 링크 */
.admin-link {
    text-align: center;
    margin: 20px 0 40px;
}

.admin-link a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border: 1px solid var(--card-border-color);
    border-radius: 4px;
    display: inline-block;
    transition: all 0.2s;
}

.admin-link a:hover {
    background-color: var(--card-bg-color);
    border-color: var(--accent-color);
}

.btn-theme {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    margin-right: 15px;
    color: var(--text-color); /* Ensure it's visible in both themes */
    transition: transform 0.2s ease;
}

.btn-theme:hover {
    transform: scale(1.1);
}

/* Tab bar */
.tab-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background-color: var(--tab-bar-bg);
    border-radius: 30px;
    padding: 8px;
    margin-bottom: 20px;
}

/* 메인 탭 스타일 */
.main-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
    vertical-align: middle;
}

.main-tab-button, .sub-tab-button {
    border: 1px solid transparent;
    background-color: transparent;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-color);
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
}

.main-tab-button:not(.active):hover, .sub-tab-button:not(.active):hover {
    background-color: var(--tab-bar-bg);
    border-color: var(--accent-color);
}

.main-tab-button.active {
    background-color: var(--tab-active-bg);
    color: var(--tab-active-text);
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sub-tab-button.active {
    background-color: var(--sub-tab-active-bg);
    color: var(--tab-active-text);
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.main-tab-content {
    display: none;
}

.main-tab-content.active {
    display: block;
}

/* 서브 탭 스타일 (개인/공용 카테고리용) */
.sub-tabs-group {
    display: none; /* Initially hidden */
    flex-wrap: wrap;
    gap: 10px;
    margin-left: 35px; /* Add a gap */
    vertical-align: middle;
}

.sub-tab-content {
    display: none;
}

.sub-tab-content.active {
    display: block;
}

/* 링크 그리드 */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.link-item {
    background: var(--card-bg-color);
    border: 1px solid var(--card-border-color);
    border-radius: 8px;
    transition: all 0.2s;
    overflow: hidden;
}

.link-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    background: var(--link-hover-bg);
}

.link-item a {
    display: block;
    padding: 15px;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.link-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.link-favicon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 4px;
    object-fit: contain;
}

.link-text {
    flex: 1;
    min-width: 0;
}

.link-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--link-color);
    margin-bottom: 5px;
    word-wrap: break-word;
}

.link-desc {
    font-size: 13px;
    color: var(--text-color);
    opacity: 0.8;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
}

/* Add link card */
.add-link-card {
    background: var(--card-bg-color);
    border: 2px dashed var(--card-border-color);
    border-radius: 8px;
    transition: all 0.2s;
    overflow: hidden;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-color: var(--accent-color);
    background: var(--link-hover-bg);
}

.add-link-card a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-decoration: none;
    color: var(--accent-color);
    height: 100%;
    width: 100%;
}

.add-link-icon {
    font-size: 48px;
    font-weight: 300;
    line-height: 1;
    margin-bottom: 8px;
}

.add-link-text {
    font-size: 14px;
    font-weight: 500;
}

.no-links {
    text-align: center;
    color: #5f6368;
    padding: 40px 20px;
}

.no-links a {
    color: #1a73e8;
    text-decoration: none;
}

.no-links a:hover {
    text-decoration: underline;
}

.no-categories-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-color);
    opacity: 0.7;
    background: var(--card-bg-color);
    border-radius: 8px;
    margin: 20px 0;
}

.no-categories-message a {
    color: var(--link-color);
    text-decoration: none;
}

.no-categories-message a:hover {
    text-decoration: underline;
}

/* 폼 컨테이너 */
.form-container {
    max-width: 500px;
    margin: 60px auto;
    background: var(--bg-color);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-container h2 {
    text-align: center;
    color: var(--accent-color);
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 400;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--card-border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-color);
    opacity: 0.7;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* 버튼 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--accent-color);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.btn-secondary {
    background-color: var(--tab-bar-bg);
    color: var(--text-color);
    border: 1px solid var(--card-border-color);
}

.btn-secondary:hover {
    opacity: 0.9;
}

.btn-danger {
    background-color: var(--btn-danger-bg);
    color: #fff;
}

.btn-danger:hover {
    background-color: var(--btn-danger-hover);
}

.btn-warning {
    background-color: #fbbc04;
    color: #202124;
}

.btn-warning:hover {
    background-color: #f9ab00;
}

.btn-info {
    background-color: var(--btn-info-bg);
    color: #fff;
}

.btn-info:hover {
    background-color: var(--btn-info-hover);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-pill {
    border-radius: 50px;
    background-color: #4285f4;
    color: white;
}

/* 알림 */
.alert {
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 14px;
}

.alert-error {
    background-color: #fce8e6;
    color: #c5221f;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #e6f4ea;
    color: #137333;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background-color: #e8f0fe;
    color: #1967d2;
    border: 1px solid #b8daff;
}

/* 설정 페이지 */
.admin-container {
    background: var(--bg-color);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-top: 40px;
    border: 1px solid var(--card-border-color);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--card-border-color);
}

.admin-header h2 {
    margin: 0;
    color: var(--accent-color);
    font-size: 28px;
    font-weight: 400;
}

.admin-menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.admin-menu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: var(--card-bg-color);
    border: 2px solid var(--card-border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s;
}

.admin-menu-btn:hover {
    background: var(--link-hover-bg);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.admin-menu-btn .menu-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.admin-menu-btn .menu-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
    opacity: 0.8;
}

.admin-menu-btn:hover .menu-text {
    color: var(--accent-color);
    opacity: 1;
}

.admin-actions {
    margin-bottom: 20px;
    padding: 15px;
    background: #e8f0fe;
    border-radius: 4px;
    text-align: center;
}

.section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--card-border-color);
}

.section-header h3 {
    color: var(--text-color);
    font-size: 20px;
    font-weight: 500;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--card-border-color);
    color: var(--text-color);
}

.data-table th {
    background-color: var(--card-bg-color);
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.7;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background-color: var(--link-hover-bg);
}

.data-table td form {
    display: inline;
}

.data-table .folder-row {
    background-color: var(--card-bg-color);
}

.data-table .links-row {
    background-color: var(--bg-color);
}

.data-table .links-row td {
    padding: 0;
    border-bottom: 2px solid var(--card-border-color);
}

.links-list {
    padding: 10px 20px;
}

.links-grid-admin {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 한 줄에 2개 */
    gap: 12px;
    padding: 20px;
    background: transparent; /* 폴더 카드와 구분: 컨테이너는 투명 */
}

/* 설정 > 폴더 카드 목록 */
.folder-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.folder-card {
    background: var(--bg-color);
    border-radius: 6px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--card-border-color);
    border-left: 4px solid var(--accent-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.folder-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.folder-title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.folder-name { font-size: 15px; color: var(--text-color); }
.folder-sort { font-size: 12px; color: var(--text-color); opacity: 0.7; }
.folder-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 폴더 카드 내 액션 버튼을 링크 카드 스타일과 일치시키기 (테마 반영) */
.folder-card-actions .btn {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    background: var(--card-bg-color);
    color: var(--text-color);
    border: 1px solid var(--card-border-color);
    border-radius: 4px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.folder-card-actions .btn:hover { background: var(--link-hover-bg); }

/* 의미 강조: 텍스트/보더 색만 포인트, 배경은 테마 유지 */
.folder-card-actions .btn-info {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: var(--card-bg-color);
}
.folder-card-actions .btn-secondary {
    color: var(--text-color);
    border-color: var(--card-border-color);
    background: var(--card-bg-color);
}
.folder-card-actions .btn-danger {
    color: #ea4335;
    border-color: #ea4335;
    background: var(--card-bg-color);
}

@media (max-width: 768px) {
    .folder-cards { grid-template-columns: 1fr; }
}

.link-card-admin {
    background: var(--link-card-bg);
    border-radius: 6px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--card-border-color);
    border-left: 4px solid var(--accent-color);
    transition: all 0.2s;
    display: grid;
    grid-template-columns: 40px 1fr; /* 아이콘 | 내용 */
    align-items: center;
    gap: 12px;
}

.link-card-admin:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    border-left-color: var(--accent-color);
}

.link-card-favicon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
}

.link-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.link-card-header:hover {
    text-decoration: none;
}

.link-card-header:hover .link-card-title {
    color: #1967d2;
}

.link-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.4;
}

.link-card-description {
    font-size: 13px;
    color: var(--text-color);
    opacity: 0.7;
    line-height: 1.4;
    margin-top: 4px;
}

.link-card-url {
    font-size: 12px;
    color: var(--link-color);
    word-break: break-all;
    margin-top: 2px;
}

.link-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    grid-column: 2 / 3; /* 내용 아래에 위치 */
    justify-content: flex-end;
    margin-top: 6px;
}

.link-card-meta { margin-top: 2px; font-size: 12px; color: var(--text-color); opacity: 0.7; }
.link-card-sort-order { font-size: 12px; }

.link-card-btn {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    background: var(--card-bg-color); /* 테마 기반 배경 */
    color: var(--text-color);         /* 테마 기반 글자색 */
    border: 1px solid var(--card-border-color);
    border-radius: 4px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.link-card-btn:hover {
    background: var(--link-hover-bg); /* 테마 기반 hover 배경 */
}

.link-card-btn-edit {
    color: #4285f4;
    border-color: #4285f4;
}

.link-card-btn-edit:hover { background: var(--link-hover-bg); }

.link-card-btn-delete {
    color: #ea4335;
    border-color: #ea4335;
}

.link-card-btn-delete:hover { background: var(--link-hover-bg); }

/* 링크 카드 반응형 균형 배치 */
@media (max-width: 600px) {
    .links-grid-admin { grid-template-columns: 1fr; }
    .link-card-admin { grid-template-columns: 32px 1fr; }
    .link-card-favicon { width: 32px; height: 32px; }
    .link-card-actions { grid-column: 2 / 3; justify-content: flex-end; margin-top: 6px; }
}

.link-item-admin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #4285f4;
}

.link-title-admin {
    font-size: 14px;
    color: #202124;
}

.link-actions {
    display: flex;
    gap: 8px;
}

.link-btn {
    padding: 4px 12px;
    font-size: 12px;
    background: white;
    color: #5f6368;
    border: 1px solid #dadce0;
    border-radius: 3px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.link-btn:hover {
    background: #e8eaed;
    border-color: #4285f4;
    color: #4285f4;
}

.link-btn-delete {
    color: #ea4335;
}

.link-btn-delete:hover {
    background: #fce8e6;
    border-color: #ea4335;
}

.link-count {
    color: #5f6368;
    font-size: 12px;
    margin-left: 8px;
}

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #5f6368;
}

/* 사용자 정보 */
.user-info {
    margin-top: 20px;
}

.info-group {
    margin-bottom: 20px;
}

.info-group label {
    display: block;
    font-weight: 600;
    color: #202124;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-group p {
    color: #5f6368;
    font-size: 14px;
}

.api-key {
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
    word-break: break-all;
    border: 1px solid #dadce0;
    font-size: 13px;
}

/* 관리자 impersonation 알림 */
.admin-impersonation-notice {
    background: linear-gradient(135deg, #ea4335 0%, #fbbc04 100%);
    color: white;
    padding: 12px 0;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.admin-impersonation-notice a:hover {
    opacity: 0.8;
}

header nav {

    display: flex;

    justify-content: flex-end;

    align-items: center;

    margin-top: 0px; /* Adjust as needed */

}



header nav ul {

    display: flex;

    list-style: none;

    margin: 0;

    padding: 0;

    align-items: center;

}



header nav ul li {

    margin-left: 15px;

}



header nav ul li a {

    color: var(--accent-color);

    text-decoration: none;

    font-size: 14px;

    padding: 8px 16px;

    border: 1px solid var(--card-border-color);

    border-radius: 4px;

    display: inline-block;

    transition: all 0.2s;

}



header nav ul li a:hover {

    background-color: var(--card-bg-color);

    border-color: var(--accent-color);

}



.btn-theme {

    background: none;

    border: none;

    cursor: pointer;

    font-size: 20px;

    color: var(--text-color); /* Ensure it's visible in both themes */

    transition: transform 0.2s ease;

}



.btn-theme:hover {

    transform: scale(1.1);

}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .btn-menu { width: 32px; height: 32px; line-height: 30px; font-size: 16px; }
    .btn-theme { font-size: 18px; }
    .logo h1 {
        font-size: 36px;
    }


    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .main-tab-button {
        padding: 10px 20px;
        font-size: 14px;
    }

    .sub-tab-button {
        padding: 6px 15px;
        font-size: 13px;
    }

    .form-container {
        margin: 20px auto;
        padding: 30px 20px;
    }

    .admin-container {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .btn-menu { width: 28px; height: 28px; line-height: 26px; font-size: 14px; }
    .btn-theme { font-size: 16px; }
    .links-grid {
        grid-template-columns: 1fr;
    }

    .logo h1 {
        font-size: 28px;
    }

    .main-tabs {
        gap: 5px;
    }

    .main-tab-button {
        padding: 8px 15px;
        font-size: 13px;
    }
}

/* Page-specific styles */


.logged-in.home-page .btn-primary {
    background-color: #28a745; /* 녹색 계열 */
}

.admin-page .btn-primary {
    background-color: #dc3545; /* 붉은색 계열 */
}

.admin-page .user-page .btn-primary {
    background-color: #ffc107; /* 노란색 계열 */
    color: #212529;
}

/* General button improvements */
.btn {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Dialog/Popup styles */
.form-container, .admin-container, .login-container {
    background-color: var(--bg-color);
    border: 1px solid var(--card-border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Top navigation + hamburger menu */
.top-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    position: relative;
}
/* 로그인/회원가입 노출 영역 */
.auth-actions { display: flex; gap: 8px; }
.btn-menu {
    background: transparent;
    border: 1px solid var(--card-border-color);
    border-radius: 4px;
    width: 36px;
    height: 36px;
    line-height: 34px;
    text-align: center;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-color);
}
.btn-menu:hover {
    background: var(--tab-bar-bg);
}
.menu-panel {
    position: absolute;
    top: 48px;
    right: 0;
    background: var(--card-bg-color);
    border: 1px solid var(--card-border-color);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1000;
}
.menu-panel ul {
    list-style: none;
    margin: 0;
    padding: 8px;
}
.menu-panel li {
    margin-right: 0px;
    padding: 0;
}
.menu-panel .menu-welcome {
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-color);
}
.menu-panel a {
    display: block;
    padding: 10px 14px;
    color: var(--text-color);
    text-decoration: none;
}
.menu-panel a:hover {
    background: var(--link-hover-bg);
}

@media (max-width: 640px) {
    .menu-panel { min-width: 160px; }
}

/* =============================== */
/* 홈 검색 영역 리셋 + 반응형 (scoped) */
/* =============================== */
.home-page .search-form { max-width: clamp(720px, 90vw, 900px); width: 100%; margin: 0 auto; }
.home-page .search-box {
    display: flex;               /* 한 줄 그룹 */
    align-items: stretch;        /* 입력/버튼 동일 높이 */
    gap: 10px;
    flex-wrap: nowrap;           /* 내부 줄바꿈 금지 */
    white-space: nowrap;         /* 텍스트 줄바꿈 방지(보강) */
}
.home-page .search-input-wrapper {
    position: relative;
    flex: 1 1 75%;
    min-width: 0;
    /* 입력+아이콘을 하나의 캡슐처럼 보이도록 래퍼에 배경/테두리 적용 */
    background: var(--card-bg-color);
    border: 2px solid var(--card-border-color);
    border-radius: 28px;
}
.home-page .search-input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 1px 6px rgba(32,33,36,.28);
}
.home-page .search-input {
    width: 100%;
    padding: 12px 88px 12px 16px; /* 우측 아이콘 2개(X, 검색) 공간 확보 */
    font-size: 16px;
    line-height: 1;
    border: 0; /* 래퍼가 테두리/배경을 가지므로 인풋은 투명 처리 */
    border-radius: 28px; /* 입력 커서 모서리 깔끔함 유지 */
    background-color: transparent;
    color: var(--text-color);
}
.home-page .search-button {
    flex: 0 0 auto;
    align-self: stretch;          /* 입력과 동일한 세로 높이 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;              /* 높이는 stretch로 맞추고 가로만 패딩 */
    font-size: 14px;
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 28px;
    cursor: pointer;
    font-weight: 500;
    line-height: 1;
    transition: background-color 0.2s;
}
.home-page .search-button:hover { background-color: #357ae8; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.home-page .clear-button {
    right: 44px; /* 검색 아이콘(오른쪽 12px)과 4px 간격 */
    font-size: 18px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.home-page .search-submit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: transparent; /* X 버튼과 동일한 스타일 감성 */
    color: #999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}
.home-page .search-submit:hover { background: var(--link-hover-bg); box-shadow: none; }
.home-page .search-submit:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* 다크 테마에서 검색 아이콘 가독성 향상 (X 버튼과 일관) */
html[data-theme='dark'] .home-page .search-submit,
body.dark-theme .home-page .search-submit {
    color: #e8eaed;
}
html[data-theme='dark'] .home-page .search-submit:hover,
body.dark-theme .home-page .search-submit:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
    .home-page .search-input { padding-right: 84px; }
}
@media (max-width: 480px) {
    .home-page .search-input { padding-right: 84px; }
}


/* 강제 고정: 어떤 경우에도 줄바꿈 방지 및 동일 높이 유지 */
.home-page .search-form { width: 100%; }
.home-page .search-box { display: flex !important; flex-wrap: nowrap !important; white-space: nowrap !important; align-items: stretch !important; }
.home-page .search-input-wrapper { flex: 1 1 75% !important; min-width: 0 !important; overflow: hidden; }
.home-page .search-button { flex: 0 0 auto !important; }
