/* Academic / Professional Clean Theme */

:root {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;

    --primary-blue: #1e3a8a;
    --primary-teal: #0f766e;
    --accent-amber: #b45309;
    /* Subdued amber for Uganda alerts */

    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Merriweather', serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    /* Prevent horizontal scrollbars */
}

/* Layout */
.container {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto;
}

.main-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* 2/3 for map, 1/3 for lists */
    gap: 1rem;
    padding: 0.75rem 0;
    min-width: 0;
}

.primary-column,
.secondary-column {
    min-width: 0;
    /* Essential to prevent content from pushing off-screen */
}

@media (max-width: 1024px) {
    .main-layout {
        display: flex;
        flex-direction: column;
    }
}

/* Header */
/* Classic Academic Premium Header */
.classic-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0 0 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.classic-header .brand-title {
    font-family: var(--font-serif);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.3rem;
    line-height: 1.2;
}

.classic-header .brand-quote {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.classic-header .academic-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--primary-teal);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    line-height: 1;
}

.case-study-badge {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--primary-blue);
    background: transparent;
    border: none;
    padding: 0;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    line-height: 1;
}

.case-study-badge .badge-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--primary-teal);
    border-radius: 50%;
    animation: pulse-beep 2s infinite;
}

/* Classic Wide Tab Menu resting on bottom border */
.classic-tabs {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    margin-top: 1rem;
    border-top: 2px solid var(--primary-teal);
    border-bottom: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem 0 0.5rem;
    background: #f8fafc;
}

/* Hide scrollbar for classic tabs */
.classic-tabs::-webkit-scrollbar {
    display: none;
}

.classic-tabs {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.classic-tabs .tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2.5px solid transparent;
    padding: 0.75rem 0;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 0;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    text-transform: none;
}

.classic-tabs .tab-btn:hover {
    color: var(--primary-teal);
}

.classic-tabs .tab-btn.active {
    color: var(--primary-teal);
    border-bottom: 2.5px solid var(--primary-teal);
}

@media (max-width: 850px) {
    .classic-header {
        padding: 1.5rem 1rem 0 1rem;
    }

    .classic-tabs {
        gap: 1.25rem;
    }

    .classic-tabs .tab-btn {
        font-size: 0.76rem;
    }
}

/* Cards / Sections */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: 0;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    width: 100%;
    min-width: 0;
    /* Prevents grid blowout from children like Canvas */
}

.card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-header h2 {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.card-body {
    padding: 0.75rem;
}

.card-body.p-0 {
    padding: 0;
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-teal);
    background: #ccfbf1;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

.status-badge.live-pulse {
    background: #fef3c7;
    color: #b45309;
    font-size: 0.65rem;
    animation: pulse-beep 1.5s infinite;
}

@keyframes pulse-beep {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 1;
    }
}

/* Map */
.map-section {
    background: #1e3a8a;
    /* Elegant deep blue */
    border: none;
    border-radius: 0;
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.15);
    /* Soft blue shadow */
    color: #f8fafc;
}

.map-section .card-header {
    background: rgba(30, 58, 138, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.map-section .card-header h2 {
    color: #bae6fd;
    /* Lighter cyan for elegance */
    font-size: 0.95rem;
    font-weight: 500;
}

.map-container {
    height: 480px;
    /* Reduced height as requested */
    width: 100%;
    background: radial-gradient(circle at center, #38bdf8 0%, #1e3a8a 45%, #0f172a 100%);
    cursor: grab;
}

.map-container:active {
    cursor: grabbing;
}

@media (max-width: 768px) {
    .map-container {
        height: 400px;
    }
}

.map-legend {
    padding: 0.75rem 1.25rem;
    background: #1e3a8a;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: #e0f2fe;
    flex-wrap: wrap;
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.dot.target {
    background: #fbbf24;
    box-shadow: 0 0 8px #fbbf24;
}

.dot.vendor {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

.line {
    display: inline-block;
    width: 20px;
    height: 2px;
    margin-right: 6px;
    vertical-align: middle;
}

.line.connection {
    background: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
}

/* Lists / Encyclopedia */
.scroll-list {
    max-height: 500px;
    overflow-y: auto;
}

/* Clean list item without colored borders */
.list-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.list-item:hover {
    background: #f1f5f9;
}

.list-item:last-child {
    border-bottom: none;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.item-title {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 0.85rem;
}

.item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.item-desc {
    font-size: 0.75rem;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alert-tag {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: #e11d48;
    /* Red threat color */
    background: transparent;
    padding: 0;
    font-weight: 600;
    border: none;
    box-shadow: none;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.filter-badge {
    font-size: 0.75rem;
    color: #b45309;
    background: #fef3c7;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Premium SaaS-Style Modal Redesign */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #ffffff;
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    border-radius: 12px;
    /* Soft, premium curves */
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 1.35rem;
    color: #0f172a;
    margin: 0;
}

.close-btn {
    background: #f1f5f9;
    border: none;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.modal-body {
    padding: 2rem;
}

.modal-meta {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.modal-uganda-alert {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    /* border-left: 4px solid #3b82f6;  */
    /* Elegant blue accent instead of harsh red */
    padding: 1rem 1.25rem;
    color: #334155;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    border-radius: 0 6px 6px 0;
    display: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.modal-text {
    font-size: 1rem;
    line-height: 1.6;
    color: #475569;
    margin-bottom: 1.5rem;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .modal-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.modal-grid h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.modal-list {
    list-style: none;
    font-size: 0.85rem;
}

.modal-list li {
    padding: 0.25rem 0;
    border-bottom: 1px solid #f1f5f9;
    word-break: break-word;
}

/* Data Grid (Charts & Timeline) */
.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 850px) {
    .data-grid {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Make sure canvas doesn't force width */
canvas {
    max-width: 100%;
}

.timeline {
    display: flex;
    overflow-x: auto;
    padding: 1.5rem;
    gap: 1.5rem;
    -webkit-overflow-scrolling: touch;
}

.timeline-event {
    flex: 0 0 auto;
    width: 280px;
    border-left: 2px solid var(--primary-teal);
    padding-left: 1rem;
    position: relative;
}

@media (max-width: 480px) {
    .timeline-event {
        width: 240px;
    }
}

.timeline-event::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    width: 10px;
    height: 10px;
    background: var(--primary-teal);
    border-radius: 50%;
}

.t-year {
    font-weight: 700;
    color: var(--primary-teal);
    font-size: 0.85rem;
}

.t-title {
    font-weight: 600;
    margin: 0.25rem 0;
    font-size: 0.95rem;
}

.t-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.t-citation {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
}

.t-citation:hover {
    text-decoration: underline;
}

.loading-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Elegant CSS Spinner */
.spinner {
    border: 3px solid #f1f5f9;
    border-top: 3px solid var(--primary-teal);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.site-footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.methodology-btn {
    background: #fff;
    border: 1px solid var(--primary-teal);
    color: var(--primary-teal);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

.methodology-btn:hover {
    background: var(--primary-teal);
    color: #fff;
}

.chart-footer {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
}

/* Custom Tooltip Cursor for Headers with ⓘ */
.card-header h2[title] {
    cursor: help;
    text-decoration: underline dotted var(--text-muted);
}

/* ==================== Academic Multi-Tab Layout ==================== */
.dashboard-tabs {
    display: flex;
    gap: 0.4rem;
    padding: 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.dashboard-tabs::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.dashboard-tabs {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 0.9rem;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.tab-btn:hover {
    color: var(--primary-teal);
    background: #f1f5f9;
}

.tab-btn.active {
    color: var(--primary-blue);
    background: #e0f2fe;
    /* Light sky blue background */
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.1);
}

.tab-content {
    display: none;
    animation: tabFadeIn 0.25s ease-in-out forwards;
}

.tab-content.active {
    display: block;
}

/* ==================== Full-Width Bottom Row Grid (col-12/col-6s) ==================== */
.db-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 850px) {
    .db-grid {
        grid-template-columns: 1fr;
    }
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Academic Vertical Chronological Timeline ==================== */
.timeline-vertical {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 0.5rem 0;
}

/* Central spine line */
.timeline-vertical::after {
    content: '';
    position: absolute;
    width: 1.5px;
    background-color: var(--primary-teal);
    top: 0;
    bottom: 0;
    left: 16px;
    margin-left: -0.75px;
    border-radius: 2px;
}

.timeline-item-vertical {
    padding: 0.4rem 0;
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

/* Dotted Timeline marker */
.timeline-item-vertical::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    left: 16px;
    background-color: #ffffff;
    border: 2px solid var(--primary-teal);
    top: 0.9rem;
    border-radius: 50%;
    z-index: 10;
    margin-left: -4px;
    transition: all 0.2s ease;
}

.timeline-item-vertical:hover::after {
    background-color: var(--primary-teal);
}

.timeline-content-vertical {
    padding: 0.35rem 0.5rem;
    position: relative;
    margin-left: 32px;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.timeline-content-vertical .t-year {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--primary-teal);
    display: inline-block;
    background: #e2f9f5;
    padding: 0.08rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.5rem;
}

.timeline-content-vertical .t-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary-blue);
    display: inline-block;
    margin-bottom: 0.15rem;
}

.timeline-content-vertical .t-desc {
    font-size: 0.82rem;
    color: var(--text-main);
    line-height: 1.45;
    margin-bottom: 0.15rem;
}

.timeline-content-vertical .t-citation {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
    display: inline-block;
    margin-top: 0.1rem;
}

.timeline-content-vertical .t-citation:hover {
    color: var(--primary-teal);
}