/* Shared styles for the dashboard.
   The page sets --primary-gradient and body background-image in its own <style>. */

:root {
    --bg-color: #060d1a;
    --glass-bg: rgba(8, 14, 28, 0.82);
    --glass-border: rgba(148, 163, 184, 0.14);
    --accent: #38bdf8;
    --success: #10b981;
    --alert: #f97316;
    --text-main: #f8fafc;
    --text-muted: #8ea0b8;
    --chart-height: 260px;
    --chart-height-mobile: 200px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

p.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.dashboard-container {
    width: 100%;
    max-width: 1400px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media(min-width: 1024px) {
    .dashboard-container { grid-template-columns: 1fr 1fr; }
    .full-width { grid-column: 1 / -1; }
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    padding: 1.1rem 1.2rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-top: 3px solid var(--glass-border);
    text-align: left;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 150px;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.1); }

.stat-card.is-deal {
    border-color: rgba(249, 115, 22, 0.35);
    background: linear-gradient(180deg, rgba(249,115,22,0.09) 0%, rgba(255,255,255,0.03) 60%);
}

.stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.3;
    font-weight: 600;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-value.deal { color: var(--alert); }

.stat-refs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.3rem;
    padding-top: 0.6rem;
    border-top: 1px dashed rgba(255,255,255,0.06);
}

.stat-ref {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.stat-ref-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.stat-ref-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-ref.ref-min .stat-ref-value { color: var(--success); }
.stat-ref.ref-max .stat-ref-value { color: #fca5a5; }

.stat-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.2rem;
    padding-top: 0.4rem;
}

.stat-reserve {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s;
}
.stat-reserve:hover { opacity: 1; color: var(--accent); }

.stat-deal-badge {
    display: none;
    align-items: center;
    gap: 0.25rem;
    background: rgba(249, 115, 22, 0.14);
    color: var(--alert);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(249, 115, 22, 0.35);
    text-transform: uppercase;
}

.stat-card.is-deal .stat-deal-badge {
    display: inline-flex;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0%   { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4); }
    70%  { box-shadow: 0 0 0 6px rgba(249, 115, 22, 0); }
    100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

.chart-container {
    position: relative;
    height: var(--chart-height);
    width: 100%;
}

.top-nav {
    width: 100%;
    max-width: 1400px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.nav-link {
    padding: 0.6rem 1.4rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
}

.nav-link.active {
    color: var(--text-main);
    background: var(--glass-bg);
    border-color: var(--glass-border);
    backdrop-filter: blur(16px);
}

.sync-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
}

.sync-btn:hover  { color: var(--text-main); border-color: var(--accent); }
.sync-btn.running { color: var(--accent); pointer-events: none; }

/* Accordion (<details>) usado no Live Feed */
details.feed-accordion { padding: 0; overflow: hidden; }
details.feed-accordion > summary {
    list-style: none;
    cursor: pointer;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    user-select: none;
    transition: background 0.15s;
}
details.feed-accordion > summary::-webkit-details-marker { display: none; }
details.feed-accordion > summary:hover { background: rgba(255,255,255,0.02); }
details.feed-accordion > summary .chevron {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: transform 0.2s ease;
    display: inline-block;
}
details.feed-accordion[open] > summary .chevron { transform: rotate(90deg); }
details.feed-accordion > .feed-body { padding: 0 1.2rem 1rem; }

/* Mobile */
@media(max-width: 768px) {
    body           { padding: 1rem 0.75rem; padding-top: 3.5rem; }
    h1             { font-size: 1.5rem; }
    p.subtitle     { font-size: 0.9rem; margin-bottom: 1rem; }
    .sync-btn      { top: 0.5rem; right: 0.5rem; padding: 0.4rem 0.7rem; font-size: 0.7rem; border-radius: 8px; }
    .top-nav       { margin-bottom: 1rem; }
    .nav-link      { padding: 0.5rem 1rem; font-size: 0.8rem; }
    .glass-panel   { padding: 1rem; border-radius: 14px; overflow-x: auto; }
    .dashboard-container { gap: 1rem; }
    .stat-grid     { grid-template-columns: 1fr; gap: 0.7rem; }
    .stat-card     { padding: 0.9rem; min-height: 140px; }
    .stat-value    { font-size: 1.5rem; }
    .stat-label    { font-size: 0.6rem; letter-spacing: 0.5px; }
    .stat-ref-label { font-size: 0.55rem; }
    .stat-ref-value { font-size: 0.8rem; }
    .chart-container { height: var(--chart-height-mobile); }
}
