﻿html,
body,
form {
    height: 100%;
    margin: 0;
}

.election-map-body {
    background: #f5f7fb;
    color: #1f2937;
    overflow: hidden;
}

/* Header */

.btv-map-header {
    height: 72px;
    background: linear-gradient(135deg, #003f6b 0%, #005f8f 100%);
    color: #fff;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1100;
}

.btv-logo-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.btv-app-title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.1;
}

.btv-app-subtitle {
    font-size: .85rem;
    opacity: .85;
}

/* Main shell */

.btv-map-main {
    height: calc(100vh - 100px);
    position: relative;
    overflow: hidden;
}

.btv-map-footer {
    height: 28px;
    background: #fff;
    border-top: 1px solid #dee2e6;
    color: #6b7280;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    position: relative;
    z-index: 1100;
}

/* App layout */

.election-map-layout {
    height: 100%;
    display: flex;
    position: relative;
}

.election-sidebar {
    width: 380px;
    max-width: 380px;
    background: #fff;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    z-index: 1000;
}

.election-sidebar-inner {
    padding: 1rem;
}

.election-map-canvas {
    flex: 1;
    height: 100%;
    min-width: 0;
}

#map {
    width: 100%;
    height: 100%;
}

/* Cards / panels */

.election-panel-card {
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
}

.election-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: #003f6b;
}

.election-panel-help {
    font-size: .875rem;
    color: #6b7280;
}

.election-result-card {
    border-radius: .9rem;
    border: 1px solid #dbeafe;
    background: #f8fbff;
    padding: 1rem;
}

.election-result-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    font-weight: 700;
}

.election-result-value {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.election-muted {
    color: #6b7280;
    font-size: .875rem;
}

/* Search */

.election-search-box {
    position: relative;
}

    .election-search-box .form-control {
        padding-right: 2.5rem;
    }

.election-search-icon {
    position: absolute;
    top: 50%;
    right: .9rem;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
}

.election-search-results {
    margin-top: .5rem;
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
    background: #fff;
    overflow: hidden;
    display: none;
}

    .election-search-results.show {
        display: block;
    }

.election-search-result {
    padding: .65rem .85rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: .9rem;
}

    .election-search-result:hover,
    .election-search-result:focus {
        background: #f1f5f9;
    }

    .election-search-result:last-child {
        border-bottom: 0;
    }

/* Layer controls */

.election-layer-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem 0;
    border-bottom: 1px solid #f1f5f9;
}

    .election-layer-toggle:last-child {
        border-bottom: 0;
    }

.election-layer-name {
    font-weight: 600;
    font-size: .9rem;
}

.election-layer-description {
    font-size: .78rem;
    color: #6b7280;
}

/* Leaflet polish */

.leaflet-container {
    font-family: inherit;
    background: #e5edf5;
}

.leaflet-control-container .leaflet-top {
    top: .75rem;
}

.leaflet-control-container .leaflet-left {
    left: .75rem;
}

.leaflet-popup-content-wrapper {
    border-radius: .85rem;
}

.leaflet-popup-content {
    margin: .85rem 1rem;
}

.leaflet-control-zoom {
    border: 0 !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .15) !important;
}

    .leaflet-control-zoom a {
        border: 0 !important;
    }

/* Mobile */

@media (max-width: 768px) {
    .btv-map-header {
        height: 64px;
    }

    .btv-logo-mark {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        font-size: 1rem;
    }

    .btv-app-title {
        font-size: 1rem;
    }

    .btv-app-subtitle {
        font-size: .75rem;
    }

    .btv-map-main {
        height: calc(100vh - 92px);
    }

    .btv-map-footer {
        height: 28px;
        font-size: .7rem;
        padding: 0 .5rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .election-map-layout {
        display: block;
    }

    .election-map-canvas,
    #map {
        height: 100%;
    }

    .election-sidebar {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        max-height: 48%;
        border-right: 0;
        border-top: 1px solid #dee2e6;
        border-top-left-radius: 1.25rem;
        border-top-right-radius: 1.25rem;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, .18);
        z-index: 1050;
    }

    .election-sidebar-inner {
        padding: 1rem;
    }

    .leaflet-control-container .leaflet-top {
        top: .5rem;
    }

    .leaflet-control-container .leaflet-left {
        left: .5rem;
    }
}
