/* ============================================================
   ETF 国家队量化看板 — 全局样式
   深色主题 + 玻璃态 + 现代感
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ─── */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(31, 41, 55, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(99, 102, 241, 0.3);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #6366f1;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

    --color-up: #ef4444;
    --color-down: #22c55e;
    --color-up-bg: rgba(239, 68, 68, 0.1);
    --color-down-bg: rgba(34, 197, 94, 0.1);
    --color-neutral: #64748b;
    --color-new-badge: #f59e0b;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Subtle grid background */
body::before {
    content: '';
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
    pointer-events: none; z-index: 0;
}

/* ─── Layout ─── */
.app-container {
    position: relative; z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 32px;
}

/* ─── Header ─── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.header-title {
    display: flex; align-items: center; gap: 12px;
}

.header-title h1 {
    font-size: 1.6rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-title .icon { font-size: 1.8rem; }

.header-subtitle {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 0.3px;
}

.header-subtitle .date-value {
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-weight: 600;
}

.header-meta {
    display: flex; align-items: center; gap: 16px;
    color: var(--text-muted); font-size: 0.85rem;
}

.header-meta .status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #22c55e;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.05rem; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}

.card-title .emoji { font-size: 1.2rem; }

/* ─── Chart Container ─── */
.chart-container {
    width: 100%;
    height: 420px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* ─── Table ─── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

thead th {
    position: sticky; top: 0; z-index: 10;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

thead th:hover {
    color: var(--accent-blue);
}

thead th.sorted-asc::after { content: ' ↑'; color: var(--accent-blue); }
thead th.sorted-desc::after { content: ' ↓'; color: var(--accent-blue); }

tbody tr {
    transition: var(--transition);
    cursor: pointer;
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

tbody td.name-col {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.88rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Value Colors ─── */
.val-up { color: var(--color-up); }
.val-down { color: var(--color-down); }
.val-neutral { color: var(--color-neutral); }

.val-up-bg { background: var(--color-up-bg); border-radius: 4px; padding: 2px 6px; }
.val-down-bg { background: var(--color-down-bg); border-radius: 4px; padding: 2px 6px; }

/* ─── Badges ─── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-sans);
    letter-spacing: 0.5px;
}

.badge-new {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-new-badge);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-nt {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

/* ─── Detail Page ─── */
.back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    margin-bottom: 20px;
}

.back-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-blue);
    background: var(--bg-glass);
}

.detail-header {
    display: flex; align-items: baseline; gap: 16px;
    margin-bottom: 24px;
}

.detail-header h1 {
    font-size: 1.5rem; font-weight: 700;
}

.detail-header .code {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    font-size: 1.1rem;
}

/* ─── Holders Table ─── */
.holders-table tbody td {
    font-family: var(--font-sans);
    font-size: 0.85rem;
}

.holders-table .holder-name {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.holders-table .nt-highlight {
    background: rgba(99, 102, 241, 0.06);
}

/* ─── Time Selector ─── */
.time-selector {
    display: flex; gap: 6px;
}

.time-btn {
    padding: 5px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.time-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.time-btn.active {
    background: var(--accent-gradient);
    color: white; border-color: transparent;
}

/* ─── Loading ─── */
.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-muted);
}

.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

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

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .app-container { padding: 16px; }
    .chart-container { height: 320px; }
    .header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 768px) {
    html { font-size: 13px; }
    .card { padding: 16px; }
    .chart-container { height: 260px; }
}

/* ─── Report Date Labels ─── */
.report-dates {
    display: flex; gap: 16px;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 12px;
}

.report-dates span {
    display: flex; align-items: center; gap: 4px;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── No Data ─── */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 1rem;
}
