/* ============================================
   CANADA WILDFIRE INTELLIGENCE PLATFORM
   Main Styles — Variables, Reset, Layout
   ============================================ */

:root {
    /* Color Palette — Fire Theme */
    --fire-100: #fff3e0;
    --fire-200: #ffe0b2;
    --fire-300: #ffcc80;
    --fire-400: #ffa726;
    --fire-500: #ff9100;
    --fire-600: #ff6d00;
    --fire-700: #e65100;
    --fire-800: #bf360c;
    --fire-900: #8B0000;

    /* Status Colors */
    --status-oc: #ff1744;
    --status-bh: #ff9100;
    --status-uc: #ffea00;
    --status-ex: #69f0ae;

    /* UI Colors */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2332;
    --bg-card: #1e293b;
    --bg-hover: #253247;
    --bg-glass: rgba(17, 24, 39, 0.85);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #ff9100;

    --border-color: rgba(255, 145, 0, 0.15);
    --border-subtle: rgba(148, 163, 184, 0.1);

    --accent: #ff9100;
    --accent-glow: rgba(255, 145, 0, 0.3);
    --danger: #ff1744;
    --warning: #ff9100;
    --success: #69f0ae;
    --info: #40c4ff;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(255, 145, 0, 0.15);

    /* Layout */
    --topbar-height: 56px;
    --sidebar-width: 320px;
    --sidebar-collapsed: 0px;
    --panel-width: 380px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Loading Screen
   ============================================ */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
    max-width: 400px;
}

.fire-icon-loader {
    font-size: 64px;
    color: var(--fire-500);
    margin-bottom: 24px;
    animation: fireGlow 1.5s ease-in-out infinite alternate;
}

.loader-content h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--fire-400), var(--fire-600));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.loader-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--fire-600), var(--fire-400));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.loader-status {
    color: var(--text-muted);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   Top Navigation Bar
   ============================================ */
#topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
}

.topbar-left {
    display: flex;
    align-items: center;
    min-width: 280px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 28px;
    color: var(--fire-500);
    filter: drop-shadow(0 0 8px rgba(255, 145, 0, 0.5));
}

.brand-text h1 {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.2;
    color: var(--text-primary);
}

.brand-accent {
    color: var(--fire-500);
}

.brand-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 24px;
}

.alert-ticker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(255, 23, 68, 0.1);
    border: 1px solid rgba(255, 23, 68, 0.2);
    border-radius: var(--radius-xl);
    font-size: 12px;
    color: var(--danger);
    max-width: 500px;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-icon {
    animation: pulse 2s ease-in-out infinite;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 12px;
}

.stat-badge i {
    color: var(--fire-500);
    font-size: 14px;
}

.stat-badge.warning i {
    color: var(--warning);
}

.stat-badge.danger i {
    color: var(--danger);
}

.badge-content {
    display: flex;
    flex-direction: column;
}

.badge-value {
    font-weight: 700;
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.1;
}

.badge-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.topbar-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    font-size: 14px;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================
   App Layout
   ============================================ */
#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#map-container {
    position: fixed;
    top: var(--topbar-height);
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    transition: left var(--transition-normal);
}

#map-container.sidebar-closed {
    left: 0;
}

#map {
    width: 100%;
    height: 100%;
}

/* Map Tools */
.map-tools {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 6px;
    z-index: 10;
}

.map-tool-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    font-size: 15px;
}

.map-tool-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.map-tool-btn.active {
    background: var(--accent);
    color: #000;
}

.tool-separator {
    height: 1px;
    background: var(--border-subtle);
    margin: 2px 4px;
}

/* Basemap Switcher */
.basemap-switcher {
    position: absolute;
    bottom: 40px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.basemap-option {
    width: 64px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.basemap-option span {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.basemap-preview {
    width: 64px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    transition: var(--transition-fast);
    overflow: hidden;
}

.basemap-option.active .basemap-preview {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.basemap-option:hover .basemap-preview {
    border-color: var(--text-muted);
}

.dark-preview {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}
.satellite-preview {
    background: linear-gradient(135deg, #2d5016, #1a3a0a);
}
.terrain-preview {
    background: linear-gradient(135deg, #5d8a68, #8fbc8f);
}
.light-preview {
    background: linear-gradient(135deg, #e8e8e8, #f5f5f5);
}

/* Coordinates Display */
.coord-display {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    z-index: 10;
}

.coord-sep {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--fire-600), var(--fire-500));
    color: #000;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--fire-500), var(--fire-400));
    box-shadow: var(--shadow-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-lg {
    max-width: 640px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: 60vh;
}

.about-content h4 {
    margin-top: 16px;
    margin-bottom: 8px;
    color: var(--fire-400);
    font-size: 14px;
}

.about-content p, .about-content li {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.about-content ul {
    padding-left: 20px;
}

.about-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 1200px) {
    .topbar-center {
        display: none;
    }
    .stat-badge .badge-label {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }
    .stat-badge {
        display: none;
    }
    .basemap-switcher {
        bottom: 80px;
    }
}
