/* CATA Web App — Multi-page dashboard */
/* Colors match Android app Compose theme */

:root {
    --bg-0: #0a0a0f;
    --bg-1: #12121a;
    --bg-2: #1a1a25;
    --text-0: #f0f0f5;
    --text-1: #b0b0c0;
    --text-2: #808095;
    --text-3: #505068;
    --accent: #6366f1;
    --gold: #FFC107;
    --green: #4CAF50;
    --red: #EF5350;
    --amber: #FF9800;
    --teal: #26A69A;
    --blue: #42A5F5;
    --purple: #AB47BC;
    --glass-bg: rgba(255,255,255,.04);
    --glass-border: rgba(255,255,255,.08);
    --mono: 'JetBrains Mono', monospace;
    --sans: 'Inter', -apple-system, sans-serif;
    --header-h: 56px;
    --nav-h: 48px;
}

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

body {
    font-family: var(--sans);
    background: var(--bg-0);
    color: var(--text-0);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-top: calc(var(--header-h) + var(--nav-h));
}

/* ═══════════════════════════════════════════════
   HEADER — sticky top bar
   ═══════════════════════════════════════════════ */
.app-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-h);
    padding: 0 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10,10,15,.92);
    backdrop-filter: blur(16px);
    z-index: 200;
}
.app-header h1 {
    font-size: 18px; font-weight: 700; letter-spacing: -.5px;
}
.app-header h1 span {
    color: var(--accent); font-size: 12px; margin-left: 8px;
    font-weight: 500; letter-spacing: 1px; text-transform: uppercase;
}
.header-right {
    display: flex; align-items: center; gap: 16px;
}
.header-right a {
    color: var(--text-3); text-decoration: none; font-size: 12px;
    transition: color .2s;
}
.header-right a:hover { color: var(--text-0); }

/* ═══════════════════════════════════════════════
   NAV BAR — page navigation below header
   ═══════════════════════════════════════════════ */
.app-nav {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    height: var(--nav-h);
    background: var(--bg-1);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 16px;
    z-index: 190;
}
.nav-link {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-3);
    text-decoration: none;
    border-radius: 6px;
    transition: all .2s;
    white-space: nowrap;
}
.nav-link:hover { color: var(--text-1); background: rgba(255,255,255,.04); }
.nav-link.active {
    color: #fff;
    background: var(--accent);
}

/* Asset-specific sub-nav (shown on asset pages) */
.sub-nav {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-1);
    border-radius: 8px;
    margin-bottom: 20px;
}
.sub-nav a {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-3);
    text-decoration: none;
    border-radius: 6px;
    transition: all .2s;
}
.sub-nav a:hover { color: var(--text-1); }
.sub-nav a.active { color: #fff; background: var(--accent); }

/* ═══════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════ */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 64px;
}

/* Page title */
.page-title {
    font-size: 20px; font-weight: 700; margin-bottom: 4px;
}
.page-subtitle {
    font-size: 13px; color: var(--text-3); margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════
   GLASS CARDS
   ═══════════════════════════════════════════════ */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════
   PAGELLA — Big accuracy card
   ═══════════════════════════════════════════════ */
.big-card {
    text-align: center;
    padding: 28px 24px;
    margin-bottom: 16px;
    border-color: rgba(255,193,7,.25);
    background: linear-gradient(145deg, rgba(255,193,7,.08), rgba(255,193,7,.02));
}
.big-card .label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 2px; color: rgba(255,193,7,.6); margin-bottom: 6px;
}
.big-card .value {
    font-size: 48px; font-weight: 800; font-family: var(--mono);
    color: var(--gold); line-height: 1;
}
.big-card .sub {
    font-size: 12px; color: var(--text-3); margin-top: 8px;
}

/* ═══════════════════════════════════════════════
   BAR ROWS — module accuracy bars
   ═══════════════════════════════════════════════ */
.bar-row { margin-bottom: 12px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-header {
    display: flex; justify-content: space-between; margin-bottom: 5px;
}
.bar-label { font-size: 13px; color: var(--text-2); }
.bar-value { font-size: 13px; font-weight: 600; font-family: var(--mono); }
.bar-track {
    height: 6px; border-radius: 3px; overflow: hidden;
}
.bar-fill {
    height: 100%; border-radius: 3px;
    transition: width .8s cubic-bezier(.22,1,.36,1);
}

/* ═══════════════════════════════════════════════
   TREND INDICATOR
   ═══════════════════════════════════════════════ */
.trend-card {
    text-align: center; padding: 14px;
    margin: 16px 0;
}
.trend-card.improving { border-color: rgba(76,175,80,.3); background: rgba(76,175,80,.06); }
.trend-card.stable { border-color: rgba(255,152,0,.3); background: rgba(255,152,0,.06); }
.trend-card.declining { border-color: rgba(239,83,80,.3); background: rgba(239,83,80,.06); }
.trend-label { font-size: 14px; font-weight: 700; }

/* ═══════════════════════════════════════════════
   STAT ROW — key-value pairs
   ═══════════════════════════════════════════════ */
.stat-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,.03);
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-2); }
.stat-value { font-weight: 600; font-family: var(--mono); }

/* ═══════════════════════════════════════════════
   WATCHLIST — asset cards on dashboard
   ═══════════════════════════════════════════════ */
.asset-card {
    cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
    transition: border-color .2s, transform .15s;
}
.asset-card:hover {
    border-color: rgba(99,102,241,.3);
    transform: translateY(-1px);
}
.asset-symbol { font-size: 16px; font-weight: 700; }
.asset-name { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.asset-meta { text-align: right; }
.asset-direction {
    display: inline-block;
    font-size: 11px; font-weight: 700; font-family: var(--mono);
    padding: 3px 8px; border-radius: 4px;
    text-transform: uppercase; letter-spacing: .5px;
}
.asset-direction.buy { color: var(--green); background: rgba(76,175,80,.12); }
.asset-direction.sell { color: var(--red); background: rgba(239,83,80,.12); }
.asset-direction.hold { color: var(--amber); background: rgba(255,152,0,.12); }
.asset-price {
    font-size: 12px; color: var(--text-2); margin-top: 4px;
    font-family: var(--mono);
}
.asset-count { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ═══════════════════════════════════════════════
   SECTION HEADERS
   ═══════════════════════════════════════════════ */
.section-title {
    font-size: 13px; font-weight: 600; color: var(--text-2);
    margin: 28px 0 12px; text-transform: uppercase; letter-spacing: 1px;
}
.section-title:first-child { margin-top: 0; }

/* ═══════════════════════════════════════════════
   MODULE CARDS — expandable analysis modules
   ═══════════════════════════════════════════════ */
.module-card { transition: border-color .2s; }
.module-card[open] { border-color: rgba(99,102,241,.2); }
.module-card summary {
    cursor: pointer; list-style: none; display: flex;
    justify-content: space-between; align-items: center;
}
.module-card summary::-webkit-details-marker { display: none; }
.module-name { font-size: 14px; font-weight: 600; }
.module-tag {
    font-size: 10px; font-weight: 700; padding: 3px 8px;
    border-radius: 4px; text-transform: uppercase; letter-spacing: .5px;
}
.module-body {
    margin-top: 14px; padding-top: 14px;
    border-top: 1px solid var(--glass-border);
    font-size: 13px; color: var(--text-1); line-height: 1.7;
}
.module-body pre {
    background: var(--bg-0); border-radius: 8px; padding: 12px;
    font-family: var(--mono); font-size: 12px; overflow-x: auto;
    white-space: pre-wrap; margin-top: 8px; line-height: 1.5;
}

/* ═══════════════════════════════════════════════
   ASSET HEADER — price, direction, strength
   ═══════════════════════════════════════════════ */
.asset-hero {
    text-align: center;
    padding: 24px 16px;
    margin-bottom: 20px;
    border-color: rgba(99,102,241,.2);
    background: linear-gradient(145deg, rgba(99,102,241,.06), rgba(99,102,241,.02));
}
.asset-hero .hero-symbol {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 2px; color: rgba(99,102,241,.6); margin-bottom: 4px;
}
.asset-hero .hero-price {
    font-size: 36px; font-weight: 800; font-family: var(--mono);
    color: var(--text-0); line-height: 1;
}
.asset-hero .hero-time {
    font-size: 12px; color: var(--text-3); margin-top: 6px;
}

/* Metric pills (direction/strength/target row) */
.metric-row {
    display: flex; gap: 8px; margin-bottom: 16px;
}
.metric-pill {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
}
.metric-pill .metric-label {
    font-size: 10px; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px;
}
.metric-pill .metric-value {
    font-size: 18px; font-weight: 700; font-family: var(--mono);
}

/* Gating card */
.gating-card .gating-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-3); margin-bottom: 6px;
}
.gating-card .gating-verdict {
    font-size: 15px; font-weight: 700; font-family: var(--mono);
}
.gating-card .gating-reasons {
    font-size: 12px; color: var(--text-2); margin-top: 6px;
}

/* ═══════════════════════════════════════════════
   HISTORY — analysis list on storico page
   ═══════════════════════════════════════════════ */
.history-item {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color .2s;
}
.history-item:hover { border-color: rgba(99,102,241,.2); }
.history-date {
    font-size: 13px; font-weight: 600; color: var(--text-0);
}
.history-meta {
    font-size: 12px; color: var(--text-3); margin-top: 2px;
}
.history-right {
    display: flex; align-items: center; gap: 8px;
}
.history-badge {
    font-size: 10px; color: var(--teal); font-weight: 500;
}

/* ═══════════════════════════════════════════════
   EMPTY & LOADING STATES
   ═══════════════════════════════════════════════ */
.empty {
    text-align: center; padding: 80px 24px; color: var(--text-3);
}
.empty h2 {
    font-size: 18px; margin-bottom: 8px; color: var(--text-2); font-weight: 600;
}
.empty p { font-size: 14px; line-height: 1.7; }

.loading { text-align: center; padding: 64px; }
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-3); font-size: 13px; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
    .container { padding: 20px 12px 64px; }
    .big-card .value { font-size: 38px; }
    .asset-hero .hero-price { font-size: 28px; }
    .metric-pill .metric-value { font-size: 15px; }
    .nav-link { padding: 8px 10px; font-size: 12px; }
    .app-nav { gap: 2px; }
}
