/* ═══════════════════════════════════════
   Investment Radar — Premium Dark Theme
   ═══════════════════════════════════════ */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a1f35;
    --bg-hover: #242b45;
    --bg-glass: rgba(26, 31, 53, 0.7);
    --border: rgba(99, 102, 241, 0.15);
    --border-hover: rgba(99, 102, 241, 0.3);

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

    --accent: #818cf8;
    --accent-glow: rgba(129, 140, 248, 0.2);
    --green: #34d399;
    --green-bg: rgba(52, 211, 153, 0.1);
    --red: #fb7185;
    --red-bg: rgba(251, 113, 133, 0.1);
    --yellow: #fbbf24;
    --yellow-bg: rgba(251, 191, 36, 0.1);
    --blue: #60a5fa;
    --blue-bg: rgba(96, 165, 250, 0.1);

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, 'PingFang SC', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ═══ Header ═══ */
.header {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 32px; filter: drop-shadow(0 0 12px var(--accent-glow)); }
.logo h1 {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}
.subtitle { font-size: 12px; color: var(--text-muted); }

.update-badge {
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* ═══ Sections ═══ */
.section {
    margin: 24px 0;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(10px);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title .icon { font-size: 18px; }

.stock-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: auto;
}

/* ═══ Status Cards ═══ */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.status-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

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

.status-card .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.status-card .value {
    font-size: 24px;
    font-weight: 700;
}

.status-card .sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ═══ Coverage Bars ═══ */
.coverage-bar-container { display: flex; flex-wrap: wrap; gap: 8px; }

.coverage-item {
    flex: 1 1 180px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    border: 1px solid var(--border);
}

.coverage-item .label {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.bar-track {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.8s ease;
    background: linear-gradient(90deg, var(--accent), var(--green));
}

.bar-fill.warn { background: linear-gradient(90deg, var(--yellow), var(--red)); }

/* ═══ Tags ═══ */
.criteria-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 500;
}
.tag-primary { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(129,140,248,0.2); }
.tag-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(52,211,153,0.2); }
.tag-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(251,113,133,0.2); }
.tag-info { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(96,165,250,0.2); }

/* ═══ Table ═══ */
.table-wrapper { overflow-x: auto; }

.stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stock-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    white-space: nowrap;
    user-select: none;
}

.stock-table th.num { text-align: right; }
.stock-table th.sortable { cursor: pointer; }
.stock-table th.sortable:hover { color: var(--accent); }
.stock-table th.sorted-asc::after { content: ' ▲'; font-size: 10px; }
.stock-table th.sorted-desc::after { content: ' ▼'; font-size: 10px; }

.stock-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    white-space: nowrap;
}

.stock-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.stock-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}
.stock-table tbody tr:hover { background: var(--bg-hover); }

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
}

.score-9 { background: linear-gradient(135deg, #818cf8, #c084fc); color: white; }
.score-8 { background: rgba(129,140,248,0.2); color: var(--accent); }
.score-7 { background: rgba(52,211,153,0.15); color: var(--green); }
.score-low { background: rgba(255,255,255,0.05); color: var(--text-muted); }

.board-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}
.board-沪主板 { background: rgba(251,191,36,0.1); color: var(--yellow); }
.board-深主板 { background: rgba(96,165,250,0.1); color: var(--blue); }
.board-创业板 { background: rgba(129,140,248,0.1); color: var(--accent); }

.positive { color: var(--red) !important; }
.negative { color: var(--green) !important; }

.dual-badge {
    font-size: 10px;
    background: var(--green-bg);
    color: var(--green);
    padding: 1px 5px;
    border-radius: 3px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* ═══ Modal ═══ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 20px;
    overflow-y: auto;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 700px;
    box-shadow: var(--shadow);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.modal-header h3 { font-size: 18px; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 24px; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.detail-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
}
.detail-item .label { font-size: 11px; color: var(--text-muted); }
.detail-item .value { font-size: 18px; font-weight: 700; margin-top: 4px; }

.history-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}
.history-table th {
    text-align: right;
    color: var(--text-muted);
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}
.history-table th:first-child { text-align: left; }
.history-table td {
    text-align: right;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.history-table td:first-child { text-align: left; color: var(--text-secondary); }

/* ═══ Skeleton ═══ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    min-height: 80px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ═══ Footer ═══ */
.footer {
    text-align: center;
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}
.footer-sub { margin-top: 4px; font-size: 11px; }

/* ═══ Process Badge ═══ */
.process-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    margin: 2px;
}
.process-running {
    background: var(--green-bg);
    color: var(--green);
}
.process-running::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
    .status-grid { grid-template-columns: repeat(2, 1fr); }
    .header-inner { flex-direction: column; gap: 8px; }
    .section { padding: 16px; }
    .stock-table { font-size: 11px; }
    .stock-table th, .stock-table td { padding: 8px 4px; }
}
