:root {
    /* Dark Intelligence Dashboard Theme */
    --bg-dark: #0A0E17;
    --bg-panel: #111827;
    --bg-panel-border: #1F2937;
    --bg-input: #030712;

    --primary: #00D4FF;
    --primary-dim: rgba(0, 212, 255, 0.15);
    --primary-glow: 0 0 10px rgba(0, 212, 255, 0.5);

    --secondary: #FF3366;
    --secondary-glow: 0 0 10px rgba(255, 51, 102, 0.5);

    --category-military: #FF3366;
    --category-economic: #F59E0B;
    --category-politics: #8B5CF6;
    --category-climate: #10B981;

    --text-main: #F9FAFB;
    --text-muted: #9CA3AF;

    --radius: 4px;
    /* Sharp corners for tactical look */
    --transition: 200ms ease-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

.text-danger {
    color: var(--secondary) !important;
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.85rem;
}

.text-xs {
    font-size: 0.75rem;
}

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

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.p-3 {
    padding: 1rem;
}

/* Grid Layout */
.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.75rem;
    gap: 0.75rem;
}

.main-layout {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 0.75rem;
    flex: 1;
    min-height: 0;
}

/* Header */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--primary);
    box-shadow: inset 0 0 20px var(--primary-dim);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.brand h1 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin: 0;
}

.status-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    font-weight: 700;
    letter-spacing: 0.05em;
    animation: pulse 2s infinite;
}

.status-badge.live {
    background: rgba(255, 51, 102, 0.15);
    color: var(--secondary);
    border: 1px solid var(--secondary);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(255, 51, 102, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 51, 102, 0);
    }
}

.metrics-bar {
    display: flex;
    gap: 2rem;
}

.metric {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

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

.metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: var(--primary-glow);
}

/* Panels */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.panel::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.3;
}

.panel-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bg-panel-border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.panel-content {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

/* Sidebars */
.sidebar-left,
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-panel {
    flex-shrink: 0;
}

.feed-panel {
    flex: 1;
    min-height: 0;
}

.profile-panel {
    flex: 2;
    min-height: 0;
}

.bookmarks-panel {
    flex: 1;
    min-height: 0;
}

/* Custom Checkbox */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-main);
    user-select: none;
}

.filter-cb {
    display: none;
}

.custom-cb {
    width: 16px;
    height: 16px;
    border: 1px solid var(--bg-panel-border);
    background: var(--bg-input);
    border-radius: 2px;
    position: relative;
    transition: all var(--transition);
}

.filter-cb:checked+.custom-cb::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.category-military .custom-cb {
    border-color: rgba(255, 51, 102, 0.5);
}

.category-military .filter-cb:checked+.custom-cb {
    background: var(--category-military);
    border-color: var(--category-military);
    box-shadow: 0 0 8px rgba(255, 51, 102, 0.4);
}

.category-economic .custom-cb {
    border-color: rgba(245, 158, 11, 0.5);
}

.category-economic .filter-cb:checked+.custom-cb {
    background: var(--category-economic);
    border-color: var(--category-economic);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.category-politics .custom-cb {
    border-color: rgba(139, 92, 246, 0.5);
}

.category-politics .filter-cb:checked+.custom-cb {
    background: var(--category-politics);
    border-color: var(--category-politics);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

.category-climate .custom-cb {
    border-color: rgba(16, 185, 129, 0.5);
}

.category-climate .filter-cb:checked+.custom-cb {
    background: var(--category-climate);
    border-color: var(--category-climate);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* Switch Toggle */
.switch-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-input);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--bg-panel-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-dim);
    border-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(16px);
    background-color: var(--primary);
    box-shadow: var(--primary-glow);
}

/* Feed */
.feed-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.feed-card {
    background: var(--bg-input);
    border: 1px solid var(--bg-panel-border);
    border-left-width: 3px;
    padding: 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.feed-card:hover {
    transform: translateX(2px);
    background: #060b14;
}

.feed-card.military {
    border-left-color: var(--category-military);
}

.feed-card.economic {
    border-left-color: var(--category-economic);
}

.feed-card.politics {
    border-left-color: var(--category-politics);
}

.feed-card.climate {
    border-left-color: var(--category-climate);
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.4rem;
}

.feed-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.feed-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-dim);
}

/* Buttons */
.icon-btn {
    background: transparent;
    border: 1px solid var(--bg-panel-border);
    color: var(--text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.icon-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-dim);
}

.icon-btn.sm {
    width: 26px;
    height: 26px;
}

.btn {
    padding: 0.4rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--bg-panel-border);
    color: var(--text-main);
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Map Area */
.map-container {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--bg-panel-border);
    background: var(--bg-input);
}

#map {
    width: 100%;
    height: 100%;
    background: #0A0E17;
}

/* Base map color fallback */

/* Leaflet Dark mode overrides */
.leaflet-container {
    font-family: 'Inter', sans-serif;
    background: #0A0E17;
}

.leaflet-bar a {
    background-color: var(--bg-panel) !important;
    color: var(--primary) !important;
    border-color: var(--bg-panel-border) !important;
}

.leaflet-bar a:hover {
    background-color: var(--bg-input) !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--bg-panel);
    color: var(--text-main);
    border: 1px solid var(--primary-dim);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
    border-radius: var(--radius);
}

.leaflet-popup-content {
    margin: 10px 12px;
    font-size: 0.85rem;
}

/* Custom Map Marker Pulse */
.custom-marker {
    background: transparent;
    border: none;
}

.marker-core {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

.marker-pulse {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    animation: mapPulse 2s infinite ease-out;
}

@keyframes mapPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

.map-hud {
    position: absolute;
    z-index: 1000;
    pointer-events: none;
}

.map-hud.top-left {
    top: 1rem;
    left: 1rem;
}

.map-hud.bottom-center {
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
    width: 80%;
    max-width: 400px;
}

.hud-panel {
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid var(--primary-dim);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--primary);
    letter-spacing: 0.1em;
    text-shadow: var(--primary-glow);
}

.timeline-controls {
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(4px);
    border: 1px solid var(--bg-panel-border);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.timeline-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.time-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 2px;
    background: var(--bg-panel-border);
    outline: none;
    border-radius: 2px;
}

.time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: var(--primary-glow);
}

/* Regional Profile */
#region-profile {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.profile-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.profile-data {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.country-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.flag-placeholder {
    width: 40px;
    height: 26px;
    background: var(--bg-input);
    border: 1px solid var(--bg-panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--text-muted);
}

.country-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.region-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.stat-box {
    background: var(--bg-input);
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--bg-panel-border);
}

.stat-lbl {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.25rem;
}

.stat-val {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.intel-report {
    margin-top: 0.5rem;
    background: rgba(255, 51, 102, 0.05);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 51, 102, 0.2);
}

.intel-report h4 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
    text-shadow: var(--secondary-glow);
}

.intel-report p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
}

/* Bookmarks */
.bookmarks-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    overflow-y: auto;
}

.bookmark-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    cursor: pointer;
}

.bookmark-item:hover {
    border-color: var(--primary-dim);
    background: rgba(0, 212, 255, 0.05);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Responsive adjustments */
@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 250px 1fr 250px;
    }
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
    }

    .map-container {
        min-height: 400px;
        flex: none;
    }

    .profile-panel {
        min-height: 300px;
        flex: none;
    }

    .dashboard-container {
        height: auto;
        overflow: auto;
    }

    body {
        overflow: auto;
    }
}