/* ===== 公共变量 ===== */
:root {
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100%;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* ===== 导航栏 ===== */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    gap: 16px;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}
.navbar-brand .icon { font-size: 24px; }
.navbar-brand .navbar-logo {
    width: 32px;
    height: 32px;
    display: block;
}

/* ===== 导航栏内搜索框 ===== */
.navbar-search {
    flex: 1;
    max-width: 440px;
    position: relative;
}
.navbar-search .search-box {
    display: flex;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.navbar-search .search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.navbar-search .search-box input {
    flex: 1;
    padding: 7px 14px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, 'Courier New', monospace;
    letter-spacing: 0.5px;
    color: var(--text);
    border: none;
    outline: none;
    background: #f8fafc;
    min-width: 0;
}
.navbar-search .search-box input::placeholder {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    color: #94a3b8;
}
.navbar-search .search-box button {
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.navbar-search .search-box button:hover { background: var(--primary-dark); }
.navbar-search .search-box button:disabled { opacity: 0.6; cursor: not-allowed; }
.navbar-search .search-box-wrapper.dropdown-open .search-box {
    border-radius: 8px 8px 0 0;
}
.navbar-search .search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    overflow: visible;
    z-index: 200;
    padding: 4px 0 8px;
}
.navbar-search .search-dropdown.show {
    display: block;
    animation: dropdownIn 0.18s ease;
}
.navbar-search .search-dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.12s;
    gap: 12px;
}
.navbar-search .search-dropdown-item:hover { background: #f3f4f6; }
.navbar-search .search-dropdown-item:active { background: #e5e7eb; }
.navbar-search .search-dropdown-item:last-child { border-radius: 0 0 10px 10px; }
.navbar-search .dropdown-icon {
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    color: #9ca3af; font-size: 14px; flex-shrink: 0;
}
.navbar-search .dropdown-body {
    flex: 1; min-width: 0;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.navbar-search .dropdown-domain {
    font-size: 14px; color: #374151; font-weight: 400;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.navbar-search .dropdown-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.navbar-search .dropdown-score {
    font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 8px; line-height: 1.5;
}
.navbar-search .dropdown-score.grade-excellent { background: #d1fae5; color: #065f46; }
.navbar-search .dropdown-score.grade-good { background: #dbeafe; color: #1e40af; }
.navbar-search .dropdown-score.grade-warning { background: #fef3c7; color: #92400e; }
.navbar-search .dropdown-score.grade-danger { background: #fee2e2; color: #991b1b; }
.navbar-search .dropdown-time { font-size: 11px; color: #9ca3af; white-space: nowrap; }
.navbar-search .search-dropdown-empty {
    padding: 24px 16px; text-align: center; color: #9ca3af; font-size: 13px;
}
@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 页脚 ===== */
.site-footer {
    text-align: center;
    padding: 16px 20px;
    color: #94a3b8;
    font-size: 12px;
    margin-top: auto;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}
.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
    line-height: 1.8;
}
.site-footer-inner a {
    color: #94a3b8;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}
.site-footer-inner a:hover {
    color: var(--primary);
    text-decoration: underline;
}
.site-footer-inner .footer-sep {
    margin: 0 6px;
    opacity: 0.5;
}

/* ===== 弹窗 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-dialog {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 640px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
    background: none; border: none;
    font-size: 24px; cursor: pointer;
    color: var(--text-secondary);
    padding: 0 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body {
    padding: 24px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    flex: 1;
}
.modal-body h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 16px 0 8px;
    color: var(--text);
}
.modal-body h3:first-child { margin-top: 0; }
.modal-body ul {
    padding-left: 20px;
    margin: 4px 0 12px;
}
.modal-body ul li { margin-bottom: 4px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    text-align: right;
    flex-shrink: 0;
}
.btn-agree {
    padding: 10px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-agree:hover { background: var(--primary-dark); }

/* ===== 导航用户区域 ===== */
.nav-user { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; position: relative; }
.nav-loading { font-size: 12px; color: #94a3b8; }

.nav-link-limited-free {
    padding: 5px 12px; font-size: 12px; font-weight: 600;
    color: #fff; background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 14px; text-decoration: none; white-space: nowrap;
    transition: all 0.2s; box-shadow: 0 2px 8px rgba(16,185,129,0.25);
    animation: freePulse 2s ease-in-out infinite;
}
.nav-link-limited-free:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
    transform: translateY(-1px);
}
@keyframes freePulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(16,185,129,0.25); }
    50% { box-shadow: 0 2px 14px rgba(16,185,129,0.4); }
}

.btn-login {
    padding: 6px 16px; font-size: 13px; font-weight: 500;
    color: var(--primary); background: transparent;
    border: 1px solid var(--primary); border-radius: 6px;
    cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-login:hover { background: var(--primary); color: #fff; }

.btn-register {
    padding: 6px 16px; font-size: 13px; font-weight: 500;
    color: #fff; background: var(--primary);
    border: 1px solid var(--primary); border-radius: 6px;
    cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-register:hover { background: var(--primary-dark); }

.user-menu-trigger {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 4px 8px; border-radius: 6px; transition: background 0.15s;
}
.user-menu-trigger:hover { background: #f1f5f9; }

.user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; flex-shrink: 0;
}

.user-name {
    font-size: 13px; font-weight: 500; color: var(--text);
    max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.user-tier-badge {
    font-size: 10px; font-weight: 600; padding: 1px 6px;
    border-radius: 8px; white-space: nowrap;
}
.tier-free { background: #f1f5f9; color: #64748b; }
.tier-pro { background: #dbeafe; color: #1e40af; }
.tier-enterprise { background: #fef3c7; color: #92400e; }

.user-menu-arrow {
    font-size: 10px; color: #94a3b8; transition: transform 0.2s;
}

.user-dropdown {
    display: none; position: absolute; top: 100%; right: 0;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1); min-width: 180px;
    padding: 6px 0; z-index: 200;
}
.user-dropdown.show { display: block; }

.dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 16px; font-size: 13px; color: var(--text);
    text-decoration: none; cursor: pointer; transition: background 0.12s;
}
.dropdown-item:hover { background: #f8fafc; }
.logout-item { color: #ef4444; }
.dropdown-divider { height: 1px; background: #f1f5f9; margin: 4px 0; }

/* ===== 认证弹窗 ===== */
.auth-modal-dialog { max-width: 420px; }
.auth-form { padding: 0; }
.auth-form .form-group { margin-bottom: 14px; }
.auth-form .form-group label {
    display: block; font-size: 13px; font-weight: 500;
    margin-bottom: 4px; color: #374151;
}
.auth-form .form-group input {
    width: 100%; padding: 9px 12px; border: 1px solid #e2e8f0;
    border-radius: 6px; font-size: 14px; outline: none;
    transition: border-color 0.2s;
}
.auth-form .form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.auth-error { color: #ef4444; font-size: 13px; margin-bottom: 8px; min-height: 18px; }
.btn-auth-submit {
    width: 100%; padding: 10px; background: var(--primary);
    color: #fff; border: none; border-radius: 6px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    transition: background 0.2s;
}
.btn-auth-submit:hover { background: var(--primary-dark); }
.btn-auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-switch {
    text-align: center; font-size: 13px; color: #94a3b8; margin-top: 16px;
}
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }
.auth-loading { text-align: center; padding: 20px; color: #94a3b8; font-size: 14px; }
.auth-empty { text-align: center; padding: 24px; color: #94a3b8; font-size: 14px; }

.order-list { display: flex; flex-direction: column; gap: 10px; }
.order-item {
    padding: 12px; background: #f8fafc; border-radius: 8px;
    border: 1px solid #e8ecf1;
}
.order-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.order-no { font-family: monospace; font-size: 12px; color: #64748b; }
.order-status { font-size: 12px; font-weight: 600; }
.order-body { display: flex; justify-content: space-between; font-size: 13px; }
.order-amount { font-weight: 700; color: var(--text); }
.order-time { font-size: 11px; color: #94a3b8; margin-top: 4px; }

/* ===== 广告位 ===== */
.ad-container {
    margin: 16px 0; border-radius: 10px; overflow: hidden;
    border: 1px solid #e2e8f0; background: #fafbfd;
}
.ad-container a { display: block; text-decoration: none; color: inherit; }
.ad-container img { width: 100%; display: block; }
.ad-container .ad-text-link {
    padding: 10px 16px; font-size: 13px; color: var(--primary);
    font-weight: 500; display: flex; align-items: center; gap: 6px;
}
.ad-container .ad-text-link:hover { text-decoration: underline; }
.ad-label {
    font-size: 10px; color: #94a3b8; padding: 2px 8px;
    display: block; text-align: right;
}
