/* =============================================================================
   AI BACKTESTER — SHOWCASE SITE STYLES
   Premium dark theme with glassmorphism, gradients, and micro-animations
   ============================================================================= */

/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Core palette */
    --bg-primary: #0a0e17;
    --bg-secondary: #0f1420;
    --bg-tertiary: #141a2a;
    --bg-card: rgba(20, 26, 42, 0.7);
    --bg-glass: rgba(20, 26, 42, 0.5);

    /* Text */
    --text-primary: #e8edf5;
    --text-secondary: #8892a6;
    --text-muted: #5a6375;

    /* Accents */
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --accent-pink: #ec4899;

    /* Gradients */
    --gradient-hero: linear-gradient(135deg, #3b82f6, #8b5cf6, #06b6d4);
    --gradient-card: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(139,92,246,0.05));
    --gradient-border: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(139,92,246,0.1));

    /* Borders */
    --border-subtle: rgba(255,255,255,0.06);
    --border-hover: rgba(59,130,246,0.3);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px rgba(59,130,246,0.15);

    /* Sizing */
    --container-max: 1200px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* === CONTAINER === */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* === NAVBAR === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    transition: all 0.3s ease;
    background: transparent;
}

.navbar.scrolled {
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 0;
}

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

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 18px;
}

.logo-icon {
    font-size: 24px;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-blue);
    transition: width 0.3s;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-cta {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-cta:hover {
    border-color: var(--border-hover);
    background: rgba(59,130,246,0.1);
}

.nav-cta::after {
    display: none;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s;
}

/* === HERO === */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 24px 80px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(59,130,246,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,130,246,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 70%);
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: orbFloat 8s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59,130,246,0.3), transparent);
    top: -10%;
    right: -5%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139,92,246,0.25), transparent);
    bottom: 10%;
    left: -5%;
    animation-delay: -3s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(6,182,212,0.2), transparent);
    top: 40%;
    left: 30%;
    animation-delay: -5s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -30px) scale(1.05); }
    66% { transform: translate(-15px, 20px) scale(0.95); }
}

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

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-blue);
    margin-bottom: 24px;
    animation: fadeInUp 0.6s ease forwards;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.hero-title {
    font-size: clamp(36px, 6vw, 72px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 24px;
    animation: fadeInUp 0.6s ease 0.1s forwards;
    opacity: 0;
}

.gradient-text {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 18px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    animation: fadeInUp 0.6s ease 0.2s forwards;
    opacity: 0;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeInUp 0.6s ease 0.3s forwards;
    opacity: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--gradient-hero);
    color: white;
    box-shadow: 0 4px 20px rgba(59,130,246,0.3);
}

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

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

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: rgba(59,130,246,0.05);
}

.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin-top: 64px;
    animation: fadeInUp 0.6s ease 0.4s forwards;
    opacity: 0;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 36px;
    font-weight: 800;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

/* === SECTIONS === */
.section {
    padding: 100px 0;
    position: relative;
}

.section-alt {
    background: var(--bg-secondary);
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-tag {
    display: inline-block;
    padding: 4px 14px;
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.15);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.section-desc {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* === ARCHITECTURE === */
.arch-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.arch-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

.arch-node {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.arch-node:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.arch-icon {
    font-size: 32px;
    margin-bottom: 16px;
}

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

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

.arch-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.arch-tags span {
    padding: 3px 10px;
    background: rgba(59,130,246,0.1);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-cyan);
}

.arch-connectors {
    display: flex;
    justify-content: space-around;
    width: 100%;
    padding: 0 60px;
}

.connector-line {
    width: 2px;
    height: 40px;
    background: linear-gradient(to bottom, var(--accent-blue), rgba(59,130,246,0.1));
    position: relative;
}

.connector-line::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-blue);
}

.arch-db {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    text-align: center;
    transition: all 0.3s ease;
}

.arch-db:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.db-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: rgba(65,105,225,0.1);
    border-radius: 50%;
    margin-bottom: 12px;
    color: #4169E1;
}

.arch-db h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

.db-tables {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.db-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 20px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    min-width: 200px;
}

.db-table.highlight {
    border-color: rgba(6,182,212,0.3);
    background: rgba(6,182,212,0.05);
}

.table-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-cyan);
}

.table-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(6,182,212,0.15);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: fit-content;
}

.table-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* === MODULES === */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.module-card.featured {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, rgba(239,68,68,0.05), var(--bg-card));
}

.module-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 3px 10px;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-red);
    text-transform: uppercase;
}

.module-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.module-icon {
    font-size: 20px;
}

.module-path {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

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

.module-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.module-card code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: rgba(59,130,246,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-cyan);
}

/* === API EXPLORER === */
.api-explorer-container {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.api-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
}

.api-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}

.api-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.02);
}

.api-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-blue);
    background: rgba(59,130,246,0.05);
}

.method {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.method.get {
    background: rgba(16,185,129,0.15);
    color: var(--accent-green);
}

.method.post {
    background: rgba(59,130,246,0.15);
    color: var(--accent-blue);
}

.api-panel {
    display: none;
    padding: 24px;
}

.api-panel.active {
    display: block;
}

.api-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.code-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.method-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
}

.method-badge.get {
    background: rgba(16,185,129,0.1);
    color: var(--accent-green);
}

.method-badge.post {
    background: rgba(59,130,246,0.1);
    color: var(--accent-blue);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.success {
    background: rgba(16,185,129,0.1);
    color: var(--accent-green);
}

.code-block {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-primary);
}

.code-block code {
    font-family: inherit;
}

/* === TECH STACK === */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.tech-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 28px;
    text-align: center;
    transition: all 0.3s ease;
}

.tech-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.tech-logo {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.tech-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
}

.tech-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* === CONSTRAINTS === */
.constraints-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}

.constraint-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 28px;
    transition: all 0.3s ease;
    position: relative;
}

.constraint-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
}

.constraint-card.critical {
    border-color: rgba(239,68,68,0.3);
    background: linear-gradient(135deg, rgba(239,68,68,0.03), var(--bg-card));
}

.constraint-number {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.08));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 12px;
}

.constraint-card.critical .constraint-number {
    background: linear-gradient(135deg, rgba(239,68,68,0.25), rgba(239,68,68,0.08));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.constraint-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
}

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

.constraint-code {
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 10px 14px;
    overflow-x: auto;
}

.constraint-code code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--accent-cyan);
}

/* === CHART === */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    overflow: hidden;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.chart-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.chart-ticker {
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chart-range {
    font-size: 14px;
    color: var(--text-muted);
}

.chart-metrics {
    display: flex;
    gap: 24px;
}

.chart-metric {
    text-align: right;
}

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

.metric-value {
    font-size: 18px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.chart-metric.positive .metric-value {
    color: var(--accent-green);
}

.chart-metric.negative .metric-value {
    color: var(--accent-red);
}

#equityChart {
    width: 100%;
    height: 300px;
}

/* === FOOTER === */
.footer {
    padding: 60px 0 40px;
    border-top: 1px solid var(--border-subtle);
}

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

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 700;
}

.footer-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.footer-links {
    display: flex;
    gap: 32px;
    justify-content: center;
    margin-bottom: 24px;
}

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

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

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

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .arch-row {
        grid-template-columns: 1fr;
    }

    .arch-connectors {
        flex-direction: column;
        align-items: center;
        padding: 0;
    }

    .connector-line {
        height: 24px;
    }

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

    .api-split {
        grid-template-columns: 1fr;
    }

    .tech-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-stats {
        gap: 20px;
    }

    .chart-header {
        flex-direction: column;
    }

    .chart-metrics {
        flex-wrap: wrap;
        gap: 16px;
    }

    .chart-metric {
        text-align: left;
    }

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

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

    .hero-stats {
        flex-direction: column;
    }

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