@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;700&display=swap');
:root {
    /* Unified public theme variables (kept consistent with data/charts/style.css) */
    --background: #262a33;         /* page background */
    --component-bg: #1f232c;       /* containers/panels */
    --text-primary: #e5f7ef;       /* main text */
    --text-secondary: #646669;     /* secondary text */
    --accent: #43ffaf;             /* accent / positive */
    --border-color: #1f232c;       /* subtle borders */
    --error: #d22a2a;              /* negative */
    /* nav skew menu config */
    --skew-angle: 25deg;
    --menu-radius: 7px;
}

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

body {
    font-family: 'Roboto Mono', monospace;
    background-color: var(--background);
    color: var(--text-primary);
    margin: 0;
    padding: 0; /* ensure header/footer can be full-width */
    line-height: 1.6;
}

header {
    background-color: var(--component-bg); /* full-width title bar with component background */
    padding: 0.25rem 0; /* much tighter header since H1 is hidden */
    text-align: center;
    color: var(--text-primary);
    position: relative; /* allow burger positioning */
}

header h1 {
    margin-bottom: 0.5rem;
    font-size: 2rem; /* normalized to match overall site scale */
}

#last-updated {
    font-style: italic;
    opacity: 0.8;
    text-align: center;
    margin-bottom: 0.75rem;
}

/* Top navigation (reusable) */
.top-nav {
    position: relative; /* not sticky */
    z-index: 10;
    background: linear-gradient(180deg, rgba(31,35,44,0.98) 0%, rgba(31,35,44,0.92) 100%);
    border-bottom: 1px solid var(--border-color);
}

.top-nav__inner {
    max-width: 1200px; /* centered content with breathing room on both sides */
    margin: 0 auto;
    /* Keep slight left shift */
    padding: 0.5rem 1.25rem 0.5rem 0.75rem; /* top right bottom left */
    display: flex;
    flex-direction: column; /* stack logo above menu */
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.top-nav__left { display: flex; align-items: center; gap: 0.75rem; }

.top-nav__logo { height: 28px; width: auto; display: block; }
.top-nav__logo-link { display: inline-flex; align-items: center; }
/* Accent-colored SVG via mask; bigger (2x) */
.top-nav__logo-mask {
  display: inline-block;
  /* Fluid size: stays within these bounds and scales with viewport */
  height: clamp(64px, 10.35vw, 96px); /* ~+15% */
  width: clamp(230px, 41.4vw, 345px);  /* ~+15% */
  background-color: var(--accent);
  -webkit-mask: url('Vice_Logo.svg') no-repeat center / contain;
          mask: url('Vice_Logo.svg') no-repeat center / contain;
}
.top-nav__wordmark { display: none; }

.top-nav__center { position: static; left: auto; top: auto; transform: none; display: flex; justify-content: center; width: 100%; }

/* Skewed menu inspired by CodePen (variables converted to CSS custom properties) */
.skew-menu { text-align: center; }
.skew-menu ul { display: inline-block; margin: 0; padding: 0; list-style: none; transform: skew(calc(-1 * var(--skew-angle))); }
.skew-menu ul li { background: #fff; float: left; border-right: 1px solid #eee; box-shadow: 0 1px 1px rgba(0,0,0,0.1); text-transform: uppercase; color: #555; font-weight: 700; transition: all 0.3s linear; }
.skew-menu ul li:first-child { border-radius: var(--menu-radius) 0 0 var(--menu-radius); }
.skew-menu ul li:last-child { border-right: none; border-radius: 0 var(--menu-radius) var(--menu-radius) 0; }
.skew-menu ul li:hover { background: #eee; color: var(--accent); }
.skew-menu ul li a { display: block; padding: 0.6rem 1.2rem; color: inherit; text-decoration: none; transform: skew(var(--skew-angle)); }

/* Skewed menu colors: accent background, component-bg text; on hover keep accent bg and turn text primary */
.top-nav .skew-menu ul li { background: var(--accent); color: var(--component-bg); border-right: 1px solid rgba(0,0,0,0.0); box-shadow: none; }
.top-nav .skew-menu ul li:hover { background: var(--accent); color: var(--text-primary); }
.top-nav .skew-menu ul li a { padding: 0.55rem 1rem; }

/* Responsive: simplify skew on tablets and smaller */
@media (max-width: 1024px) {
  .top-nav__inner { flex-wrap: wrap; gap: 0.5rem; }
  /* Place menu below logo in normal flow to avoid overlap */
  .top-nav__center { order: 2; width: 100%; position: static; transform: none; left: auto; top: auto; margin-top: 0.25rem; }
  /* De-skew and wrap buttons nicely */
  .skew-menu ul { transform: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; }
  .skew-menu ul li { border-radius: 8px; margin: 0.25rem; border-right: none; }
  .skew-menu ul li a { transform: none; padding: 0.45rem 0.8rem; font-size: 0.95rem; }
}

/* When nav is present, we can hide the old page title, but keep last-updated */
body .top-nav ~ header h1 { display: none; }

/* Remove extra spacer below nav */
.top-nav + header { padding-top: 0; }

main {
    width: 98%;
    max-width: none;
    margin: 0.5rem auto; /* tighter top spacing */
    padding: 0;
}

.dashboard-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem; /* slightly reduced vertical gaps between blocks */
}

/* Glowing Cyberpunk Button */
.metrics-card .glowing-btn {
    position: relative;
    display: block;
    width: 100%;
    color: var(--accent);
    cursor: pointer;
    padding: 0.5em 1em;
    border: 0.15em solid var(--accent);
    border-radius: 0.45em;
    background: none;
    font-family: 'Roboto Mono', monospace;
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-decoration: none;
    text-align: center;
    /* Remove outer/inset glow; keep text neon only */
    box-shadow: none;
    animation: none;
}

.metrics-card .glowing-txt {
    margin-right: 0.2em;
    text-shadow: 0 0 0.125em hsl(0 0% 100% / 0.3),
                 0 0 0.45em var(--accent);
    animation: text-flicker 3s linear infinite;
}

.metrics-card .faulty-letter {
    opacity: 0.5;
    animation: faulty-flicker 2s linear infinite;
}

.metrics-card .glowing-btn::before { display: none; }

.metrics-card .glowing-btn::after { display: none; }

.metrics-card .glowing-btn:hover {
    color: rgba(0, 0, 0, 0.8);
    text-shadow: none;
}

.metrics-card .glowing-btn:hover .glowing-txt {
    animation: none;
}

.metrics-card .glowing-btn:hover .faulty-letter {
    animation: none;
    text-shadow: none;
    opacity: 1;
}

.metrics-card .glowing-btn:hover::before {
    filter: blur(1.5em);
    opacity: 1;
}

.metrics-card .glowing-btn:hover::after {
    opacity: 1;
}

@keyframes faulty-flicker {
    0% { opacity: 0.1; }
    2% { opacity: 0.1; }
    4% { opacity: 0.5; }
    19% { opacity: 0.5; }
    21% { opacity: 0.1; }
    23% { opacity: 1; }
    80% { opacity: 0.5; }
    83% { opacity: 0.4; }
    87% { opacity: 1; }
}

@keyframes text-flicker {
    0% { opacity: 0.1; }
    2% { opacity: 1; }
    8% { opacity: 0.1; }
    9% { opacity: 1; }
    12% { opacity: 0.1; }
    20% { opacity: 1; }
    25% { opacity: 0.3; }
    30% { opacity: 1; }
    70% { opacity: 0.7; }
    72% { opacity: 0.2; }
    77% { opacity: 0.9; }
    100% { opacity: 0.9; }
}

@keyframes border-flicker {
    0% { opacity: 0.1; }
    2% { opacity: 1; }
    4% { opacity: 0.1; }
    8% { opacity: 1; }
    70% { opacity: 0.7; }
    100% { opacity: 1; }
}


/* Responsive design */
@media (max-width: 768px) {
    .dashboard-container {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (min-width: 768px) {
    .dashboard-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .metrics-card, .chart-container {
        grid-column: span 2;
    }
}

.metrics-card, .chart-container {
    background-color: var(--component-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.metrics-card h2, .chart-container h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.metrics-tabs {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tab-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent);
    font-weight: 500;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.metric {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background-color: var(--background); /* small tiles use page background for contrast */
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.metric-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-bottom: 0.3rem;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-primary);
}

.positive {
    color: var(--accent);
}

.negative {
    color: var(--error);
}

.chart {
    height: 400px !important;
    width: 100% !important;
    /* remove strict max-height so axes/titles can fit */
    max-height: none !important;
}

.chart-container {
    /* Let the container grow with content to avoid clipping axes on small screens */
    height: auto !important;
    max-height: none !important;
    overflow: visible;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.filter-btn {
    background: var(--component-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-btn:hover {
    background: #3E404C;
}

.filter-btn.active {
    background: var(--accent);
    color: var(--component-bg);
    border-color: var(--accent);
}

/* Stats Cards Section - Updated to match original */
.container {
    width: 98%;
    max-width: none;
    margin: 1rem auto; /* unified spacing with other pages */
    padding: 0;
}

.container h1 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 2.2rem;
}

.last-updated {
    text-align: center;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    font-style: italic;
}

.stats-section {
    background-color: var(--component-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stats-section h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background-color: var(--background); /* small tiles */
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-primary);
}

/* Responsive design for stats cards */
@media (max-width: 1200px) {
    .stats-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .container h1 {
        font-size: 2rem;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    /* On very small screens, give charts extra height so axis titles and tick labels fit */
    .chart {
        height: 520px !important;
    }
}

footer {
    text-align: center;
    padding: 1.5rem 0; /* remove side padding bar feeling */
    margin-top: 2rem;
    background-color: var(--background); /* same as page */
    color: var(--text-secondary);
    opacity: 0.8;
}
