/* ===================================
   AI Compute Growth Simulator - Styles
   Premium Dark Mode Design
   =================================== */

:root {
    /* Colors - Epoch AI inspired palette */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Accent colors from Epoch chart */
    --accent-primary: #14b8a6;
    --accent-secondary: #06b6d4;
    --accent-tertiary: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-orange: #f97316;

    /* Chart colors matching Epoch */
    --nvidia-primary: #14b8a6;
    --nvidia-secondary: #2dd4bf;
    --nvidia-tertiary: #5eead4;
    --nvidia-light: #99f6e4;
    --google-primary: #f97316;
    --google-secondary: #fb923c;
    --google-tertiary: #fdba74;
    --amazon-primary: #3b82f6;
    --amazon-secondary: #60a5fa;
    --amd-primary: #ec4899;
    --amd-secondary: #f472b6;
    --huawei-primary: #8b5cf6;
    --huawei-secondary: #a78bfa;

    /* Glass effect */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(148, 163, 184, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Fonts */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --container-max: 1400px;
    --section-gap: 3rem;
}

/* Light mode overrides */
body:not(.dark-mode) {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

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

body.dark-mode {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(20, 184, 166, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        var(--bg-primary);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
    font-size: clamp(1.25rem, 2vw, 1.5rem);
}

/* Glass Card Effect */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 2rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

body:not(.dark-mode) .navbar {
    background: rgba(248, 250, 252, 0.9);
}

.nav-content {
    max-width: var(--container-max);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.nav-brand i {
    color: var(--accent-primary);
    font-size: 1.3rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-links a:hover {
    color: var(--accent-primary);
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: none;
    padding: 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--accent-primary);
    color: white;
}

/* Main Container */
.simulator-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 2rem;
}

/* Hero Section */
.hero-section {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3rem;
    align-items: center;
    padding: 4rem 0;
    margin-bottom: var(--section-gap);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.hero-content h1 {
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-bottom: 1.5rem;
}

.hero-subtitle .highlight {
    color: var(--accent-primary);
    font-weight: 600;
}

.epoch-attribution {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.epoch-attribution a {
    display: flex;
    align-items: center;
}

.epoch-logo {
    height: 24px;
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

body:not(.dark-mode) .epoch-logo {
    filter: none;
}

.epoch-attribution a:hover .epoch-logo {
    opacity: 1;
}

.hero-visual {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.floating-stat {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    animation: float 3s ease-in-out infinite;
}

.floating-stat.delay-1 {
    animation-delay: -1s;
}

.floating-stat.delay-2 {
    animation-delay: -2s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Control Panel */
.control-panel {
    padding: 2rem;
    margin-bottom: var(--section-gap);
}

.control-panel h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.control-panel h2 i {
    color: var(--accent-primary);
}

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

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.control-group label i {
    color: var(--accent-primary);
}

.control-value {
    margin-left: auto;
    color: var(--accent-primary);
    font-weight: 700;
    font-family: var(--font-mono);
}

/* Custom Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
    transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    cursor: grab;
    border: none;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
}

.control-hints {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Metrics Dashboard */
.metrics-dashboard {
    margin-bottom: var(--section-gap);
}

.metrics-dashboard h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.metrics-dashboard h2 i {
    color: var(--accent-primary);
}

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

.metric-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.metric-icon.growth {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.metric-icon.investment {
    background: linear-gradient(135deg, var(--accent-orange), #fbbf24);
    color: white;
}

.metric-icon.power {
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-purple));
    color: white;
}

.metric-icon.datacenters {
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    color: white;
}

.metric-icon.annual {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

/* Key Insights Panel */
.key-insights-panel {
    padding: 2rem;
    margin-bottom: var(--section-gap);
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.05), rgba(59, 130, 246, 0.05));
}

.key-insights-panel h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.key-insights-panel h2 i {
    color: var(--accent-primary);
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.insight-item {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.insight-item:last-child {
    border-bottom: none;
}

.insight-item .highlight {
    color: var(--accent-primary);
    font-weight: 700;
    font-family: var(--font-mono);
}

.insight-item .highlight.orange {
    color: var(--accent-orange);
}

.insight-item .highlight.purple {
    color: var(--accent-purple);
}

.insight-item .highlight.blue {
    color: var(--accent-tertiary);
}

/* Historical Section */
.historical-section {
    margin-bottom: var(--section-gap);
}

.historical-section .full-width {
    width: 100%;
}

.historical-section .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

@media (min-width: 768px) {
    .historical-section .chart-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.chart-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.manufacturer-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mfr-btn {
    padding: 0.4rem 0.8rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--btn-color, var(--glass-border));
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mfr-btn:hover {
    background: var(--btn-color);
    color: white;
}

.mfr-btn.active {
    background: var(--btn-color);
    color: white;
    border-color: var(--btn-color);
}

.historical-chart {
    min-height: 450px;
}

.historical-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.hist-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.hist-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hist-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-primary);
}

.metric-content {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Charts Section */
.charts-section {
    margin-bottom: var(--section-gap);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-card {
    padding: 1.5rem;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.chart-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.chart-header h3 i {
    color: var(--accent-primary);
}

.chart-container {
    flex: 1;
    position: relative;
    min-height: 300px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.scenario-buttons {
    display: flex;
    gap: 0.5rem;
}

.scenario-btn {
    padding: 0.4rem 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scenario-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.scenario-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Insights Section */
.insights-section {
    padding: 2rem;
    margin-bottom: var(--section-gap);
}

.insights-section h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.insights-section h2 i {
    color: var(--accent-orange);
}

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

.insight-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    transition: transform var(--transition-fast);
}

.insight-card:hover {
    transform: translateY(-3px);
}

.insight-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.insight-content h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.insight-value {
    font-size: 1.75rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--accent-primary);
    margin: 0;
}

.insight-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Chip Breakdown Section */
.chip-breakdown {
    padding: 2rem;
    margin-bottom: var(--section-gap);
}

.chip-breakdown h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.chip-breakdown h2 i {
    color: var(--accent-primary);
}

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

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

.chip-category {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.chip-category h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chip-category.nvidia h4 {
    color: var(--nvidia-primary);
}

.chip-category.google h4 {
    color: var(--google-primary);
}

.chip-category.other h4 {
    color: var(--accent-purple);
}

.chip-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chip-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chip-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 100px;
}

.chip-bar {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    position: relative;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.chip-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: calc(var(--width) * 2);
    border-radius: 4px;
    transition: width 1s ease;
}

.nvidia .chip-bar::after {
    background: linear-gradient(90deg, var(--nvidia-primary), var(--nvidia-secondary));
}

.google .chip-bar::after {
    background: linear-gradient(90deg, var(--google-primary), var(--google-secondary));
}

.other .chip-bar::after {
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
}

/* Footer */
.simulator-footer {
    text-align: center;
    padding: 3rem 0;
    border-top: 1px solid var(--glass-border);
    margin-top: 2rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.data-source p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.data-source a {
    color: var(--accent-primary);
    text-decoration: none;
}

.data-source a:hover {
    text-decoration: underline;
}

.disclaimer {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent-primary);
}

.copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .hero-section {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-visual {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .simulator-container {
        padding: 1rem;
    }

    .hero-section {
        padding: 2rem 0;
    }

    .control-panel,
    .insights-section,
    .chip-breakdown {
        padding: 1.5rem;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .scenario-buttons {
        width: 100%;
        overflow-x: auto;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .navbar {
        padding: 0.75rem 1rem;
    }

    .nav-brand span {
        display: none;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        padding: 1rem;
    }

    .controls-grid {
        gap: 1.5rem;
    }

    .floating-stat {
        padding: 0.75rem 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* Animations */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}