/* ============================================================
   网盘搜 - 核心样式 (支持双擎 & 暗黑模式)
   ============================================================ */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;

    /* 品牌色 */
    --quark: #7B2CBF;
    --baidu: #2932E1;

    /* 亮色模式 */
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
    --hover-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
    --bg: #0b1120;
    --card-bg: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --hover-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    --quark: #aa66e2;
    --baidu: #617aff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---- Header ---- */
.site-header {
    text-align: center;
    padding: 60px 0 40px;
}

.logo {
    text-decoration: none;
    display: inline-block;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--baidu) 0%, var(--quark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.tagline {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* ---- Search Form ---- */
.search-form {
    margin-bottom: 32px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.search-box {
    display: flex;
    gap: 12px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 8px;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box:focus-within {
    border-color: rgba(123, 44, 191, 0.5);
    /* Quark Purple mixed */
    box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.1), var(--shadow);
    transform: translateY(-2px);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    padding: 12px 16px;
    background: transparent;
    color: var(--text);
}

.search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.search-btn {
    background: linear-gradient(135deg, var(--baidu) 0%, var(--quark) 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 12px 32px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
}

.search-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.search-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: scale(1);
}

/* ---- Stats Card ---- */
.stats-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 24px;
    border: 1px solid var(--border);
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-icon {
    font-size: 1.2rem;
}

.stats-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stats-value {
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
}

.stats-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    display: none;
}

@media(min-width: 640px) {
    .stats-divider {
        display: block;
    }
}

/* ---- Tabs ---- */
.tabs-wrapper {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.tabs {
    display: inline-flex;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 6px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.tab-btn {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active.tab-quark {
    background: var(--quark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(123, 44, 191, 0.3);
}

.tab-btn.active.tab-baidu {
    background: var(--baidu);
    color: #fff;
    box-shadow: 0 4px 12px rgba(41, 50, 225, 0.3);
}

/* ---- Result Cards Grid ---- */
.result-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    list-style: none;
}

.result-item {
    animation: fadeInUp 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

/* Stagger animation for items */
.result-item:nth-child(1) {
    animation-delay: 0.05s;
}

.result-item:nth-child(2) {
    animation-delay: 0.1s;
}

.result-item:nth-child(3) {
    animation-delay: 0.15s;
}

.result-item:nth-child(4) {
    animation-delay: 0.2s;
}

.result-item:nth-child(5) {
    animation-delay: 0.25s;
}

.result-item:nth-child(n+6) {
    animation-delay: 0.3s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.result-link:hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-shadow);
    border-color: rgba(123, 44, 191, 0.3);
}

.result-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--border);
    transition: background 0.3s;
}

.result-item.type-quark .result-link:hover::before {
    background: var(--quark);
}

.result-item.type-baidu .result-link:hover::before {
    background: var(--baidu);
}

.result-title {
    font-size: 1.1rem;
    color: var(--text);
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 24px;
    word-break: break-all;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.result-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.pan-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.pan-badge.type-quark {
    background: rgba(123, 44, 191, 0.1);
    color: var(--quark);
}

.pan-badge.type-baidu {
    background: rgba(41, 50, 225, 0.1);
    color: var(--baidu);
}

[data-theme="dark"] .pan-badge.type-quark {
    background: rgba(170, 102, 226, 0.15);
}

[data-theme="dark"] .pan-badge.type-baidu {
    background: rgba(97, 122, 255, 0.15);
}

.empty-tab,
.status-area {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.status-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-15px);
    }

    60% {
        transform: translateY(-7px);
    }
}

/* ---- Footer ---- */
.site-footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================================
   等待页面 - 资源获取中
   ============================================================ */
.waiting-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    background: var(--bg);
}

.waiting-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
    max-width: 420px;
    width: 100%;
    animation: cardFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 进度圈增强 */
.progress-ring-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 2rem;
}

.progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring__track {
    fill: none;
    stroke: var(--border);
    stroke-width: 10;
}

.progress-ring__fill {
    fill: none;
    stroke: url(#grad);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.4s ease;
    filter: drop-shadow(0 0 4px rgba(123, 44, 191, 0.3));
}

.progress-ring__pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
    background: linear-gradient(135deg, var(--baidu) 0%, var(--quark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.waiting-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.waiting-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

/* 步骤条美化 */
.step-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
    background: var(--bg);
    padding: 20px;
    border-radius: var(--radius-sm);
}

.step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: all 0.3s;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: all 0.3s;
}

.step-item.active {
    color: var(--text);
    font-weight: 600;
}

.step-item.active .step-dot {
    background: var(--quark);
    box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.2);
    animation: dotPulse 1.5s infinite;
}

.step-item.done {
    color: #10b981;
}

.step-item.done .step-dot {
    background: #10b981;
}

@keyframes dotPulse {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.2);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(123, 44, 191, 0.1);
    }
}

.back-link {
    display: inline-block;
    margin-top: 2rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--quark);
}

@media (max-width: 640px) {
    .logo h1 {
        font-size: 2rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
    }

    .tabs {
        width: 100%;
        display: flex;
    }

    .tab-btn {
        flex: 1;
        justify-content: center;
    }

    .result-list {
        grid-template-columns: 1fr;
    }
}

/* ---- Theme Toggle Button ---- */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.25rem;
    z-index: 100;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--hover-shadow);
}