/* Crime Data Spain - Sleek Authority Aesthetic */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
    /* Primary palette - Clean Navy */
    --navy-900: #0a1628;
    --navy-800: #0f1f35;
    --navy-700: #1a3a5c;
    --navy-600: #1e4976;
    --navy-500: #2563eb;
    --navy-400: #3b82f6;
    --navy-300: #60a5fa;
    --navy-200: #93c5fd;
    --navy-100: #dbeafe;
    --navy-50: #eff6ff;

    /* Gold/Official accent */
    --gold: #b8860b;
    --gold-light: #d4a017;
    --gold-dark: #996f0a;
    --gold-muted: rgba(184, 134, 11, 0.1);
    --gold-border: rgba(184, 134, 11, 0.3);

    /* Alert/Status colors */
    --alert-red: #dc2626;
    --alert-red-light: #ef4444;
    --alert-red-bg: rgba(220, 38, 38, 0.08);
    --status-green: #16a34a;
    --status-green-light: #22c55e;
    --status-green-bg: rgba(22, 163, 74, 0.08);
    --warning-amber: #d97706;
    --warning-amber-bg: rgba(217, 119, 6, 0.08);

    /* Neutral palette - Clean grays */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;

    /* Core semantic colors */
    --text: #171717;
    --text-secondary: #404040;
    --text-muted: #737373;
    --text-inverse: #ffffff;
    --bg: #fafafa;
    --bg-elevated: #ffffff;
    --border: #e5e5e5;
    --border-strong: #d4d4d4;

    /* Component colors */
    --primary: var(--navy-700);
    --primary-dark: var(--navy-800);
    --primary-light: var(--navy-50);
    --accent: var(--gold);

    /* Shadows - Subtle */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);

    /* Border radius - Sharp but not harsh */
    --radius: 6px;
    --radius-sm: 4px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.2s ease;
    --transition-fast: all 0.15s ease;
    --transition-slow: all 0.3s ease;

    /* Z-index */
    --z-dropdown: 200;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ==================== NAVBAR ==================== */
.navbar {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 0;
    transition: var(--transition);
}

.navbar .container-fluid {
    padding: 0.875rem 1.5rem;
}

.navbar.scrolled {
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-brand img {
    /* Keep original icon colors */
}

.navbar-brand span {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    color: var(--navy-700);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 1.1rem;
}

.nav-link {
    position: relative;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    padding: 0.5rem 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: var(--transition);
    border-radius: var(--radius-sm);
}

.nav-link:hover {
    color: var(--navy-700);
    background: var(--gray-100);
}

.nav-link.active {
    color: var(--gold-dark);
    background: var(--gold-muted);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0.875rem;
    right: 0.875rem;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
}

/* ==================== MAIN ==================== */
.main-content {
    flex: 1;
    padding: 1.5rem 0;
    background: var(--bg);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== CHART TYPE SWITCHER ==================== */
.chart-type-switcher {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.chart-type-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-family: 'IBM Plex Sans', sans-serif;
}

.chart-type-btn:hover {
    border-color: var(--gray-300);
    background: var(--gray-100);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.chart-type-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.chart-type-btn.active {
    background: var(--navy-700);
    border-color: var(--navy-700);
    box-shadow: var(--shadow-md);
}

.chart-type-btn i {
    font-size: 0.9rem;
    color: var(--navy-600);
    transition: var(--transition);
}

.chart-type-btn.active i {
    color: var(--gold-light);
}

.chart-type-btn-label {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: var(--transition);
}

.chart-type-btn.active .chart-type-btn-label {
    color: var(--text-inverse);
}

.chart-type-btn-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: var(--transition);
    padding-left: 0.5rem;
    border-left: 1px solid var(--border);
}

.chart-type-btn.active .chart-type-btn-desc {
    color: rgba(255, 255, 255, 0.7);
    border-left-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 1200px) {
    .chart-type-btn-desc {
        display: none;
    }

    .chart-type-btn {
        padding: 0.5rem 0.875rem;
    }
}

/* ==================== CONTROL PANEL ==================== */
.control-panel {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: visible;
    padding: 0;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    position: relative;
    transition: var(--transition);
}

.control-panel:hover {
    box-shadow: var(--shadow);
}


.control-panel:has(.choices.is-open) {
    overflow: visible;
}

.control-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-track {
    background: transparent;
}

.control-panel::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.control-section {
    padding: 1.25rem;
    padding-left: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.control-section:last-child {
    border-bottom: none;
}

.control-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--navy-700);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.control-section-header i {
    color: var(--gold);
    font-size: 0.8rem;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.sidebar-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    display: flex;
    align-items: center;
}

.sidebar-title i {
    color: var(--gold);
}

/* ==================== FORM CONTROLS ==================== */
.form-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-select {
    font-family: 'IBM Plex Sans', sans-serif;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: var(--bg-elevated);
    transition: var(--transition);
    cursor: pointer;
    color: var(--text);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-select:hover {
    border-color: var(--gray-400);
}

.form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-muted);
    outline: none;
}

/* Year badge */
.year-badge {
    background: var(--navy-700);
    color: var(--text-inverse);
    padding: 0.35rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
}

/* ==================== CHART CARD ==================== */
.chart-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    transition: var(--transition);
}

.chart-card:hover {
    box-shadow: var(--shadow-md);
}


.chart-card-body {
    padding: 0.75rem;
    padding-top: 1rem;
}

.chart-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chart-card-footer i {
    color: var(--gold);
}

/* ==================== METRIC CARDS ==================== */
.metric-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}


.metric-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
    transform: translateY(-2px);
}

.metric-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.metric-card .metric-icon {
    transition: var(--transition);
}

.metric-card:hover .metric-icon {
    transform: scale(1.05);
}

.metric-card .metric-value {
    transition: var(--transition-fast);
}

.metric-card:hover .metric-value {
    color: var(--navy-700);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.metric-card.primary .metric-icon {
    background: var(--navy-50);
    color: var(--navy-600);
}

.metric-card.danger .metric-icon {
    background: var(--alert-red-bg);
    color: var(--alert-red);
}

.metric-card.success .metric-icon {
    background: var(--status-green-bg);
    color: var(--status-green);
}

.metric-content {
    flex: 1;
    min-width: 0;
}

.metric-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.metric-value {
    font-family: 'Oswald', sans-serif;
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.1;
}

.metric-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== CARDS (generic) ==================== */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}


.card-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.card-body {
    padding: 1.5rem;
}

/* ==================== CHART CONTAINERS ==================== */
.chart-container {
    height: 520px;
}

.chart-container-large {
    height: 600px;
    padding: 1rem;
}

.chart-container-dynamic {
    min-height: 400px;
    padding: 0.5rem;
}

/* ==================== YEAR PILLS ==================== */
.year-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.year-pill {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.year-pill:hover {
    border-color: var(--gray-300);
    color: var(--navy-700);
    background: var(--gray-100);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.year-pill:active {
    transform: translateY(0);
    box-shadow: none;
}

.year-pill.active {
    background: var(--navy-700);
    border-color: var(--navy-700);
    color: var(--text-inverse);
}

/* ==================== QUICK VIEWS ==================== */
.quick-views-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
}

.quick-views {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-views-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.quick-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.quick-view-btn:hover {
    border-color: var(--gray-300);
    background: var(--gray-100);
    color: var(--navy-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.quick-view-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.quick-view-btn.active {
    background: var(--navy-700);
    border-color: var(--navy-700);
    color: var(--text-inverse);
}

.quick-view-btn.active i {
    color: var(--gold-light);
}

.quick-view-btn i {
    font-size: 0.6rem;
    color: var(--gold);
}

/* ==================== VALUE BOXES ==================== */
.value-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.value-box:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--gray-300);
}

.value-box:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.value-box .value-box-icon {
    transition: var(--transition);
}

.value-box:hover .value-box-icon {
    transform: scale(1.05);
}

.value-box .value-box-value {
    transition: var(--transition-fast);
}

.value-box:hover .value-box-value {
    color: var(--navy-700);
}

.value-box-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.value-box-primary .value-box-icon {
    background: var(--navy-50);
    color: var(--navy-600);
}

.value-box-danger .value-box-icon {
    background: var(--alert-red-bg);
    color: var(--alert-red);
}

.value-box-teal .value-box-icon {
    background: var(--status-green-bg);
    color: var(--status-green);
}

.value-box-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.value-box-value {
    font-family: 'Oswald', sans-serif;
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.2;
}

.value-box-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ==================== CHOICES.JS STYLING ==================== */
.choices {
    position: relative;
    z-index: 1;
    margin-bottom: 0;
    font-family: 'IBM Plex Sans', sans-serif;
}

.choices.is-open {
    z-index: var(--z-dropdown);
}

.choices__inner {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) !important;
    padding: 0.5rem 0.75rem;
    min-height: 42px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    transition: var(--transition);
}

.choices__inner:hover {
    border-color: var(--gray-400);
}

.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-muted);
    border-radius: var(--radius-sm) !important;
}

.choices__list--single {
    padding: 0;
    display: flex;
    align-items: center;
}

.choices__list--single .choices__item {
    padding: 0;
    font-weight: 500;
    color: var(--text);
}

.choices[data-type*=select-one]::after {
    content: '';
    height: 0;
    width: 0;
    border-style: solid;
    border-color: var(--text-muted) transparent transparent transparent;
    border-width: 5px;
    position: absolute;
    right: 12px;
    top: 50%;
    margin-top: -2.5px;
    pointer-events: none;
    transition: var(--transition);
}

.choices[data-type*=select-one].is-open::after {
    border-color: transparent transparent var(--gold) transparent;
    margin-top: -7.5px;
}

.choices__list--dropdown,
.choices__list--dropdown.is-active {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-lg);
    margin-top: 4px;
    z-index: var(--z-dropdown) !important;
    background: var(--bg-elevated);
    overflow: hidden;
    padding: 4px;
}

.choices[data-type*=select-one] .choices__list--dropdown {
    border-radius: var(--radius) !important;
}

.choices__list--dropdown .choices__list {
    max-height: 260px;
    overflow-y: auto;
}

.choices__list--dropdown .choices__list::-webkit-scrollbar {
    width: 6px;
}

.choices__list--dropdown .choices__list::-webkit-scrollbar-track {
    background: transparent;
}

.choices__list--dropdown .choices__list::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.choices__list--dropdown .choices__list::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.choices__list--dropdown .choices__item {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: all 0.1s ease;
    cursor: pointer;
}

.choices__list--dropdown .choices__item:last-child {
    margin-bottom: 0;
}

.choices__list--dropdown .choices__item--selectable:hover {
    background: var(--gray-100);
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background: var(--gold-muted);
    color: var(--gold-dark);
}

.choices__list--dropdown .choices__item--selectable.is-selected {
    background: var(--navy-700);
    color: var(--text-inverse);
}

.choices[data-type*=select-one] .choices__input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    margin: 0 0 4px 0;
    border: none;
    border-radius: 0;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--text);
}

.choices[data-type*=select-one] .choices__input:focus {
    outline: none;
}

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

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

.choices[data-type*=select-multiple] .choices__inner {
    min-height: 100px;
    padding: 0.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.choices[data-type*=select-multiple] .choices__input {
    padding: 0.25rem 0.5rem;
    margin: 0;
    background: transparent;
    border: none;
    font-size: 0.875rem;
}

.choices[data-type*=select-multiple] .choices__input:focus {
    outline: none;
}

.choices__list--multiple .choices__item {
    background: var(--navy-700);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-inverse);
    display: inline-flex;
    align-items: center;
}

.choices__button {
    border-left: 1px solid rgba(255,255,255,0.3);
    padding-left: 6px;
    margin-left: 6px;
}

/* ==================== NOUISLIDER STYLING ==================== */
.noUi-target {
    background: var(--gray-200);
    border: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    height: 6px;
    border-radius: 3px;
}

.noUi-connect {
    background: linear-gradient(90deg, var(--gold), var(--navy-600));
    border-radius: 3px;
}

.noUi-horizontal .noUi-handle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--gold);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    top: -6px;
    right: -9px;
}

.noUi-handle:before, .noUi-handle:after {
    display: none;
}

.noUi-handle:focus {
    outline: none;
}

.noUi-tooltip {
    display: none;
}

/* ==================== SWITCH ==================== */
.form-switch {
    display: flex;
    align-items: center;
    padding-left: 0;
    gap: 0.5rem;
}

.form-switch .form-check-input {
    width: 2.5rem;
    height: 1.25rem;
    cursor: pointer;
    margin-left: 0;
    margin-top: 0;
    float: none;
    background-color: var(--gray-300);
    border-color: var(--gray-300);
}

.form-switch .form-check-input:checked {
    background-color: var(--navy-600);
    border-color: var(--navy-600);
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
    margin-bottom: 0;
}

/* ==================== BUTTONS ==================== */
.btn {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.btn-primary {
    background: var(--navy-700);
    border-color: var(--navy-700);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--navy-800);
    border-color: var(--navy-800);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    color: var(--navy-700);
    border-color: var(--navy-700);
}

.btn-outline-primary:hover {
    background: var(--navy-700);
    color: var(--text-inverse);
}

.btn-light {
    background: var(--gray-100);
    border-color: var(--border);
    color: var(--text);
}

.btn-light:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

/* ==================== DOWNLOAD BUTTONS ==================== */
.download-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    min-width: 140px;
    position: relative;
}


.download-btn:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
    color: var(--text);
    transform: translateY(-3px);
}

.download-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}


.download-btn .icon-wrapper {
    width: 48px;
    height: 48px;
    background: var(--navy-50);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--navy-600);
    transition: var(--transition);
}

.download-btn:hover .icon-wrapper {
    background: var(--navy-700);
    color: var(--gold-light);
}

.download-btn .btn-label {
    font-weight: 600;
    font-size: 0.8rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ==================== FLOATING HELP BUTTON ==================== */
.btn-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--navy-700);
    color: var(--gold-light);
    border: none;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 1000;
    transition: var(--transition);
}

.btn-floating:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    color: var(--gold-light);
    background: var(--navy-800);
}

/* ==================== MODAL ==================== */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}


.modal-header {
    padding-top: 1.5rem;
}

.modal-title {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--navy-700);
}

.faq-item {
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.faq-item:hover {
    background: var(--gray-100);
    transform: translateX(4px);
}

.faq-item h6 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--navy-700);
    margin-bottom: 0.5rem;
}

.faq-item h6 i {
    color: var(--gold);
}

.faq-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* ==================== ABOUT ==================== */
.about-avatar {
    width: 80px;
    height: 80px;
    background: var(--navy-50);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 2rem;
    color: var(--navy-600);
}

/* ==================== FOOTER ==================== */
.footer {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
}

/* ==================== LINKS ==================== */
a {
    color: var(--navy-600);
    text-decoration: none;
}

a:hover {
    color: var(--gold-dark);
}

/* ==================== LOADING ==================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== UTILITIES ==================== */
.text-primary {
    color: var(--navy-700) !important;
}

.hover-lift {
    transition: transform var(--transition), box-shadow var(--transition);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ==================== MOBILE NAV CONTROLS ==================== */
.mobile-nav-controls {
    display: none;
    align-items: center;
    gap: 0.75rem;
}

.language-toggle-mobile {
    display: none;
}

/* ==================== NAVBAR TOGGLE (Hamburger) ==================== */
.navbar-toggler {
    border: none;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    transition: var(--transition);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-toggler:hover {
    background: var(--gray-200);
}

.navbar-toggler:focus {
    box-shadow: none;
    background: var(--gold-muted);
}

/* Animated hamburger icon */
.hamburger-icon {
    width: 22px;
    height: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--navy-700);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Animated X when open */
.navbar-toggler[aria-expanded="true"] .hamburger-icon span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.navbar-toggler[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.navbar-toggler[aria-expanded="true"] .hamburger-icon span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.navbar-toggler[aria-expanded="true"] {
    background: var(--navy-700);
}

.navbar-toggler[aria-expanded="true"] .hamburger-icon span {
    background: var(--gold-light);
}

.navbar-toggler-icon {
    display: none;
}

/* ==================== MOBILE SIDEBAR TOGGLE ==================== */
.sidebar-toggle {
    display: none;
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-toggle:hover {
    background: var(--gray-100);
    border-color: var(--gold-border);
}

.sidebar-toggle i {
    color: var(--gold);
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
}

.sidebar-toggle.collapsed i.fa-chevron-down {
    transform: rotate(-90deg);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 991px) {
    .navbar-brand span {
        font-size: 1rem;
    }

    /* Show mobile nav controls */
    .mobile-nav-controls {
        display: flex;
    }

    .language-toggle-mobile {
        display: flex;
    }

    /* Hide language toggle inside collapsed menu */
    .navbar-collapse .language-toggle {
        display: none;
    }

    .navbar-collapse {
        background: var(--bg-elevated);
        padding: 1rem;
        margin-top: 0.5rem;
        border-radius: var(--radius);
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--border);
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        margin-bottom: 0.25rem;
    }

    .navbar-nav .nav-link.active::after {
        display: none;
    }

    .navbar-nav .nav-link.active {
        border-left: 3px solid var(--gold);
        border-radius: 0;
    }

    .navbar-nav .nav-link:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-container .sidebar {
        display: none;
    }

    .sidebar-container .sidebar.show {
        display: block;
        animation: slideDown 0.2s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .sidebar-container {
        margin-bottom: 1rem;
    }

    .chart-container {
        height: 420px;
    }

    .chart-container-large {
        height: auto;
        aspect-ratio: 3 / 4;
        min-height: 450px;
    }

    .card {
        overflow: visible;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .btn-floating {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }

    .metric-card {
        margin-bottom: 0.75rem;
    }

    .footer {
        padding: 1rem 0;
    }

    .download-buttons {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .download-btn {
        min-width: unset;
        padding: 1.25rem 1rem;
    }

    .download-btn .icon-wrapper {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .download-btn .btn-label {
        font-size: 0.75rem;
    }

    .chart-type-switcher {
        gap: 0.375rem;
    }

    .chart-type-btn {
        padding: 0.5rem 0.75rem;
        gap: 0.375rem;
    }

    .chart-type-btn i {
        font-size: 0.85rem;
    }

    .chart-type-btn-label {
        font-size: 0.7rem;
    }

    .chart-type-btn-desc {
        display: none;
    }

    .quick-views-header {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .quick-views {
        gap: 0.375rem;
    }

    .quick-view-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.65rem;
    }

    .quick-views-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .chart-container {
        height: 380px;
    }

    .chart-container-large {
        aspect-ratio: 3 / 5;
        min-height: 480px;
    }

    .navbar-brand span {
        font-size: 0.9rem;
    }

    .navbar-brand img {
        height: 24px;
    }

    .chart-type-switcher {
        gap: 0.25rem;
    }

    .chart-type-btn {
        padding: 0.4rem 0.6rem;
    }

    .chart-type-btn-label {
        font-size: 0.65rem;
    }
}

/* ============================================
   LANGUAGE TOGGLE
   ============================================ */
.language-toggle {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

.lang-btn {
    padding: 0.375rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
    font-family: 'IBM Plex Sans', sans-serif;
}

.lang-btn:hover {
    color: var(--text);
    background: var(--gray-200);
}

.lang-btn.active {
    background: var(--bg-elevated);
    color: var(--navy-700);
    box-shadow: var(--shadow-xs);
}

/* Language toggle inside navbar-collapse is hidden on mobile (see responsive section) */

@media (max-width: 480px) {
    .lang-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.65rem;
    }
}

/* ==================== METHODOLOGY TABLE ==================== */
.methodology-table {
    font-size: 0.85rem;
}

.methodology-table th {
    white-space: nowrap;
    vertical-align: middle;
    background: var(--navy-700) !important;
    color: var(--text-inverse);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

.table-primary {
    --bs-table-bg: var(--navy-700);
    --bs-table-color: var(--text-inverse);
}

.methodology-table td {
    vertical-align: middle;
}

.methodology-table td:first-child {
    font-weight: 700;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    color: var(--navy-700);
}

.methodology-table td:nth-child(3) {
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--navy-600);
}

.methodology-table td:last-child {
    color: var(--text-muted);
    min-width: 200px;
}

.table-secondary {
    --bs-table-bg: var(--gold-muted);
    --bs-table-color: var(--navy-800);
}

@media (max-width: 768px) {
    .methodology-table {
        font-size: 0.75rem;
    }

    .methodology-table td:last-child {
        min-width: 150px;
    }
}

/* ==================== PAGE TITLES ==================== */
h1, h2, h3, h4, h5 {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--navy-800);
}

h4.text-primary, h5.text-primary {
    color: var(--navy-700) !important;
}

.loader-title {
    font-family: 'Oswald', sans-serif;
}

.modal-title {
    font-family: 'Oswald', sans-serif;
}


/* ==================== TABLE STRIPED OVERRIDE ==================== */
.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: var(--gray-50);
}

.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: var(--gold-muted);
}

/* ==================== HR STYLING ==================== */
hr {
    border-color: var(--gray-200);
    opacity: 0.8;
}
