/* 电商爆品雷达 v3.0 — 样式与动画 */
:root {
    --bg: #0f172a;
    --panel-bg: #1e293b;
    --border: #334155;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-glow: rgba(56, 189, 248, 0.25);
    --gold: #fbbf24;
    --gold-glow: rgba(251, 191, 36, 0.3);
    --silver: #94a3b8;
    --bronze: #d97706;
    --danger: #ef4444;
    --success: #22c55e;
    --purple: #a78bfa;
    --purple-glow: rgba(167, 139, 250, 0.25);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================================
   全局动画
   ============================================================ */

/* 背景粒子效果 */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse 80% 80% at 20% 20%, rgba(56, 189, 248, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse 60% 60% at 80% 60%, rgba(167, 139, 250, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse 50% 50% at 50% 80%, rgba(251, 191, 36, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-100%); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px var(--accent-glow); }
    50%      { box-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(56, 189, 248, 0.12); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   IPv6 横幅
   ============================================================ */
.ipv6-banner {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    background: linear-gradient(135deg, #1e3a5f 0%, #1a2744 100%);
    border-bottom: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--accent);
    font-size: 0.88rem;
    animation: slideDown 0.5s ease-out;
    backdrop-filter: blur(8px);
}

.ipv6-banner .ipv6-icon {
    font-size: 1.2rem;
    animation: float 3s ease-in-out infinite;
}

.ipv6-banner .ipv6-text strong {
    color: #fff;
    font-weight: 700;
}

.ipv6-banner .ipv6-close {
    position: absolute;
    right: 1rem;
    background: none;
    border: 1px solid rgba(56, 189, 248, 0.2);
    color: var(--accent);
    width: 24px; height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
}

.ipv6-banner .ipv6-close:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--accent);
}

/* ============================================================
   头部
   ============================================================ */
.header {
    position: relative;
    text-align: center;
    padding: 2.5rem 1rem;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
}

.header-glow {
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.06) 0%, transparent 70%);
    pointer-events: none;
    animation: pulse-glow 4s ease-in-out infinite;
}

.header-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    position: relative;
    animation: fadeInUp 0.7s ease-out;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: fadeInUp 0.7s ease-out 0.15s both;
}

/* ============================================================
   导航栏
   ============================================================ */
.nav-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.nav-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-group label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.nav-group select {
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s;
    outline: none;
}

.nav-group select:hover {
    border-color: var(--accent);
}

.nav-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.tab {
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tab::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.3s;
}

.tab:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.tab:hover::after { opacity: 0.05; }

.tab.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.tab.active::after { display: none; }

/* ============================================================
   内容区
   ============================================================ */
.content {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

.panel {
    display: none;
    animation: fadeInUp 0.4s ease-out;
}

.panel.active {
    display: block;
}

/* ============================================================
   表格
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel-bg);
    border-radius: 12px;
    overflow: hidden;
    animation: scaleIn 0.5s ease-out;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

thead {
    background: linear-gradient(135deg, #0f2744 0%, #162544 100%);
}

th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

td {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    transition: background 0.2s;
}

tbody tr {
    transition: all 0.25s;
    animation: fadeInUp 0.4s ease-out both;
}

tbody tr:nth-child(1)  { animation-delay: 0.05s; }
tbody tr:nth-child(2)  { animation-delay: 0.10s; }
tbody tr:nth-child(3)  { animation-delay: 0.15s; }
tbody tr:nth-child(4)  { animation-delay: 0.20s; }
tbody tr:nth-child(5)  { animation-delay: 0.25s; }
tbody tr:nth-child(6)  { animation-delay: 0.30s; }
tbody tr:nth-child(7)  { animation-delay: 0.35s; }
tbody tr:nth-child(8)  { animation-delay: 0.40s; }
tbody tr:nth-child(9)  { animation-delay: 0.45s; }
tbody tr:nth-child(10) { animation-delay: 0.50s; }

tbody tr:hover {
    background: rgba(56, 189, 248, 0.06);
    transform: translateX(4px);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    transition: transform 0.3s;
}

tbody tr:hover .rank-badge {
    transform: scale(1.15);
}

.rank-1 {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #000;
    box-shadow: 0 0 12px var(--gold-glow);
    animation: pulse-glow 2s ease-in-out infinite;
}
.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #94a3b8 100%);
    color: #000;
}
.rank-3 {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #000;
}

.price { font-weight: 600; color: var(--accent); }
.sales { color: var(--text-secondary); font-size: 0.85rem; }

/* ============================================================
   信号卡片
   ============================================================ */
.signal-card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.4s ease-out both;
}

.signal-card:nth-child(1)  { animation-delay: 0.03s; }
.signal-card:nth-child(2)  { animation-delay: 0.06s; }
.signal-card:nth-child(3)  { animation-delay: 0.09s; }
.signal-card:nth-child(4)  { animation-delay: 0.12s; }
.signal-card:nth-child(5)  { animation-delay: 0.15s; }
.signal-card:nth-child(n+6) { animation-delay: 0.18s; }

.signal-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--accent-glow);
}

.signal-card .keyword { font-weight: 600; font-size: 1rem; }
.signal-card .meta { color: var(--text-secondary); font-size: 0.8rem; margin-top: 0.2rem; }
.signal-card .growth {
    color: var(--success);
    font-weight: 700;
    font-size: 1.1rem;
    transition: transform 0.3s;
}
.signal-card:hover .growth { transform: scale(1.1); }
.signal-card .growth.negative { color: var(--danger); }

/* ============================================================
   建议卡片
   ============================================================ */
.rec-card {
    background: var(--panel-bg);
    border: 1px solid var(--accent);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.4s ease-out both;
    position: relative;
    overflow: hidden;
}

.rec-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent), var(--purple));
    border-radius: 4px 0 0 4px;
}

.rec-card:nth-child(1) { animation-delay: 0.05s; }
.rec-card:nth-child(2) { animation-delay: 0.12s; }
.rec-card:nth-child(3) { animation-delay: 0.19s; }
.rec-card:nth-child(n+4) { animation-delay: 0.26s; }

.rec-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 24px var(--accent-glow);
}

.rec-card h3 { color: var(--accent); margin-bottom: 0.5rem; }
.rec-card .score {
    display: inline-block;
    padding: 0.25rem 0.85rem;
    border-radius: 20px;
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

/* ============================================================
   加载/空状态/错误
   ============================================================ */
.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.loading::before {
    content: '';
    display: block;
    width: 40px; height: 40px;
    margin: 0 auto 1rem;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.error {
    color: var(--danger);
    text-align: center;
    padding: 3rem 2rem;
    animation: fadeIn 0.3s ease-out;
}

.empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    animation: fadeInUp 0.5s ease-out;
}

.empty small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.25s;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.footer a:hover {
    color: #fff;
    background: rgba(56, 189, 248, 0.1);
}

/* ============================================================
   设置页面
   ============================================================ */
.settings-page {
    min-height: 100vh;
    background: var(--bg);
    position: relative;
}

.settings-page::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse 70% 70% at 30% 10%, rgba(56, 189, 248, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse 60% 60% at 70% 50%, rgba(167, 139, 250, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse 50% 50% at 40% 90%, rgba(251, 191, 36, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.settings-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

.settings-header {
    text-align: center;
    padding: 3rem 1rem 2rem;
    animation: fadeInUp 0.6s ease-out;
}

.settings-header h1 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.settings-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.settings-card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease-out both;
    position: relative;
    overflow: hidden;
}

.settings-card:nth-child(1) { animation-delay: 0.05s; }
.settings-card:nth-child(2) { animation-delay: 0.12s; }
.settings-card:nth-child(3) { animation-delay: 0.19s; }
.settings-card:nth-child(4) { animation-delay: 0.26s; }
.settings-card:nth-child(5) { animation-delay: 0.33s; }
.settings-card:nth-child(6) { animation-delay: 0.40s; }

.settings-card:hover {
    border-color: rgba(56, 189, 248, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.settings-card-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.settings-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.settings-card .setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    font-size: 0.88rem;
}

.settings-card .setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    color: var(--text-secondary);
}

.setting-value {
    font-weight: 600;
    color: var(--text);
    text-align: right;
}

.setting-value.accent { color: var(--accent); }
.setting-value.gold { color: var(--gold); }
.setting-value.green { color: var(--success); }
.setting-value.purple { color: var(--purple); }

.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
    animation: pulse-glow 2s ease-in-out infinite;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-dot.warning {
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.settings-full {
    grid-column: 1 / -1;
}

.model-tag {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    font-size: 0.78rem;
    margin: 0.2rem;
    font-weight: 600;
}

.model-tag.active-tag {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.model-tag.inactive-tag {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.settings-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.25s;
    margin-bottom: 1.5rem;
}

.settings-back:hover {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.08);
}

.settings-time {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-top: 1rem;
    animation: fadeIn 0.8s ease-out 0.5s both;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
    .nav-bar { flex-direction: column; align-items: flex-start; }
    .nav-tabs { margin-left: 0; }
    .header h1 { font-size: 1.4rem; }
    th, td { padding: 0.6rem 0.5rem; font-size: 0.8rem; }
    .settings-grid { grid-template-columns: 1fr; }
}
