/* ========================================
   SMART TRAFFIC LIGHT OPTIMIZER
   Global Stylesheet
   ======================================== */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    /* Traffic Light Colors */
    --red: #ff3b3b;
    --red-glow: rgba(255, 59, 59, 0.4);
    --yellow: #ffbe0b;
    --yellow-glow: rgba(255, 190, 11, 0.4);
    --green: #00e676;
    --green-glow: rgba(0, 230, 118, 0.4);

    /* Neon Accents */
    --neon-green: #39ff14;
    --neon-cyan: #00f0ff;
    --neon-purple: #bf5af2;

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

    /* Spacing */
    --nav-height: 72px;
    --section-padding: 100px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

/* Dark Theme (Default) */
[data-theme="dark"] {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: rgba(20, 20, 30, 0.8);
    --bg-card-hover: rgba(30, 30, 45, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #55556a;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(0, 230, 118, 0.1);
    --road-color: #1a1a2e;
    --road-line: #333350;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f5f5fa;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-glass: rgba(0, 0, 0, 0.02);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --text-primary: #1a1a2e;
    --text-secondary: #5a5a7a;
    --text-muted: #9999aa;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 40px rgba(0, 230, 118, 0.08);
    --road-color: #d0d0e0;
    --road-line: #b0b0c0;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-slow), color var(--transition-slow);
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Loading Screen --- */
.loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
}

.traffic-light-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    background: #1a1a2e;
    padding: 20px 16px;
    border-radius: 16px;
    border: 2px solid var(--border-color);
}

.loader-light {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    opacity: 0.2;
    transition: all 0.4s ease;
}

.loader-light.red { background: var(--red); }
.loader-light.yellow { background: var(--yellow); }
.loader-light.green { background: var(--green); }

.loader-light.active {
    opacity: 1;
}
.loader-light.red.active { box-shadow: 0 0 20px var(--red-glow), 0 0 40px var(--red-glow); }
.loader-light.yellow.active { box-shadow: 0 0 20px var(--yellow-glow), 0 0 40px var(--yellow-glow); }
.loader-light.green.active { box-shadow: 0 0 20px var(--green-glow), 0 0 40px var(--green-glow); }

.loader-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    font-family: var(--font-mono);
}

.loader-bar {
    width: 200px;
    height: 3px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.loader-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--neon-cyan));
    border-radius: 3px;
    animation: loaderFill 2s ease forwards;
}

@keyframes loaderFill {
    to { width: 100%; }
}

/* --- Navigation --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 1000;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

[data-theme="light"] .navbar {
    background: rgba(245, 245, 250, 0.85);
}

.navbar.scrolled {
    background: rgba(10, 10, 15, 0.95);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 20px;
}

.logo-icon {
    font-size: 28px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.logo-text {
    background: linear-gradient(135deg, var(--green), var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.nav-link.active {
    color: var(--green);
    background: rgba(0, 230, 118, 0.08);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: rotate(30deg);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}
.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: calc(var(--nav-height) + 40px) 24px 60px;
    overflow: hidden;
}

.hero-bg-effects {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

[data-theme="light"] .grid-overlay {
    background-image:
        linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--green);
    top: 10%;
    left: 10%;
    animation: orbFloat1 8s ease-in-out infinite;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--neon-cyan);
    top: 60%;
    right: 10%;
    animation: orbFloat2 10s ease-in-out infinite;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: var(--neon-purple);
    bottom: 10%;
    left: 30%;
    animation: orbFloat3 12s ease-in-out infinite;
}

[data-theme="light"] .glow-orb { opacity: 0.12; }

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -20px); }
    66% { transform: translate(-20px, 30px); }
}
@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-40px, -30px); }
}
@keyframes orbFloat3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -40px); }
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 2;
    max-width: 800px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.2);
    border-radius: 50px;
    font-size: 13px;
    color: var(--green);
    font-weight: 500;
    margin-bottom: 28px;
    animation: fadeInDown 0.8s ease 0.3s both;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
    font-size: clamp(40px, 7vw, 72px);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.title-line {
    display: block;
    animation: fadeInUp 0.8s ease both;
}

.title-line:nth-child(1) { animation-delay: 0.5s; }
.title-line:nth-child(2) { animation-delay: 0.7s; }
.title-line:nth-child(3) { animation-delay: 0.9s; }

.gradient-text {
    background: linear-gradient(135deg, var(--green) 0%, var(--neon-cyan) 50%, var(--neon-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.emoji-glow {
    -webkit-text-fill-color: initial;
    filter: drop-shadow(0 0 8px var(--green-glow));
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 36px;
    line-height: 1.7;
    animation: fadeInUp 0.8s ease 1.1s both;
}

.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 48px;
    animation: fadeInUp 0.8s ease 1.3s both;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-main);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--green), #00c853);
    color: #000;
    box-shadow: 0 4px 20px rgba(0, 230, 118, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 230, 118, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.btn-ai {
    background: linear-gradient(135deg, var(--neon-purple), #7c3aed);
    color: #fff;
    border: none;
    box-shadow: 0 4px 20px rgba(191, 90, 242, 0.3);
}

.btn-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(191, 90, 242, 0.4);
}

.btn-ai.active {
    background: linear-gradient(135deg, var(--green), #00c853);
    color: #000;
    box-shadow: 0 4px 20px rgba(0, 230, 118, 0.3);
}

.btn-lg {
    padding: 18px 36px;
    font-size: 17px;
}

/* Hero Stats */
.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    animation: fadeInUp 0.8s ease 1.5s both;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--green);
    font-family: var(--font-mono);
}

.stat-suffix {
    font-size: 24px;
    font-weight: 700;
    color: var(--green);
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border-color);
}

/* Hero Visual – Mini Intersection */
.hero-visual {
    display: none; /* shown on desktop via media query */
}

.intersection-preview {
    position: relative;
    width: 280px;
    height: 280px;
}

.mini-road {
    position: absolute;
    background: var(--road-color);
    border-radius: 4px;
}

.mini-road.road-h {
    width: 100%;
    height: 60px;
    top: 50%;
    transform: translateY(-50%);
}

.mini-road.road-v {
    width: 60px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.mini-light {
    position: absolute;
    display: flex;
    gap: 4px;
    padding: 4px 6px;
    background: #111;
    border-radius: 6px;
    z-index: 3;
}

.ml {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0.2;
    transition: all 0.5s ease;
}

.ml.red { background: var(--red); }
.ml.green { background: var(--green); }
.ml.active { opacity: 1; }
.ml.red.active { box-shadow: 0 0 8px var(--red-glow); }
.ml.green.active { box-shadow: 0 0 8px var(--green-glow); }

.mini-light-top { top: calc(50% - 46px); left: calc(50% + 6px); }
.mini-light-right { top: calc(50% + 6px); right: calc(50% - 52px); flex-direction: column; }
.mini-light-bottom { bottom: calc(50% - 46px); right: calc(50% + 6px); }
.mini-light-left { bottom: calc(50% + 6px); left: calc(50% - 52px); flex-direction: column; }

.mini-car {
    position: absolute;
    width: 20px;
    height: 12px;
    background: var(--neon-cyan);
    border-radius: 3px;
    z-index: 2;
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.4);
}

.car-1 { top: calc(50% - 14px); left: 10%; animation: carMoveRight 4s linear infinite; }
.car-2 { bottom: calc(50% - 14px); right: 10%; animation: carMoveLeft 5s linear infinite; }
.car-3 {
    top: 10%;
    left: calc(50% - 6px);
    width: 12px;
    height: 20px;
    animation: carMoveDown 4.5s linear infinite;
}
.car-4 {
    bottom: 10%;
    right: calc(50% - 6px);
    width: 12px;
    height: 20px;
    animation: carMoveUp 5.5s linear infinite;
}

@keyframes carMoveRight {
    0% { left: -20px; }
    100% { left: 100%; }
}
@keyframes carMoveLeft {
    0% { right: -20px; }
    100% { right: 100%; }
}
@keyframes carMoveDown {
    0% { top: -20px; }
    100% { top: 100%; }
}
@keyframes carMoveUp {
    0% { bottom: -20px; }
    100% { bottom: 100%; }
}

/* --- Sections --- */
.section {
    padding: var(--section-padding) 0;
    position: relative;
}

.section-header {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 60px;
}

.section-tag {
    display: inline-block;
    padding: 4px 14px;
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.15);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    color: var(--green);
    margin-bottom: 16px;
    font-family: var(--font-mono);
}

.section-title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }

.section-desc {
    font-size: 17px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* --- Problem Section --- */
.problem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.problem-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.problem-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--red), var(--yellow));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.problem-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-card);
}

.problem-card:hover::before {
    opacity: 1;
}

.problem-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.problem-card h3 {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 10px;
}

.problem-card p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.problem-stat {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 22px;
    color: var(--red);
}

/* --- Solution Section --- */
.solution-section {
    background: var(--bg-secondary);
}

.solution-flow {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.flow-step {
    text-align: center;
    padding: 28px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    flex: 1;
    min-width: 200px;
    max-width: 240px;
    transition: all var(--transition-base);
    position: relative;
}

.flow-step:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 230, 118, 0.3);
    box-shadow: 0 8px 30px rgba(0, 230, 118, 0.08);
}

.flow-number {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 12px;
    opacity: 0.7;
}

.flow-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.flow-step h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.flow-step p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.flow-arrow {
    font-size: 24px;
    color: var(--text-muted);
    padding-top: 60px;
    flex-shrink: 0;
}

/* --- Features Section --- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-card);
}

.feature-highlight {
    grid-column: span 1;
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.06), rgba(0, 240, 255, 0.04));
    border-color: rgba(0, 230, 118, 0.15);
}

.feature-glow {
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--green-glow) 0%, transparent 70%);
    opacity: 0.3;
    pointer-events: none;
}

.feature-icon-wrap {
    margin-bottom: 20px;
}

.feature-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.feature-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--green);
    transition: all var(--transition-fast);
}

.feature-link:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* --- CTA Section --- */
.cta-section {
    padding: 60px 0 100px;
}

.cta-card {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.06), rgba(0, 240, 255, 0.04));
    border: 1px solid rgba(0, 230, 118, 0.15);
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
}

.cta-glow {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 230, 118, 0.15), transparent 70%);
    pointer-events: none;
}

.cta-card h2 {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 800;
    margin-bottom: 12px;
    position: relative;
}

.cta-card p {
    color: var(--text-secondary);
    font-size: 17px;
    margin-bottom: 28px;
    position: relative;
}

/* --- Footer --- */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 48px 0 24px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 32px;
    margin-bottom: 32px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-brand .logo-icon { font-size: 24px; }
.footer-brand .logo-text { font-size: 18px; font-weight: 700; }

.footer-desc {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 280px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

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

.footer-info {
    text-align: right;
}

.team-name, .hackathon-name {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-bottom p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ========================================
   SIMULATION PAGE STYLES
   ======================================== */

.sim-page {
    padding-top: calc(var(--nav-height) + 24px);
    min-height: 100vh;
}

.sim-header {
    text-align: center;
    padding: 24px;
    margin-bottom: 24px;
}

.sim-header h1 {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 800;
    margin-bottom: 8px;
}

.sim-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.sim-layout {
    display: flex;
    gap: 24px;
    padding: 0 24px 48px;
    max-width: 1400px;
    margin: 0 auto;
}

.sim-controls {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.control-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-sim {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    font-size: 16px;
}

.mode-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.mode-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 8px var(--yellow-glow);
    transition: all var(--transition-base);
}

.mode-dot.ai-active {
    background: var(--neon-purple);
    box-shadow: 0 0 8px rgba(191, 90, 242, 0.5);
}

.mode-dot.running {
    background: var(--green);
    box-shadow: 0 0 8px var(--green-glow);
    animation: pulse-dot 1.5s ease infinite;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.metric {
    padding: 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
}

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

.metric-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--green);
}

.lane-status-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lane-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.lane-status.active {
    border-color: rgba(0, 230, 118, 0.3);
    background: rgba(0, 230, 118, 0.05);
}

.lane-light-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: all var(--transition-base);
}

.lane-light-indicator.red {
    background: var(--red);
    box-shadow: 0 0 6px var(--red-glow);
}

.lane-light-indicator.green {
    background: var(--green);
    box-shadow: 0 0 6px var(--green-glow);
}

.lane-name {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.lane-count {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.setting-row label {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 110px;
}

.setting-row span {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--green);
    min-width: 24px;
    text-align: right;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--green);
    cursor: pointer;
    box-shadow: 0 0 6px var(--green-glow);
    transition: all var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px var(--green-glow);
}

/* --- AI Safety & Quiz Toast --- */
.ai-toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 320px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: none;
}

.ai-toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--neon-purple);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-card);
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    font-family: var(--font-main);
}

.ai-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.ai-toast-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.ai-toast-icon {
    font-size: 18px;
}

.ai-toast-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.ai-toast-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.ai-toast-actions {
    display: flex;
    gap: 8px;
}

.ai-toast-btn {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-toast-btn:hover {
    background: rgba(191, 90, 242, 0.15);
    border-color: var(--neon-purple);
    color: var(--neon-purple);
}

.toast-success { color: var(--green) !important; border-color: var(--green) !important; background: rgba(0, 230, 118, 0.1) !important; }
.toast-error { color: var(--red) !important; border-color: var(--red) !important; background: rgba(255, 59, 59, 0.1) !important; }

/* Simulation Canvas */
.sim-canvas-wrap {
    flex: 1;
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 500px;
}

#simCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.canvas-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(4px);
    transition: all var(--transition-base);
}

.canvas-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
}

.overlay-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

.overlay-content p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* ========================================
   ANALYTICS PAGE STYLES
   ======================================== */

.analytics-page {
    padding-top: var(--nav-height);
}

.explanation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.explain-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    transition: all var(--transition-base);
}

.explain-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
}

.explain-step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid rgba(0, 230, 118, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 16px;
    color: var(--green);
    margin: 0 auto 20px;
}

.explain-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

.explain-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.explain-visual {
    display: flex;
    justify-content: center;
    min-height: 60px;
}

/* Sensor animation */
.sensor-animation {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
}

.sensor-beam {
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--neon-cyan), transparent);
    border-radius: 4px;
    animation: sensorScan 2s ease-in-out infinite;
}

@keyframes sensorScan {
    0%, 100% { opacity: 0.3; width: 20px; }
    50% { opacity: 1; width: 60px; }
}

.sensor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-cyan);
    animation: sensorBlink 2s ease infinite;
}

.sensor-dot:nth-child(2) { animation-delay: 0.3s; }
.sensor-dot:nth-child(3) { animation-delay: 0.6s; }

@keyframes sensorBlink {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

/* AI Brain animation */
.ai-brain {
    position: relative;
    font-size: 40px;
}

.brain-pulse {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2px solid var(--neon-purple);
    animation: brainPulse 2s ease infinite;
}

@keyframes brainPulse {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Signal demo */
.signal-demo {
    display: flex;
    gap: 8px;
}

.sig-light {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.5s ease;
}

.sig-light.active-green {
    background: var(--green);
    box-shadow: 0 0 12px var(--green-glow);
    animation: signalPulse 2s ease infinite;
}

@keyframes signalPulse {
    0%, 100% { box-shadow: 0 0 12px var(--green-glow); }
    50% { box-shadow: 0 0 24px var(--green-glow), 0 0 48px var(--green-glow); }
}

/* AI Logic Section */
.ai-logic-section {
    background: var(--bg-secondary);
}

.logic-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.logic-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
}

.logic-block h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.logic-block p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.code-block {
    background: #0d0d1a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
}

[data-theme="light"] .code-block {
    background: #f0f0f5;
}

.code-block code {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--green);
}

[data-theme="light"] .code-block code {
    color: #1a6640;
}

.comparison-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.comparison-header {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.comparison-header.fixed {
    background: rgba(255, 59, 59, 0.1);
    color: var(--red);
}

.comparison-header.ai {
    background: rgba(0, 230, 118, 0.1);
    color: var(--green);
}

.comparison-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comp-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comp-bar span:first-child {
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    min-width: 80px;
}

.bar-fill {
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #000;
    font-family: var(--font-mono);
    transition: width 1.5s ease;
    min-width: 30px;
}

.comp-note {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Charts Section */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.chart-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
}

.chart-card-wide {
    grid-column: span 2;
}

.improvement-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.improve-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    transition: all var(--transition-base);
}

.improve-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(0, 230, 118, 0.2);
}

.improve-value {
    font-size: 36px;
    font-weight: 800;
    font-family: var(--font-mono);
    margin-bottom: 8px;
}

.improve-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Future Section */
.future-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.future-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all var(--transition-base);
    position: relative;
}

.future-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
    border-color: var(--border-hover);
}

.future-icon {
    font-size: 36px;
    margin-bottom: 16px;
}

.future-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.future-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.future-tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.15);
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
    color: var(--green);
    font-family: var(--font-mono);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Scroll animations */
.problem-card,
.flow-step,
.feature-card,
.explain-card,
.future-card,
.improve-card,
.chart-card,
.comparison-item,
.logic-block {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.problem-card.visible,
.flow-step.visible,
.feature-card.visible,
.explain-card.visible,
.future-card.visible,
.improve-card.visible,
.chart-card.visible,
.comparison-item.visible,
.logic-block.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays */
.problem-card:nth-child(1), .feature-card:nth-child(1), .future-card:nth-child(1) { transition-delay: 0s; }
.problem-card:nth-child(2), .feature-card:nth-child(2), .future-card:nth-child(2) { transition-delay: 0.1s; }
.problem-card:nth-child(3), .feature-card:nth-child(3), .future-card:nth-child(3) { transition-delay: 0.2s; }
.problem-card:nth-child(4), .feature-card:nth-child(4), .future-card:nth-child(4) { transition-delay: 0.3s; }
.feature-card:nth-child(5), .future-card:nth-child(5) { transition-delay: 0.4s; }
.feature-card:nth-child(6), .future-card:nth-child(6) { transition-delay: 0.5s; }

.flow-step:nth-child(1) { transition-delay: 0s; }
.flow-step:nth-child(3) { transition-delay: 0.15s; }
.flow-step:nth-child(5) { transition-delay: 0.3s; }
.flow-step:nth-child(7) { transition-delay: 0.45s; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (min-width: 1024px) {
    .hero {
        flex-direction: row;
        text-align: left;
        gap: 60px;
        padding-left: 60px;
        padding-right: 60px;
    }

    .hero-content {
        text-align: left;
    }

    .hero-cta {
        justify-content: flex-start;
    }

    .hero-stats {
        justify-content: flex-start;
    }

    .hero-visual {
        display: block;
        flex-shrink: 0;
    }

    .hero-subtitle {
        margin-left: 0;
    }
}

@media (max-width: 1023px) {
    .sim-layout {
        flex-direction: column;
    }

    .sim-controls {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sim-controls .control-card {
        flex: 1;
        min-width: 280px;
    }

    .sim-canvas-wrap {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    :root {
        --section-padding: 60px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 16px;
    }

    .nav-links.open {
        display: flex;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .hero-title {
        font-size: clamp(32px, 8vw, 48px);
    }

    .hero-stats {
        flex-direction: column;
        gap: 16px;
    }

    .stat-divider {
        width: 40px;
        height: 1px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .feature-highlight {
        grid-column: span 1;
    }

    .explanation-grid {
        grid-template-columns: 1fr;
    }

    .logic-layout {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-card-wide {
        grid-column: span 1;
    }

    .improvement-cards {
        grid-template-columns: 1fr 1fr;
    }

    .future-grid {
        grid-template-columns: 1fr;
    }

    .flow-arrow {
        display: none;
    }

    .solution-flow {
        flex-direction: column;
        align-items: center;
    }

    .flow-step {
        max-width: 100%;
    }

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

    .footer-info {
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }

    .sim-controls {
        flex-direction: column;
    }

    .sim-controls .control-card {
        min-width: 100%;
    }
}

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

    .problem-grid {
        grid-template-columns: 1fr;
    }

    .hero-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        justify-content: center;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   SCROLLBAR
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: rgba(0, 230, 118, 0.3);
    color: var(--text-primary);
}
