/* Bulgaria Interactive Map - Modern Design */
/* ========================================= */

:root {
    --primary-color: #1a5f7a;
    --primary-light: #2e8bc0;
    --primary-dark: #0d3b4c;
    --accent-color: #e8a838;
    --accent-light: #f4c430;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-panel: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #475569;
    --success-color: #22c55e;
    --info-color: #3b82f6;
    --warning-color: #f59e0b;
    --marker-bg: #e74c3c;
    --marker-active: #f39c12;
    --oh-green: #2e8b2e;
    --oh-yellow: #f4b800;
    --oh-blue: #1e4fa0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 80%, rgba(26, 95, 122, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(232, 168, 56, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(46, 139, 192, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ============================ */
/* COMPACT HEADER               */
/* ============================ */

.header {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    position: relative;
    overflow: hidden;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.header-logo-side {
    flex-shrink: 0;
}

.header-logo {
    max-width: 120px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    transition: transform var(--transition-normal);
}

.header-logo:hover {
    transform: scale(1.03);
}

.header-text-side {
    flex: 1;
    text-align: left;
}

.header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 50%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.header .subtitle {
    font-size: 0.85rem;
    color: var(--accent-light);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.header .subtitle-secondary {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.2rem;
}

.header .subtitle-secondary span {
    white-space: nowrap;
}

.header .subtitle-secondary strong {
    color: var(--accent-light);
    font-weight: 600;
}

/* ============================ */
/* MAIN CONTAINER               */
/* ============================ */

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: grid;
    grid-template-columns: 1fr 400px;
    grid-template-rows: auto auto;
    grid-template-areas:
        "map   info"
        "stats info";
    gap: 1.5rem;
    align-items: start;
}

#map-section { grid-area: map; }
#info-panel  { grid-area: info; }
#stats-panel-container { grid-area: stats; }

/* Map Container */
.map-container {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.map-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(46, 139, 192, 0.03) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
    pointer-events: none;
}

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

.map-title {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

.map-wrapper {
    position: relative;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: #a8d5e5;
}

.map-image {
    width: 100%;
    height: auto;
    display: block;
}

.markers-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Region Marker */
.region-marker {
    position: absolute;
    width: 28px;
    height: 28px;
    transform: translate(-50%, -50%);
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
    transition: all var(--transition-normal);
}

.region-marker:hover {
    transform: translate(-50%, -50%) scale(1.3);
    z-index: 20;
}

.region-marker.active {
    transform: translate(-50%, -50%) scale(1.4);
    z-index: 20;
}

.marker-pin {
    width: 100%;
    height: 100%;
    position: relative;
}

.marker-pin::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--marker-bg), #c0392b);
    border-radius: 50% 50% 50% 0;
    transform: translate(-50%, -50%) rotate(-45deg);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    border: 2px solid white;
    transition: all var(--transition-normal);
}

.marker-pin::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    z-index: 2;
}

.marker-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.3);
    animation: markerPulse 2s ease-out infinite;
    pointer-events: none;
}

@keyframes markerPulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.region-marker:hover .marker-pin::before,
.region-marker.active .marker-pin::before {
    background: linear-gradient(135deg, var(--marker-active), #e67e22);
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.6);
}

.region-marker.active .marker-pulse {
    background: rgba(243, 156, 18, 0.4);
}

.marker-label {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: all var(--transition-fast);
    pointer-events: none;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.region-marker:hover .marker-label,
.region-marker.active .marker-label {
    opacity: 1;
    top: -28px;
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg), 0 0 30px rgba(0,0,0,0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 10000;
    font-size: 0.9rem;
    max-width: 280px;
    transform: translateY(5px);
}

.tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.tooltip .tooltip-title {
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 0.5rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
}

.tooltip .tooltip-data {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

.tooltip .tooltip-data strong {
    color: var(--text-primary);
}

/* Map Legend */
.map-legend-full {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.map-legend-full h4 {
    color: var(--accent-light);
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
    text-align: center;
    font-weight: 600;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 0.2rem 0;
}

.legend-item .legend-marker {
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, var(--marker-bg), #c0392b);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 1.5px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.legend-item .legend-marker.active {
    background: linear-gradient(135deg, var(--marker-active), #e67e22);
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.5);
}

.legend-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.legend-bar {
    width: 30px;
    height: 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-bar.population {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.legend-bar.packages {
    background: linear-gradient(90deg, var(--info-color), #60a5fa);
}

.legend-bar.prescriptions {
    background: linear-gradient(90deg, var(--success-color), #4ade80);
}

/* Stats Panel */
.stats-panel-container {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stats-panel-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(232, 168, 56, 0.03) 0%, transparent 70%);
    pointer-events: none;
}

.stats-panel-container h3 {
    text-align: center;
    color: var(--accent-light);
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.stats-panel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.stats-panel-item {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.stats-panel-item .sp-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}

.stats-panel-item .sp-label span:first-child {
    color: var(--text-secondary);
}

.stats-panel-item .sp-label span:last-child {
    color: var(--accent-light);
    font-weight: 700;
    font-size: 1.1rem;
}

.stats-panel-item .sp-bar {
    height: 10px;
    background: rgba(71, 85, 105, 0.4);
    border-radius: 5px;
    overflow: hidden;
}

.stats-panel-item .sp-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 1s ease;
    position: relative;
}

.stats-panel-item .sp-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2));
}

.sp-fill.population {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.sp-fill.packages {
    background: linear-gradient(90deg, var(--info-color), #60a5fa);
}

.sp-fill.prescriptions {
    background: linear-gradient(90deg, var(--success-color), #4ade80);
}

.stats-panel-placeholder {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
    font-size: 1rem;
}

/* Info Panel */
.info-panel {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 2rem;
    min-height: 400px;
    align-self: start;
}

.info-panel-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.info-panel-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.info-panel-header .region-name {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.coat-of-arms {
    width: 100px;
    height: 120px;
    margin: 0 auto 1rem;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    transition: transform var(--transition-normal);
}

.coat-of-arms:hover {
    transform: scale(1.05);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(26, 95, 122, 0.2) 0%, rgba(46, 139, 192, 0.1) 100%);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    border: 1px solid rgba(46, 139, 192, 0.2);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(46, 139, 192, 0.4);
}

.stat-card .stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Detail Info */
.detail-info {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    margin-bottom: 0;
}

.detail-info h3 {
    font-size: 1rem;
    color: var(--accent-light);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-row .value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-row .value.highlight {
    color: var(--accent-light);
}

/* ============================ */
/* WAVE ANIMATION + SPIN LOGO   */
/* ============================ */

.wave-animation-wrapper {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.wave-bar-container {
    width: 100%;
    height: 40px;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    position: relative;
    margin-bottom: 1rem;
}

.wave-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    border-radius: 20px;
    overflow: hidden;
    animation: waveFill 2.5s ease-out forwards;
}

.wave-bar-inner {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.wave-stripe {
    position: absolute;
    top: 0;
    height: 100%;
    width: 200%;
    background: repeating-linear-gradient(
        90deg,
        var(--oh-green) 0%,
        var(--oh-green) 33.33%,
        var(--oh-yellow) 33.33%,
        var(--oh-yellow) 66.66%,
        var(--oh-blue) 66.66%,
        var(--oh-blue) 100%
    );
    animation: waveMove 1.5s linear infinite;
    opacity: 0.85;
}

@keyframes waveMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-33.33%); }
}

@keyframes waveFill {
    0% { width: 0%; }
    70% { width: 100%; }
    100% { width: 100%; }
}

.wave-glow {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    animation: waveShine 1.5s ease-in-out infinite;
}

@keyframes waveShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.wave-logo-reveal {
    opacity: 0;
    transform: scale(0.5);
    animation: logoReveal 0.8s ease-out 2.2s forwards;
    display: inline-block;
}

.wave-logo-reveal img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
    animation: elegantSpin 12s linear infinite;
}

@keyframes logoReveal {
    0% { opacity: 0; transform: scale(0.5) rotate(-180deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes elegantSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.wave-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-style: italic;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

.footer-logos {
    margin-bottom: 1rem;
}

.footer-logo-sunai {
    max-width: 180px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    transition: transform var(--transition-normal);
}

.footer-logo-sunai:hover {
    transform: scale(1.05);
}

.footer-developer {
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

.footer-developer strong {
    color: var(--accent-light);
    font-weight: 600;
}

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

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-in {
    animation: slideIn 0.4s ease forwards;
}

@keyframes markerAppear {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.marker-appear {
    animation: markerAppear 0.4s ease forwards;
}

/* ============================ */
/* RESPONSIVE — Mobile Layout   */
/* ============================ */

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "map"
            "info"
            "stats";
        gap: 1.5rem;
    }

    .info-panel {
        position: static;
        min-height: auto;
    }

    .stats-panel-grid {
        grid-template-columns: 1fr;
    }

    .legend-grid {
        grid-template-columns: 1fr;
    }

    .header-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

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

    .header h1 {
        font-size: 1.15rem;
    }

    .header .subtitle-secondary {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 0.5rem;
    }

    .header-logo {
        max-width: 100px;
    }

    .header h1 {
        font-size: 1rem;
    }

    .header .subtitle {
        font-size: 0.8rem;
    }

    .header .subtitle-secondary {
        font-size: 0.75rem;
        gap: 0.3rem 0.8rem;
    }

    .map-container {
        padding: 1rem;
    }

    .stats-panel-container {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .main-container {
        padding: 1rem 0.5rem;
        gap: 1rem;
    }

    .region-marker {
        width: 22px;
        height: 22px;
    }

    .marker-pin::before {
        width: 14px;
        height: 14px;
    }

    .marker-label {
        font-size: 0.6rem;
        padding: 1px 5px;
    }

    .map-title {
        font-size: 0.9rem;
    }

    .coat-of-arms {
        width: 80px;
        height: 96px;
    }

    .wave-logo-reveal img {
        width: 55px;
        height: 55px;
    }

    .footer-logo-sunai {
        max-width: 140px;
    }

    .legend-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

::selection {
    background: rgba(46, 139, 192, 0.3);
    color: var(--text-primary);
}

/* =========================================================
   PREMIUM DASHBOARD UI — Glass / Aurora / Data Atmosphere
   ========================================================= */
:root{
    --glass-bg: rgba(18, 28, 49, .68);
    --glass-bg-strong: rgba(20, 31, 54, .84);
    --glass-border: rgba(255,255,255,.10);
    --glass-highlight: rgba(255,255,255,.07);
    --aurora-blue: #2e8bc0;
    --aurora-yellow: #f4c430;
    --aurora-green: #2e8b5b;
    --premium-shadow: 0 24px 70px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.055);
}

html { scroll-behavior: smooth; }

body{
    background:
        radial-gradient(circle at 12% 8%, rgba(46,139,192,.14), transparent 28%),
        radial-gradient(circle at 88% 12%, rgba(244,196,48,.10), transparent 25%),
        radial-gradient(circle at 70% 88%, rgba(46,139,91,.10), transparent 28%),
        #08111f;
}

body::after{
    content:"";
    position:fixed;
    inset:0;
    z-index:-1;
    pointer-events:none;
    opacity:.32;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,.17) 1px, transparent 1.4px),
        linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
    background-size: 42px 42px, 84px 84px, 84px 84px;
    mask-image: radial-gradient(ellipse at center, black 20%, transparent 90%);
    animation: atmosphereDrift 26s linear infinite;
}
@keyframes atmosphereDrift{
    from{transform:translate3d(0,0,0)}
    50%{transform:translate3d(12px,-8px,0)}
    to{transform:translate3d(0,0,0)}
}

.header{
    background:rgba(7,15,28,.72);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border-bottom:1px solid var(--glass-border);
    box-shadow:0 12px 40px rgba(0,0,0,.16);
}
.header::before{
    content:"";
    position:absolute;
    inset:0;
    background:linear-gradient(110deg,transparent 15%,rgba(255,255,255,.045) 48%,transparent 75%);
    transform:translateX(-100%);
    animation:headerSheen 9s ease-in-out infinite;
}
@keyframes headerSheen{50%,100%{transform:translateX(100%)}}

.header .subtitle{
    color:#d8e8f5;
    max-width:1100px;
    font-size:.76rem;
    line-height:1.55;
    padding:.55rem .75rem;
    margin-top:.35rem;
    border:1px solid rgba(46,139,192,.20);
    border-radius:12px;
    background:linear-gradient(110deg,rgba(46,139,192,.10),rgba(244,196,48,.06),rgba(46,139,91,.08));
    box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}

.map-container,.info-panel,.stats-panel-container{
    background:linear-gradient(145deg,rgba(24,37,62,.78),rgba(12,21,37,.72));
    border:1px solid var(--glass-border);
    box-shadow:var(--premium-shadow);
    backdrop-filter:blur(22px) saturate(130%);
    -webkit-backdrop-filter:blur(22px) saturate(130%);
    position:relative;
    overflow:hidden;
}
.map-container::before,.info-panel::before,.stats-panel-container::before{
    content:"";
    position:absolute;
    inset:0;
    pointer-events:none;
    background:linear-gradient(135deg,rgba(255,255,255,.055),transparent 32%,transparent 70%,rgba(46,139,192,.035));
}
.map-container::after,.info-panel::after{
    content:"";
    position:absolute;
    width:220px;height:220px;
    right:-120px;top:-120px;
    border-radius:50%;
    background:radial-gradient(circle,rgba(46,139,192,.14),transparent 68%);
    pointer-events:none;
    animation:ambientPulse 7s ease-in-out infinite;
}
@keyframes ambientPulse{50%{transform:scale(1.18);opacity:.65}}

.map-title{
    position:relative;
    z-index:1;
    letter-spacing:.01em;
}
.stat-card{
    background:linear-gradient(135deg,rgba(46,139,192,.12),rgba(244,196,48,.045) 52%,rgba(46,139,91,.08));
    border-color:rgba(255,255,255,.08);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}
.stat-card:hover{
    transform:translateY(-4px);
    border-color:rgba(255,255,255,.16);
    box-shadow:0 16px 35px rgba(0,0,0,.22),0 0 26px rgba(46,139,192,.10);
}

.detail-info{
    position:relative;
    overflow:hidden;
    background:linear-gradient(145deg,rgba(10,19,34,.72),rgba(22,34,52,.48));
    border-color:rgba(255,255,255,.09);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.035);
}
.detail-info::before{
    content:"";
    position:absolute;
    top:0;left:8%;right:8%;height:1px;
    background:linear-gradient(90deg,transparent,var(--aurora-blue),var(--aurora-yellow),var(--aurora-green),transparent);
    filter:blur(.2px);
    opacity:.9;
}
.detail-info h3{
    background:linear-gradient(90deg,var(--aurora-blue),#fff,var(--aurora-yellow),var(--aurora-green));
    background-size:220% auto;
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    animation:gradientFlow 6s linear infinite;
}
@keyframes gradientFlow{to{background-position:220% center}}

.detail-row{
    position:relative;
    transition:transform .35s cubic-bezier(.2,.8,.2,1),background .35s ease,padding .35s ease;
    border-bottom-color:rgba(255,255,255,.055);
}
.detail-row::after{
    content:"";
    position:absolute;
    left:0;bottom:-1px;width:0;height:1px;
    background:linear-gradient(90deg,var(--aurora-blue),var(--aurora-yellow),var(--aurora-green));
    transition:width .45s ease;
}
.detail-row:hover{
    transform:translateX(5px);
    padding-left:.45rem;
    background:linear-gradient(90deg,rgba(46,139,192,.07),transparent);
}
.detail-row:hover::after{width:100%}
.detail-row .value.highlight{
    background:linear-gradient(90deg,var(--aurora-blue),var(--aurora-yellow),var(--aurora-green));
    background-size:180% 100%;
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    animation:gradientFlow 5s linear infinite;
}

/* Reworked data animation: soft premium signal instead of a heavy loading bar */
.premium-data-animation{
    position:relative;
    padding:1.1rem 0 .25rem;
}
.wave-animation-wrapper{
    border-top:1px solid rgba(255,255,255,.07);
}
.wave-label{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:.45rem;
    color:#b9cada;
    font-style:normal;
    letter-spacing:.02em;
}
.live-dot{
    width:7px;height:7px;border-radius:50%;
    background:var(--aurora-green);
    box-shadow:0 0 0 0 rgba(46,139,91,.55);
    animation:livePulse 2s infinite;
}
@keyframes livePulse{70%{box-shadow:0 0 0 8px rgba(46,139,91,0)}100%{box-shadow:0 0 0 0 rgba(46,139,91,0)}}

.wave-bar-container{
    height:30px;
    margin: .7rem 0 .45rem;
    border:1px solid rgba(255,255,255,.08);
    background:rgba(255,255,255,.025);
    box-shadow:inset 0 1px 5px rgba(0,0,0,.25),0 0 24px rgba(46,139,192,.06);
}
.wave-bar{
    width:100%;
    animation:signalReveal 1.4s cubic-bezier(.2,.8,.2,1) forwards;
}
.wave-stripe{
    background:linear-gradient(90deg,var(--aurora-blue),#63b5e6 30%,var(--aurora-yellow) 55%,var(--aurora-green) 82%,var(--aurora-blue));
    background-size:220% 100%;
    opacity:.95;
    animation:gradientFlow 4s linear infinite;
}
.wave-glow{
    background:linear-gradient(90deg,transparent,rgba(255,255,255,.32),transparent);
    animation:waveShine 2.4s ease-in-out infinite;
}
@keyframes signalReveal{
    from{width:0%;filter:blur(3px)}
    to{width:100%;filter:blur(0)}
}
.data-orb{
    position:absolute;
    top:50%;
    width:5px;height:5px;
    border-radius:50%;
    transform:translateY(-50%);
    background:#fff;
    box-shadow:0 0 12px currentColor,0 0 25px currentColor;
    z-index:2;
}
.orb-blue{color:var(--aurora-blue);left:23%;animation:orbFloat 3s ease-in-out infinite}
.orb-yellow{color:var(--aurora-yellow);left:56%;animation:orbFloat 3s ease-in-out .7s infinite}
.orb-green{color:var(--aurora-green);left:81%;animation:orbFloat 3s ease-in-out 1.2s infinite}
@keyframes orbFloat{50%{transform:translateY(-50%) scale(1.7);opacity:.65}}

.wave-meta{
    display:flex;
    justify-content:space-between;
    padding:0 .15rem;
    color:#667b91;
    font-size:.58rem;
    letter-spacing:.11em;
}
.wave-logo-reveal{
    margin-top:.55rem;
    animation:logoReveal .7s cubic-bezier(.2,.8,.2,1) .9s forwards;
}
.wave-logo-reveal img{
    width:48px;height:48px;
    animation:elegantSpin 18s linear infinite;
    filter:drop-shadow(0 0 14px rgba(46,139,192,.18));
}

.footer{
    background:rgba(6,13,24,.45);
    backdrop-filter:blur(18px);
    -webkit-backdrop-filter:blur(18px);
    border-top-color:rgba(255,255,255,.08);
    position:relative;
}
.footer::before{
    content:"";
    position:absolute;
    top:-1px;left:15%;right:15%;height:1px;
    background:linear-gradient(90deg,transparent,var(--aurora-blue),var(--aurora-yellow),var(--aurora-green),transparent);
    opacity:.65;
}

@media (max-width: 1024px){
    .header .subtitle{max-width:none;text-align:left}
}
@media (max-width: 640px){
    .header .subtitle{font-size:.7rem;line-height:1.45;text-align:left}
    .wave-meta{font-size:.5rem}
}
@media (prefers-reduced-motion: reduce){
    *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}
}

/* =========================================================
   PREMIUM THEME SWITCH — DARK / LIGHT GLASS DASHBOARD
   ========================================================= */
.theme-switch-wrap {
    position: fixed;
    left: 1.15rem;
    bottom: 1.15rem;
    top: auto;
    right: auto;
    transform: none;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .42rem .55rem;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    background: rgba(255,255,255,.055);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow: 0 10px 30px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.08);
}
.theme-label { opacity: .72; font-size: .88rem; line-height: 1; }
.theme-label-light { color: var(--accent-light); }
.theme-label-dark { color: var(--primary-light); }
.theme-switch { display: inline-flex; cursor: pointer; }
.theme-switch input { position: absolute; opacity: 0; pointer-events: none; }
.theme-switch-track {
    width: 48px;
    height: 27px;
    border-radius: 999px;
    padding: 3px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(46,139,192,.75), rgba(26,95,122,.85));
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: inset 0 1px 2px rgba(0,0,0,.25), 0 4px 14px rgba(46,139,192,.2);
    transition: background .45s ease, box-shadow .45s ease;
}
.theme-switch-thumb {
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: rgba(255,255,255,.96);
    box-shadow: 0 2px 7px rgba(0,0,0,.28), 0 0 12px rgba(255,255,255,.28);
    transform: translateX(0);
    transition: transform .45s cubic-bezier(.22,1,.36,1), background .45s ease;
}
.theme-switch input:checked + .theme-switch-track {
    background: linear-gradient(135deg, #f4b800, #2e8b2e 58%, #1e4fa0);
    box-shadow: inset 0 1px 2px rgba(0,0,0,.16), 0 4px 18px rgba(244,184,0,.22);
}
.theme-switch input:checked + .theme-switch-track .theme-switch-thumb {
    transform: translateX(21px);
    background: #fffdf4;
}
.theme-switch input:focus-visible + .theme-switch-track {
    outline: 2px solid var(--accent-light);
    outline-offset: 3px;
}
.theme-switch-text {
    min-width: 42px;
    color: var(--text-secondary);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
}

/* Light premium glass theme */
body.light-theme {
    --bg-dark: #eef5f8;
    --bg-card: rgba(255,255,255,.68);
    --bg-panel: rgba(255,255,255,.76);
    --text-primary: #17253a;
    --text-secondary: #50647a;
    --text-muted: #74879a;
    --border-color: rgba(62,88,110,.16);
    --primary-color: #1e4fa0;
    --primary-light: #2e8bc0;
    --primary-dark: #163b72;
    --accent-color: #e5aa16;
    --accent-light: #d29600;
    --shadow-sm: 0 2px 8px rgba(28,55,80,.07);
    --shadow-md: 0 10px 30px rgba(28,55,80,.10);
    --shadow-lg: 0 20px 55px rgba(28,55,80,.13);
}
body.light-theme {
    background:
        radial-gradient(circle at 8% 12%, rgba(46,139,192,.12), transparent 30%),
        radial-gradient(circle at 92% 18%, rgba(244,184,0,.12), transparent 28%),
        radial-gradient(circle at 50% 92%, rgba(46,139,46,.09), transparent 32%),
        #eef5f8;
    color: var(--text-primary);
}
body.light-theme::before {
    opacity: .72;
    background-image:
        radial-gradient(circle at 15% 25%, rgba(30,79,160,.12) 0 1px, transparent 1.5px),
        radial-gradient(circle at 70% 55%, rgba(46,139,46,.10) 0 1px, transparent 1.5px),
        radial-gradient(circle at 35% 78%, rgba(244,184,0,.10) 0 1px, transparent 1.5px);
    background-size: 42px 42px, 58px 58px, 74px 74px;
}
body.light-theme .header {
    background: rgba(247,251,253,.76);
    border-bottom-color: rgba(52,78,98,.14);
    box-shadow: 0 8px 30px rgba(30,65,90,.06);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
}
body.light-theme .header::after {
    background: linear-gradient(90deg, transparent, #1e4fa0, #f4b800, #2e8b2e, transparent);
}
body.light-theme .header h1 {
    background: linear-gradient(135deg, #163b72 0%, #1e4fa0 45%, #d29600 72%, #2e8b2e 100%);
    -webkit-background-clip: text;
    background-clip: text;
}
body.light-theme .header .subtitle { color: #a36f00; }
body.light-theme .theme-switch-wrap {
    background: rgba(255,255,255,.58);
    border-color: rgba(52,78,98,.13);
    box-shadow: 0 10px 28px rgba(30,65,90,.10), inset 0 1px 0 rgba(255,255,255,.8);
}
body.light-theme .map-container,
body.light-theme .info-panel,
body.light-theme .stats-panel-container {
    background: rgba(255,255,255,.66);
    border-color: rgba(62,88,110,.14);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
}
body.light-theme .map-wrapper {
    box-shadow: 0 12px 35px rgba(29,64,91,.14);
}
body.light-theme .footer {
    background: rgba(245,250,252,.72);
    border-top-color: rgba(62,88,110,.14);
    color: var(--text-secondary);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
body.light-theme .tooltip {
    background: rgba(255,255,255,.88);
    color: var(--text-primary);
    border-color: rgba(62,88,110,.16);
    box-shadow: 0 18px 45px rgba(24,53,74,.18);
}

/* Subtle animated glass atmosphere */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    opacity: .34;
    background-image:
        radial-gradient(circle, rgba(255,255,255,.16) 0 1px, transparent 1.4px),
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 74px 74px, 74px 74px, 74px 74px;
    animation: ambientDrift 28s linear infinite;
}
@keyframes ambientDrift {
    from { transform: translate3d(0,0,0); }
    to { transform: translate3d(74px,37px,0); }
}

@media (max-width: 900px) {
    .theme-switch-wrap { left: .75rem; bottom: .75rem; top: auto; right: auto; transform: none; }
}
@media (max-width: 520px) {
    .theme-switch-text { display: none; }
    .theme-switch-wrap { padding: .38rem .45rem; }
}
@media (prefers-reduced-motion: reduce) {
    body::after { animation: none; }
    .theme-switch-thumb, .theme-switch-track { transition: none; }
}


/* =========================================================
   LIGHT THEME — FULL COMPONENT HARMONIZATION
   Purpose: every dashboard surface, animation, text and
   interactive state remains readable and elegant in light mode.
   ========================================================= */
body.light-theme {
    --light-ink: #18304a;
    --light-ink-soft: #4d647a;
    --light-muted: #71859a;
    --light-line: rgba(38, 72, 101, .14);
    --light-glass: rgba(255,255,255,.72);
    --light-glass-strong: rgba(255,255,255,.84);
    --light-blue: #1e5aa8;
    --light-blue-2: #2f8fc4;
    --light-yellow: #c58b00;
    --light-green: #247b4b;
    --light-shadow: 0 18px 45px rgba(30,64,91,.11), inset 0 1px 0 rgba(255,255,255,.9);
}

body.light-theme::before {
    background:
      radial-gradient(circle at 8% 8%, rgba(47,143,196,.13), transparent 27%),
      radial-gradient(circle at 91% 18%, rgba(197,139,0,.10), transparent 25%),
      radial-gradient(circle at 72% 88%, rgba(36,123,75,.10), transparent 28%);
}
body.light-theme::after {
    opacity: .30;
    background-image:
      radial-gradient(circle at 1px 1px, rgba(30,90,168,.12) 1px, transparent 1.5px),
      linear-gradient(rgba(30,90,168,.018) 1px, transparent 1px),
      linear-gradient(90deg, rgba(30,90,168,.018) 1px, transparent 1px);
}

body.light-theme .header {
    background: rgba(248,252,254,.78);
    color: var(--light-ink);
}
body.light-theme .header::before {
    opacity: .45;
    background: linear-gradient(110deg, transparent 15%, rgba(47,143,196,.08) 42%, rgba(197,139,0,.07) 60%, transparent 82%);
}
body.light-theme .header .subtitle { color: var(--light-yellow); }
body.light-theme .header .subtitle-secondary { color: var(--light-ink-soft); }
body.light-theme .header .subtitle-secondary strong { color: var(--light-yellow); }

body.light-theme .map-container,
body.light-theme .info-panel,
body.light-theme .stats-panel-container {
    background: linear-gradient(145deg, rgba(255,255,255,.78), rgba(246,250,252,.68));
    border-color: var(--light-line);
    box-shadow: var(--light-shadow);
}
body.light-theme .map-container::before,
body.light-theme .info-panel::before,
body.light-theme .stats-panel-container::before {
    opacity: .75;
    background: linear-gradient(135deg, rgba(47,143,196,.055), transparent 42%, rgba(36,123,75,.035));
}
body.light-theme .map-container::after,
body.light-theme .info-panel::after {
    opacity: .45;
    background: radial-gradient(circle, rgba(47,143,196,.07), transparent 68%);
}
body.light-theme .map-title { color: var(--light-ink); }
body.light-theme .map-title::after {
    background: linear-gradient(90deg, transparent, var(--light-blue-2), var(--light-yellow), var(--light-green), transparent);
}
body.light-theme .map-wrapper {
    background: rgba(238,245,248,.74);
    border-color: rgba(45,82,111,.13);
    box-shadow: 0 14px 35px rgba(31,63,87,.13), inset 0 1px 0 rgba(255,255,255,.8);
}

/* Legend */
body.light-theme .map-legend-full,
body.light-theme .legend-item {
    color: var(--light-ink-soft);
}
body.light-theme .map-legend-full {
    background: rgba(247,251,253,.66);
    border-color: var(--light-line);
}
body.light-theme .map-legend-full h4 { color: var(--light-blue); }
body.light-theme .legend-item { border-color: rgba(38,72,101,.09); }
body.light-theme .legend-item strong { color: var(--light-ink); }
body.light-theme .legend-icon { filter: saturate(.9); }

/* Information panel */
body.light-theme .info-panel-header { border-bottom-color: var(--light-line); }
body.light-theme .info-panel-header h2 { color: var(--light-ink); }
body.light-theme .info-panel-header .region-name {
    background: linear-gradient(135deg, var(--light-blue), var(--light-yellow) 58%, var(--light-green));
    -webkit-background-clip: text;
    background-clip: text;
}
body.light-theme .instruction { color: var(--light-ink-soft); }
body.light-theme .coat-of-arms { filter: drop-shadow(0 5px 12px rgba(26,63,88,.18)); }

/* Stat cards */
body.light-theme .stat-card {
    background: linear-gradient(145deg, rgba(240,248,252,.88), rgba(255,255,255,.62));
    border-color: rgba(47,143,196,.17);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
body.light-theme .stat-card:hover {
    border-color: rgba(47,143,196,.32);
    box-shadow: 0 12px 28px rgba(32,76,104,.10), inset 0 1px 0 rgba(255,255,255,.9);
}
body.light-theme .stat-card .stat-value { color: var(--light-ink); }
body.light-theme .stat-card .stat-label { color: var(--light-muted); }

/* Detail section */
body.light-theme .detail-info {
    background: linear-gradient(145deg, rgba(248,251,253,.86), rgba(238,246,249,.72));
    border-color: var(--light-line);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
body.light-theme .detail-info::before {
    background: linear-gradient(90deg, var(--light-blue-2), var(--light-yellow), var(--light-green));
}
body.light-theme .detail-info h3 {
    background: linear-gradient(90deg, var(--light-blue), var(--light-yellow), var(--light-green));
    -webkit-background-clip: text;
    background-clip: text;
}
body.light-theme .detail-row {
    border-bottom-color: rgba(38,72,101,.09);
}
body.light-theme .detail-row:hover {
    background: linear-gradient(90deg, rgba(47,143,196,.08), rgba(255,255,255,.12), transparent);
}
body.light-theme .detail-row .label { color: var(--light-ink-soft); }
body.light-theme .detail-row .value { color: var(--light-ink); }
body.light-theme .detail-row .value.highlight {
    background: linear-gradient(90deg, var(--light-blue), var(--light-yellow), var(--light-green));
    -webkit-background-clip: text;
    background-clip: text;
}

/* Animated data signal */
body.light-theme .wave-animation-wrapper { border-top-color: rgba(38,72,101,.10); }
body.light-theme .wave-label { color: var(--light-ink-soft); }
body.light-theme .wave-bar-container {
    background: linear-gradient(180deg, rgba(225,237,243,.76), rgba(248,251,253,.82));
    border-color: rgba(38,72,101,.13);
    box-shadow: inset 0 1px 5px rgba(32,66,88,.08), 0 8px 22px rgba(32,76,104,.07);
}
body.light-theme .wave-stripe {
    background: linear-gradient(90deg, var(--light-blue-2), #64b6d9 30%, var(--light-yellow) 55%, var(--light-green) 82%, var(--light-blue-2));
    background-size: 220% 100%;
    opacity: .92;
}
body.light-theme .wave-glow {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
}
body.light-theme .wave-meta { color: #6b8295; }
body.light-theme .live-dot {
    background: var(--light-green);
    box-shadow: 0 0 0 0 rgba(36,123,75,.35);
}
body.light-theme .orb-blue { color: var(--light-blue-2); }
body.light-theme .orb-yellow { color: var(--light-yellow); }
body.light-theme .orb-green { color: var(--light-green); }
body.light-theme .wave-logo-reveal img { filter: drop-shadow(0 5px 14px rgba(31,78,105,.15)); }

/* Bottom statistics */
body.light-theme .stats-panel-container h3 { color: var(--light-blue); }
body.light-theme .stats-panel-item {
    background: rgba(248,251,253,.74);
    border-color: rgba(38,72,101,.11);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
body.light-theme .stats-panel-item .sp-label span:first-child { color: var(--light-ink-soft); }
body.light-theme .stats-panel-item .sp-label span:last-child { color: var(--light-yellow); }
body.light-theme .stats-panel-item .sp-bar {
    background: rgba(82,111,132,.13);
}
body.light-theme .stats-panel-placeholder { color: var(--light-muted); }

/* Tooltip and scrollbar */
body.light-theme .tooltip {
    background: rgba(255,255,255,.94);
    color: var(--light-ink);
    border-color: rgba(38,72,101,.14);
    box-shadow: 0 18px 42px rgba(25,58,80,.16), inset 0 1px 0 rgba(255,255,255,.9);
    backdrop-filter: blur(18px) saturate(135%);
}
body.light-theme .tooltip .tooltip-title { color: var(--light-blue); }
body.light-theme .tooltip .tooltip-data { color: var(--light-ink-soft); }
body.light-theme .tooltip .tooltip-data strong { color: var(--light-ink); }
body.light-theme ::-webkit-scrollbar-track { background: #eaf1f4; }
body.light-theme ::-webkit-scrollbar-thumb { background: #b6c7d2; }
body.light-theme ::-webkit-scrollbar-thumb:hover { background: var(--light-blue-2); }
body.light-theme ::selection { background: rgba(47,143,196,.20); color: var(--light-ink); }

/* Floating theme control — integrated with the light glass surface */
.theme-switch-wrap {
    transition: background .45s ease, border-color .45s ease, box-shadow .45s ease, transform .3s ease;
}
.theme-switch-wrap:hover { transform: translateY(-2px); }
body.light-theme .theme-switch-wrap {
    background: rgba(255,255,255,.78);
    border-color: rgba(38,72,101,.14);
    box-shadow: 0 14px 34px rgba(29,66,90,.13), inset 0 1px 0 rgba(255,255,255,.95);
}
body.light-theme .theme-switch-text { color: var(--light-ink-soft); }
body.light-theme .theme-label-dark { color: var(--light-blue); }
body.light-theme .theme-label-light { color: var(--light-yellow); }

/* Keep the switch above all dashboard layers without obstructing content */
.theme-switch-wrap { z-index: 1000; }
@media (max-width: 520px) {
    .theme-switch-wrap { left: .65rem; bottom: .65rem; padding: .38rem .45rem; }
}


/* =========================================================
   LANGUAGE + THEME CONTROL STACK
   Premium floating controls, bottom-left placement.
   ========================================================= */
.control-stack {
    position: fixed;
    left: 1.15rem;
    bottom: 1.15rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .42rem;
    width: max-content;
}
.control-stack .theme-switch-wrap {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    box-sizing: border-box;
}
.control-stack .theme-switch-wrap:hover { transform: translateY(-2px); }
.language-switch {
    appearance: none;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    width: 64px;
    height: 40px;
    padding: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(255,255,255,.055);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
    box-shadow: 0 10px 30px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.1);
    transition: transform .3s ease, background .45s ease, border-color .45s ease, box-shadow .45s ease;
}
.language-switch:hover { transform: translateY(-2px) scale(1.025); }
.language-switch:active { transform: translateY(0) scale(.98); }
.language-switch:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 3px;
}
.language-flag {
    display: block;
    width: 54px;
    height: 32px;
    border-radius: 999px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 3px 10px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.38);
    position: relative;
    overflow: hidden;
}
.language-flag::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(120deg, rgba(255,255,255,.26), transparent 42%, rgba(255,255,255,.08));
    pointer-events: none;
}
body.light-theme .language-switch {
    background: rgba(255,255,255,.72);
    border-color: rgba(38,72,101,.16);
    box-shadow: 0 14px 34px rgba(29,66,90,.13), inset 0 1px 0 rgba(255,255,255,.96);
}
body.light-theme .language-flag {
    box-shadow: 0 4px 12px rgba(29,66,90,.16), inset 0 1px 0 rgba(255,255,255,.55);
}
@media (max-width: 900px) {
    .control-stack { left: .75rem; bottom: .75rem; }
}
@media (max-width: 520px) {
    .control-stack { left: .65rem; bottom: .65rem; gap: .35rem; }
    .language-switch { width: 58px; height: 36px; padding: 3px; }
    .control-stack .theme-switch-wrap { padding: .38rem .45rem; }
}

/* Relocated data-source note: sits beneath the Bulgaria total-share section. */
.data-source-note {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255,255,255,.045), rgba(92,164,255,.035), rgba(255,196,62,.025));
    color: var(--text-secondary, #aeb9ca);
    font-size: .78rem;
    line-height: 1.55;
    letter-spacing: .01em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.045);
}

body.light-theme .data-source-note {
    border-color: rgba(45,77,110,.13);
    background: linear-gradient(135deg, rgba(255,255,255,.88), rgba(231,243,255,.72), rgba(255,247,218,.62));
    color: var(--light-ink-soft, #516273);
    box-shadow: 0 8px 24px rgba(48,78,112,.07), inset 0 1px 0 rgba(255,255,255,.95);
}

@media (max-width: 640px) {
    .data-source-note {
        margin-top: 14px;
        padding: 12px 13px;
        font-size: .7rem;
        line-height: 1.5;
        border-radius: 13px;
    }
}

/* 2025 statistics download card */
.download-section {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(59,130,246,.08), rgba(34,197,94,.07), rgba(250,204,21,.07));
    box-shadow: 0 10px 30px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.16);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.download-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 1.45rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(59,130,246,.18), rgba(34,197,94,.16));
    border: 1px solid rgba(59,130,246,.24);
    color: var(--text-primary);
}
.download-copy h4 { margin: 0 0 .25rem; font-size: 1rem; color: var(--text-primary); }
.download-copy p { margin: 0; font-size: .82rem; line-height: 1.45; color: var(--text-secondary); }
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem .9rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: .82rem;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #16a34a);
    box-shadow: 0 8px 22px rgba(37,99,235,.22);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
    white-space: nowrap;
}
.download-button:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(37,99,235,.28); filter: saturate(1.08); }
.download-button:active { transform: translateY(0); }
.stats-year { font-weight: 800; letter-spacing: .02em; color: var(--text-primary); }
body.light-theme .download-section { box-shadow: 0 12px 30px rgba(15,23,42,.07), inset 0 1px 0 rgba(255,255,255,.8); }
@media (max-width: 700px) {
    .download-section { grid-template-columns: auto 1fr; }
    .download-button { grid-column: 1 / -1; width: 100%; }
    .download-copy p { font-size: .78rem; }
}

/* Light theme: keep the city/region pin label readable on its dark badge. */
body.light-theme .marker-label {
    background: rgba(15, 23, 42, 0.94);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.18);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
