/* ======== DESIGN SYSTEM & VARIABLES ======== */
:root {
    /* Colors */
    --bg-main: #000000;
    --bg-secondary: #050a14;
    
    /* Neons & Accents */
    --accent-1: #D4AF37; /* Gold */
    --accent-2: #1E3A8A; /* Deep Blue */
    --accent-3: #FFD700; /* Bright Gold */
    --accent-4: #3B82F6; /* Light Blue */
    
    /* Dimmed backgrounds for icons/chips */
    --accent-1-dim: rgba(212, 175, 55, 0.15);
    --accent-2-dim: rgba(30, 58, 138, 0.15);
    --accent-3-dim: rgba(255, 215, 0, 0.15);
    --accent-4-dim: rgba(59, 130, 246, 0.15);

    /* Text */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.06);
    --shadow-soft: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    /* Status */
    --positive: #10B981;
    --neutral: #64748B;
    --negative: #EF4444;

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Metrics */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body.dark-theme {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(30, 58, 138, 0.2), transparent 45%),
        radial-gradient(circle at 85% 30%, rgba(212, 175, 55, 0.1), transparent 35%);
}

h1, h2, h3, h4, .kpi-value, .stat-value {
    font-family: var(--font-heading);
    font-weight: 600;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.container {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 5%;
}

.full-width-section {
    max-width: 100%;
    padding: 80px 2%;
}

.text-gradient {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Color Utils */
.text-accent-1 { color: var(--accent-1); }
.text-accent-2 { color: var(--accent-2); }
.text-accent-3 { color: var(--accent-3); }
.text-accent-4 { color: var(--accent-4); }
.bg-accent-1-dim { background-color: var(--accent-1-dim); }
.bg-accent-2-dim { background-color: var(--accent-2-dim); }
.bg-accent-3-dim { background-color: var(--accent-3-dim); }
.bg-accent-4-dim { background-color: var(--accent-4-dim); }

.positive { color: var(--positive); }
.neutral { color: var(--neutral); }
.negative { color: var(--negative); }

/* ======== UI COMPONENTS ======== */
/* Buttons */
.btn {
    display: inline-block;
    padding: 16px 32px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}
.btn span { position: relative; z-index: 2; pointer-events: none; }

.matrix {
    position: relative;
    overflow: hidden;
}
.matrix span {
    position: relative;
    z-index: 2;
    pointer-events: none;
}
.code-rain {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 255, 0, 0) 0%,
        rgba(0, 255, 0, 0.6) 50%,
        rgba(0, 255, 0, 0) 100%
    );
    opacity: 0;
    transition: 0.3s;
    pointer-events: none;
    z-index: 1;
}
.matrix:hover .code-rain {
    opacity: 1;
    animation: rain 1s linear infinite;
}
@keyframes rain {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-1), #FBBF24);
    color: #000;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}
.btn-secondary:hover {
    background: var(--glass-hover);
    border-color: var(--accent-2);
    transform: translateY(-2px);
}

/* Glass Cards */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-soft);
    padding: 24px;
    transition: var(--transition);
}
.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: var(--glass-hover);
}

/* Select & Inputs */
.custom-select, input[type="text"] {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    outline: none;
    font-family: var(--font-body);
    font-size: 0.95rem;
    width: 100%;
    transition: var(--transition);
}
.custom-select:focus, input[type="text"]:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.2);
}
.custom-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}


/* ======== NAVIGATION ======== */
.glass-nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    background: rgba(6, 11, 20, 0.7);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}
.nav-brand i { color: var(--accent-1); font-size: 1.5rem; }
.nav-links { display: flex; gap: 32px; }
.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}
.nav-links a:hover { color: var(--accent-1); }
.nav-cta {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}
.nav-cta:hover { background: var(--accent-1); color: #000; border-color: var(--accent-1); }


/* ======== HERO SECTION ======== */
.hero-section {
    position: relative;
    padding: 160px 5% 240px;
    margin-bottom: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, rgba(0,0,0,1) 100%), url('bg.png');
    background-size: cover;
    background-position: center 30%;
    animation: fadeInBg 3s ease-in-out;
}
@keyframes fadeInBg { from { opacity: 0; } to { opacity: 1; } }
.hero-bg-glow {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 40vh;
    background: radial-gradient(ellipse, rgba(212,175,55,0.15) 0%, rgba(30,58,138,0.1) 40%, transparent 70%);
    filter: blur(60px);
    z-index: 1;
}

/* ======== AMBIENT VFX & DECORATIONS ======== */
.cyber-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(30, 58, 138, 0.15) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
    animation: pulseBlue 5s infinite alternate ease-in-out;
}
@keyframes pulseBlue {
    0% { opacity: 0.2; transform: translate(-50%, -50%) scale(0.9); }
    100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.1); }
}

.decorative-img {
    position: absolute;
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
    animation: floatImg 8s infinite alternate ease-in-out;
}
@keyframes floatImg {
    0% { transform: translateY(0); }
    100% { transform: translateY(-20px); }
}

.dec-suitability { right: -5%; top: 10%; max-width: 450px; }
.dec-compare { left: -5%; bottom: -5%; max-width: 400px; }
.dec-report { right: auto; left: 50%; transform: translateX(-50%); top: 15%; max-width: 600px; opacity: 0.08; }

.hero-content {
    position: relative;
    z-index: 2;
}
.hero-mini-stats {
    position: relative;
    z-index: 2;
}
.tagline {
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-1);
    font-weight: 600;
    margin-bottom: 16px;
}
.hero-content h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -1px;
}
.hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 30px;
    line-height: 1.4;
}
.hero-actions { display: flex; gap: 16px; justify-content: center; }

.hero-mini-stats {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 20px;
    margin-top: 40px;
    flex-wrap: wrap;
    justify-content: center;
}
.mini-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-radius: 100px;
}
.mini-stat-card i { font-size: 1.5rem; }
.stat-info { text-align: left; display: flex; flex-direction: column; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1rem; color: var(--text-primary); }


/* ======== SECTION HEADERS ======== */
.section-header {
    margin-bottom: 30px;
}
.section-header h2 { font-size: 2rem; margin-bottom: 8px; }
.section-header p { color: var(--text-secondary); font-size: 1.05rem; }
.section-header.center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 30px;
    max-width: 600px;
}
.badge {
    background: var(--accent-2-dim);
    color: var(--accent-2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}


/* ======== KPI OVERVIEW ======== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}
.kpi-card { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.kpi-header { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.kpi-trend { font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.kpi-body .kpi-value { font-size: 2.5rem; line-height: 1; margin-bottom: 4px; }
.kpi-body .kpi-label { color: var(--text-secondary); font-size: 0.9rem; }
.kpi-footer { font-size: 0.8rem; color: var(--text-muted); padding-top: 16px; border-top: 1px solid var(--glass-border); }


/* ======== EXPLORER SECTION ======== */
.explorer-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    height: 500px;
    position: relative;
    z-index: 2;
    overflow: hidden;
}
.explorer-sidebar { 
    display: flex; 
    flex-direction: column; 
    padding: 20px; 
    height: 100%; 
    overflow: hidden; 
}
.sidebar-header { margin-bottom: 20px; }
.sidebar-header h3 { margin-bottom: 16px; font-size: 1.25rem; }
.search-box {
    position: relative;
    margin-bottom: 16px;
}
.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-box input { padding-left: 36px; }
.filter-group label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }

.neighborhood-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 8px;
}
/* Scrollbar */
.neighborhood-list::-webkit-scrollbar { width: 6px; }
.neighborhood-list::-webkit-scrollbar-track { background: transparent; }
.neighborhood-list::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

.list-item {
    background: rgba(0,0,0,0.2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
}
.list-item:hover, .list-item.active {
    background: var(--glass-hover);
    border-color: var(--accent-1);
}
.list-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.list-item-name { font-weight: 600; font-family: var(--font-heading); }
.score-badge {
    background: var(--accent-1-dim); color: var(--accent-1);
    font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 12px;
}
.list-item-stats { display: flex; gap: 12px; font-size: 0.8rem; color: var(--text-secondary); }

.explorer-main { position: relative; height: 100%; border-radius: var(--radius-lg); overflow: hidden; }
.map-container { width: 100%; height: 100%; border: none; z-index: 1; }

.neighborhood-detail {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    z-index: 10;
    background: rgba(10, 17, 32, 0.9) !important;
}
.neighborhood-detail.hidden { display: none; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 20px 0; }
.detail-stat { display: flex; flex-direction: column; }
.detail-stat-val { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 600; }
.detail-stat-lbl { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.detail-summary { font-size: 0.95rem; color: var(--text-secondary); border-top: 1px solid var(--glass-border); padding-top: 16px; }


/* ======== BUSINESS ENGINE ======== */
.engine-layout { display: grid; grid-template-columns: 350px 1fr; gap: 24px; }
.engine-controls h3 { margin-bottom: 20px; font-size: 1.25rem; }
.business-type-grid { display: flex; flex-direction: column; gap: 12px; }
.type-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
}
.type-btn i { font-size: 1.25rem; flex-shrink: 0; }
.type-btn:hover { background: var(--glass-hover); color: var(--text-primary); }
.type-btn.active {
    background: var(--accent-3-dim);
    border-color: var(--accent-3);
    color: var(--accent-3);
}

.engine-results { display: flex; flex-direction: column; gap: 20px; }
.result-card {
    display: flex;
    gap: 24px;
    padding: 24px;
}
.rank-badge {
    width: 60px; height: 60px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-3);
    flex-shrink: 0;
}
.result-content { flex: 1; }
.result-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.result-header h4 { font-size: 1.5rem; color: var(--text-primary); }
.match-score { font-weight: 600; color: var(--accent-3); }
.result-desc { color: var(--text-secondary); margin-bottom: 16px; font-size: 0.95rem; }
.result-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
    background: rgba(255,255,255,0.05);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* ======== COMPARE SECTION ======== */
.compare-controls { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; padding: 16px 24px; }
.vs-badge { font-weight: 700; font-family: var(--font-heading); color: var(--text-muted); width: 40px; text-align: center; }
.compare-dashboard { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; position: relative; z-index: 2; }
.compare-chart { height: 350px; display: flex; align-items: center; justify-content: center; padding: 24px; }
.compare-chart canvas { max-height: 100%; width: auto; }
.compare-insights { padding: 32px; display: flex; flex-direction: column; gap: 24px; }

.insight-block h4 { color: var(--accent-1); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.insight-block p { color: var(--text-secondary); font-size: 0.95rem; }
.ai-recommendation {
    background: rgba(139, 92, 246, 0.1);
    border-left: 4px solid var(--accent-2);
    padding: 16px 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.ai-recommendation p { color: var(--text-primary); font-style: italic; }


/* ======== CHARTS GRID ======== */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.chart-wrapper { padding: 24px; min-height: 400px; display: flex; flex-direction: column; }
.chart-wrapper h3 { margin-bottom: 20px; font-size: 1.25rem; }
.chart-wrapper canvas { flex: 1; max-height: 300px; }
.chart-caption { margin-top: 16px; font-size: 0.85rem; color: var(--text-muted); text-align: center; }

/* ======== NARRATIVE TEXT ======== */
.narrative-content { padding: 48px; }
.prose { max-width: 800px; margin: 0 auto; }
.prose p { margin-bottom: 24px; font-size: 1.1rem; color: var(--text-secondary); }
.prose strong { color: var(--text-primary); }
.prose h3 { margin: 40px 0 20px; font-size: 1.5rem; color: var(--text-primary); }
.method-list { list-style: none; display: flex; flex-direction: column; gap: 16px; }

#report { padding-bottom: 20px; }
.footer .container { padding-top: 10px; padding-bottom: 30px; margin-top: 0; }

.method-list li {
    background: rgba(0,0,0,0.2);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-4);
    color: var(--text-secondary);
}
.method-list strong { color: var(--text-primary); margin-right: 8px; }


.method-list li {
    background: rgba(0,0,0,0.2);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-4);
    color: var(--text-secondary);
}
.method-list strong { color: var(--text-primary); margin-right: 8px; }

/* ======== LEAFLET OVERRIDES ======== */
.leaflet-container { background: #0a1120 !important; font-family: var(--font-body); }
.leaflet-popup-content-wrapper { background: var(--bg-main); color: var(--text-primary); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); }
.leaflet-popup-tip { background: var(--bg-main); border: 1px solid var(--glass-border); border-top: none; border-left: none; }
.leaflet-control-zoom a { background: var(--bg-main) !important; color: var(--text-primary) !important; border-color: var(--glass-border) !important; }

/* ======== RESPONSIVE ======== */
@media (max-width: 1024px) {
    .explorer-layout { grid-template-columns: 300px 1fr; }
    .compare-dashboard { grid-template-columns: 1fr; }
    .engine-layout { grid-template-columns: 300px 1fr; }
    .hero-content h1 { font-size: 3rem; }
}
@media (max-width: 768px) {
    .nav-links { display: none; }
    .explorer-layout { grid-template-columns: 1fr; height: auto; display: flex; flex-direction: column; }
    .explorer-sidebar { max-height: 400px; }
    .map-container { height: 400px; }
    .engine-layout { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .compare-controls { flex-direction: column; }
    .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* ======== PRINT MEDIA ======== */
@media print {
    body * { visibility: hidden; }
    #pdfTemplate, #pdfTemplate * { visibility: visible; }
    #pdfTemplate { position: absolute; left: 0; top: 0; width: 100%; background: white !important; color: black !important; padding: 20px !important; }
}
