:root {
    --primary: #ef4444;
    --secondary: #dc2626;
    --bg-dark: #ffffff;
    --bg-card: #ffffff;
    --text-main: #1c1c1c;
    --text-muted: #64748b;
    --accent: #b91c1c;
    --glass-border: rgba(0, 0, 0, 0.08);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

h1, h2, h3, h4, h5, h6 {
    color: #000000;
    font-weight: 700;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Lock global scrolling */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #fef2f2, #fee2e2);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 1s ease, visibility 1s;
}

#splash-screen::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.05;
    pointer-events: none;
}

.splash-logo {
    width: 150px;
    height: 150px;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* Layout Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 0;
    margin: 0;
    height: 100%;
}

.case1-page .dashboard-grid {
    grid-template-columns: 1fr 480px;
}

.bottom-section {
    margin-top: 1.5rem;
}

/* Navbar styles */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 100%;
}

.logo-svg {
    width: 32px;
    height: 32px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.nav-links a.active {
    font-weight: 700;
}

/* Layout */
.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    height: calc(100vh - 60px); /* Fill remaining viewport minus navbar */
    overflow: hidden;
}

/* Map specific */
#map-container {
    width: 100%;
    height: 100%;
    background: #f8fafc;
    border-right: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
}

.map-tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--primary);
    padding: 1rem;
    border-radius: 0.5rem;
    pointer-events: none;
    display: none;
    z-index: 100;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.map-tooltip ul {
    list-style: none;
    margin-top: 0.5rem;
}

.map-tooltip li {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-tooltip li::before {
    content: "•";
    color: var(--primary);
}

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

.tooltip-flag {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid var(--glass-border);
    display: none;
}

.legend {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.legend-title {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.legend-gradient {
    height: 12px;
    width: 200px;
    background: linear-gradient(to right, #c0d6d9, #97c3c6, #6aafb2, #40999d, #148487, #0b6f72, #055a5e);
    border-radius: 6px;
    margin: 0.5rem 0;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.zoom-btn:hover {
    background: #f8fafc;
    border-color: var(--primary);
    color: var(--primary);
}

.sidebar-container {
    height: calc(100vh - 60px); 
    overflow-y: auto;
    padding: 1.5rem;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    position: relative;
}

/* Ensure Case 1 elements don't shift right */
.sidebar-container section, 
.sidebar-container div {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.table-card {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.table-search {
    margin-bottom: 0.6rem;
}

.table-search-input {
    width: 100%;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.85rem;
    color: var(--text-main);
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.table-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

.rank-col {
    text-align: center;
    font-weight: 700;
    color: var(--text-main);
    min-width: 54px;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Interactive elements */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-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-dark);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

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

input:checked + .slider:before {
    transform: translateX(25px);
}

/* LLM Section */
.llm-card {
    margin-top: 2rem;
    background: #ffffff;
    border-radius: 1rem;
    border: 2px solid var(--primary);
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
}

.llm-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.llm-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.llm-content {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    min-height: 3rem;
    display: block;
    line-height: 1.7;
}

.llm-content em {
    color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

/* Sorting Indicators */
.sortable-th {
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sortable-th:hover {
    background-color: #f1f5f9;
    color: var(--primary) !important;
}
