/* ========================================
   搜导航 - 多引擎搜索导航站样式
   ======================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #3730a3;
    --accent: #f59e0b;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-full: 9999px;
    --transition: 0.2s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-light);
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.78rem;
    font-family: inherit;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
}

/* ---------- Header ---------- */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 28px 0 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: white;
    position: relative;
}

.logo-icon {
    font-size: 2.2rem;
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

.logo-text {
    letter-spacing: 2px;
}

.slogan {
    margin-top: 8px;
    font-size: 0.95rem;
    opacity: 0.85;
    font-weight: 300;
    letter-spacing: 1px;
    position: relative;
}

/* ---------- Search Section ---------- */
.search-section {
    background: var(--bg-white);
    padding: 32px 0 20px;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border);
}

.search-box {
    max-width: 680px;
    margin: 0 auto;
}

/* Engine Groups (国际/国内切换) */
.engine-groups {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 14px;
    background: #f1f5f9;
    border-radius: var(--radius-full);
    padding: 4px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.group-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 22px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.group-btn:hover {
    color: var(--primary);
}

.group-btn.active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.group-icon {
    font-size: 1rem;
}

/* Engine Tabs */
.engine-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    justify-content: center;
    min-height: 38px;
}

.engine-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.engine-tab:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: #f0f0ff;
    transform: translateY(-1px);
}

.engine-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.engine-icon {
    font-size: 1rem;
}

/* Search Form */
.search-form {
    display: flex;
    gap: 0;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--bg-white);
}

.search-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.search-input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    outline: none;
    font-size: 1.05rem;
    color: var(--text);
    background: transparent;
    min-width: 0;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 14px 32px;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--primary-light);
}

.search-btn:active {
    background: var(--primary-dark);
}

.search-tip {
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- Section Common ---------- */
.section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary);
}

.section-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    margin-top: 0;
}

.title-icon {
    font-size: 1.2rem;
}

.category-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3px solid var(--primary);
}

/* ---------- Hot Words Section ---------- */
.hotwords-section {
    padding: 36px 0;
}

.hotwords-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.hotword-category {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: box-shadow var(--transition), transform var(--transition);
}

.hotword-category:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-tag {
    display: inline-block;
    padding: 6px 14px;
    background: #f1f5f9;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    transition: all var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
}

.keyword-tag:hover {
    background: #eef2ff;
    color: var(--primary);
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(79,70,229,0.1);
}

/* ---------- Nav Sites Section (网站对比) ---------- */
.navsites-section {
    padding: 0 0 40px;
}

/* Compare Tabs */
.compare-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    background: #f1f5f9;
    border-radius: var(--radius-full);
    padding: 4px;
    width: fit-content;
    max-width: 100%;
}

.compare-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.compare-tab:hover {
    color: var(--primary);
    background: rgba(255,255,255,0.5);
}

.compare-tab.active {
    background: var(--bg-white);
    color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.tab-icon {
    font-size: 1rem;
}

/* Fade animation on tab switch */
.compare-grid {
    transition: opacity 0.15s ease;
}

.compare-grid.fade-out {
    opacity: 0;
}

.compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.compare-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}

.compare-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.compare-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border);
}

.compare-icon {
    font-size: 1.1rem;
}

.compare-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.compare-body {
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}

.compare-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition);
    min-height: 72px;
    justify-content: center;
}

.compare-item.domestic {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.compare-item.domestic:hover {
    background: #fee2e2;
    border-color: #f87171;
    transform: translateY(-1px);
}

.compare-item.international {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.compare-item.international:hover {
    background: #dbeafe;
    border-color: #60a5fa;
    transform: translateY(-1px);
}

.compare-flag {
    font-size: 1.2rem;
}

.compare-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.compare-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    word-break: break-all;
}

.compare-item.domestic .compare-name {
    color: #991b1b;
}

.compare-item.international .compare-name {
    color: #1e3a8a;
}

.compare-vs {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 4px 6px;
    background: #f1f5f9;
    border-radius: var(--radius-full);
    letter-spacing: 0.5px;
}

/* ---------- Footer ---------- */
.footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
}

.footer-text {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.footer-links {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-links a {
    color: var(--text-muted);
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-links .divider {
    margin: 0 12px;
    color: var(--border);
}

/* ---------- Modal (通用弹窗) ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.25s ease;
    padding: 20px;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(1);
    transition: transform 0.25s ease;
}

.modal-overlay.hidden .modal {
    transform: scale(0.95);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    line-height: 1;
}

.modal-close:hover {
    background: #f1f5f9;
    color: var(--text);
}

.modal-body {
    padding: 20px 24px 24px;
    font-size: 0.92rem;
    color: var(--text);
    line-height: 1.75;
}

.modal-body p {
    margin-bottom: 12px;
}

.modal-body h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin: 16px 0 8px;
    padding-left: 8px;
    border-left: 3px solid var(--primary);
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.modal-body li {
    margin-bottom: 4px;
}

/* ---------- Redirect Modal (热搜倒计时弹窗) ---------- */
.redirect-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.25s ease;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.redirect-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.redirect-modal {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 100%;
    padding: 32px 28px 24px;
    text-align: center;
    transform: scale(1);
    transition: transform 0.25s ease;
}

.redirect-overlay.hidden .redirect-modal {
    transform: scale(0.92);
}

.redirect-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    animation: bounceIn 0.4s ease;
}

@keyframes bounceIn {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

.redirect-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.redirect-text strong {
    color: var(--primary);
    font-weight: 600;
}

.redirect-keyword {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin: 8px 0 24px;
    padding: 0 8px;
    word-break: break-all;
}

/* Countdown */
.countdown-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.countdown-number {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}

.countdown-bar {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.countdown-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-full);
    width: 100%;
    transition: width 0.05s linear;
}

/* Redirect actions */
.redirect-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.redirect-btn {
    padding: 8px 18px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.redirect-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: #f0f0ff;
}

.redirect-btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.redirect-btn-primary:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

.redirect-btn-cancel {
    color: #ef4444;
    border-color: #fecaca;
}

.redirect-btn-cancel:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #ef4444;
}

/* ---------- 进入动画 ---------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hotword-category,
.compare-card {
    animation: fadeInUp 0.4s ease both;
}

.hotword-category:nth-child(1) { animation-delay: 0.05s; }
.hotword-category:nth-child(2) { animation-delay: 0.1s; }
.hotword-category:nth-child(3) { animation-delay: 0.15s; }
.hotword-category:nth-child(4) { animation-delay: 0.2s; }

.compare-card:nth-child(1)  { animation-delay: 0.05s; }
.compare-card:nth-child(2)  { animation-delay: 0.08s; }
.compare-card:nth-child(3)  { animation-delay: 0.11s; }
.compare-card:nth-child(4)  { animation-delay: 0.14s; }
.compare-card:nth-child(5)  { animation-delay: 0.17s; }
.compare-card:nth-child(6)  { animation-delay: 0.2s; }
.compare-card:nth-child(7)  { animation-delay: 0.23s; }
.compare-card:nth-child(8)  { animation-delay: 0.26s; }
.compare-card:nth-child(9)  { animation-delay: 0.29s; }
.compare-card:nth-child(10) { animation-delay: 0.32s; }
.compare-card:nth-child(11) { animation-delay: 0.35s; }
.compare-card:nth-child(12) { animation-delay: 0.38s; }
.compare-card:nth-child(n+13) { animation-delay: 0.4s; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .header {
        padding: 20px 0 16px;
    }

    .logo {
        font-size: 1.5rem;
    }

    .logo-icon {
        font-size: 1.6rem;
    }

    .slogan {
        font-size: 0.85rem;
    }

    .search-section {
        padding: 20px 0 16px;
    }

    .group-btn {
        padding: 7px 16px;
        font-size: 0.85rem;
    }

    .engine-tabs {
        gap: 4px;
    }

    .engine-tab {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .search-input {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .search-btn {
        padding: 12px 20px;
    }

    .search-tip {
        display: none;
    }

    .hotwords-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .compare-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .compare-tabs {
        gap: 4px;
        padding: 3px;
    }

    .compare-tab {
        padding: 7px 14px;
        font-size: 0.82rem;
    }

    .tab-icon {
        font-size: 0.9rem;
    }

    .compare-body {
        gap: 6px;
        padding: 10px;
    }

    .compare-item {
        padding: 8px 6px;
        min-height: 64px;
    }

    .compare-name {
        font-size: 0.82rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .hotword-category {
        padding: 16px;
    }

    .modal {
        max-height: 85vh;
        margin: 10px;
    }

    .modal-header {
        padding: 16px 18px 14px;
    }

    .modal-body {
        padding: 16px 18px 20px;
        font-size: 0.88rem;
    }

    .redirect-modal {
        padding: 24px 20px 20px;
    }

    .redirect-icon {
        font-size: 2.5rem;
    }

    .redirect-keyword {
        font-size: 1.1rem;
    }

    .countdown-number {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .redirect-actions {
        flex-direction: column;
    }

    .redirect-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .engine-tab {
        padding: 5px 10px;
        font-size: 0.78rem;
    }

    .engine-icon {
        font-size: 0.85rem;
    }

    .footer-links .divider {
        margin: 0 6px;
    }
}
