/**
 * Support Our School - Frontend Map Styles v1.2.0
 * Mobile-first, Google Maps inspired controls, glassmorphism
 */

/* ============================================
   ROOT WRAPPER
   ============================================ */
.sos-map-wrapper {
    --sos-primary: #FFE600;
    --sos-secondary: #0A1F44;
    --sos-white: #ffffff;
    --sos-text-dark: #1a1a2e;
    --sos-text-muted: #6b7280;
    --sos-shadow-sm: 0 2px 8px rgba(10, 31, 68, 0.08);
    --sos-shadow-md: 0 6px 20px rgba(10, 31, 68, 0.12);
    --sos-shadow-lg: 0 15px 40px rgba(10, 31, 68, 0.18);
    --sos-radius-sm: 8px;
    --sos-radius-md: 12px;
    --sos-radius-lg: 20px;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--sos-primary) 0%, #FFD700 100%);
    color: var(--sos-secondary);
    padding: 32px 24px;
    border-radius: var(--sos-radius-lg);
    margin: 24px auto;
    max-width: 1400px;
    box-sizing: border-box;
    box-shadow: var(--sos-shadow-lg);
    position: relative;
    overflow: hidden;
}

.sos-map-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(10, 31, 68, 0.05) 0%, transparent 70%);
    pointer-events: none;
    border-radius: 50%;
}

.sos-map-wrapper *,
.sos-map-wrapper *::before,
.sos-map-wrapper *::after {
    box-sizing: border-box;
}

/* ============================================
   HEADER
   ============================================ */
.sos-map-wrapper .sos-header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.sos-map-wrapper .sos-title {
    font-size: clamp(20px, 3vw, 36px);
    font-weight: 900;
    color: var(--sos-secondary);
    margin: 0 0 10px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.sos-map-wrapper .sos-subtitle {
    color: var(--sos-secondary);
    opacity: 0.7;
    font-size: clamp(13px, 1.5vw, 16px);
    margin: 0;
    font-weight: 500;
    padding: 0 8px;
}

/* ============================================
   STATISTICS CARDS
   ============================================ */
.sos-map-wrapper .sos-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.sos-map-wrapper .sos-stat-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--sos-secondary);
    padding: 20px 16px;
    border-radius: var(--sos-radius-md);
    text-align: center;
    box-shadow: var(--sos-shadow-md);
    border: 1px solid rgba(255,255,255,0.5);
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sos-map-wrapper .sos-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--sos-secondary) 0%, #2a4080 100%);
}

.sos-map-wrapper .sos-stat-card:hover {
    transform: translateY(-3px);
}

.sos-map-wrapper .sos-stat-icon {
    font-size: 22px;
    margin-bottom: 6px;
}

.sos-map-wrapper .sos-stat-num {
    font-size: clamp(20px, 2.8vw, 32px);
    font-weight: 900;
    line-height: 1;
    margin-bottom: 4px;
    color: var(--sos-secondary);
    letter-spacing: -0.02em;
}

.sos-map-wrapper .sos-stat-label {
    font-size: 10px;
    color: var(--sos-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    line-height: 1.3;
}

/* ============================================
   CONTROLS (Filters + Search)
   ============================================ */
.sos-map-wrapper .sos-controls {
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.sos-map-wrapper .sos-mobile-filter-toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--sos-secondary);
    color: var(--sos-primary);
    border: none;
    padding: 12px 16px;
    border-radius: var(--sos-radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    box-shadow: var(--sos-shadow-md);
}

.sos-map-wrapper .sos-mobile-filter-toggle .sos-filter-count {
    background: var(--sos-primary);
    color: var(--sos-secondary);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 4px;
    min-width: 22px;
    text-align: center;
}

.sos-map-wrapper .sos-mobile-filter-toggle .sos-filter-count:empty {
    display: none;
}

.sos-map-wrapper .sos-controls-inner {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.sos-map-wrapper .sos-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 5px;
    border-radius: var(--sos-radius-md);
    border: 1px solid rgba(255,255,255,0.5);
}

.sos-map-wrapper .sos-filter-btn {
    background: transparent;
    color: var(--sos-secondary);
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.sos-map-wrapper .sos-filter-btn:hover {
    background: rgba(10, 31, 68, 0.08);
}

.sos-map-wrapper .sos-filter-active {
    background: var(--sos-secondary) !important;
    color: var(--sos-primary) !important;
    box-shadow: 0 3px 10px rgba(10, 31, 68, 0.3);
}

.sos-map-wrapper .sos-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

.sos-map-wrapper .sos-dot-completed { background: #16a34a; }
.sos-map-wrapper .sos-dot-ongoing { background: #eab308; }
.sos-map-wrapper .sos-dot-planned { background: #3b82f6; }

.sos-map-wrapper .sos-search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.sos-map-wrapper .sos-search-input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: var(--sos-radius-md);
    font-size: 14px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    outline: none;
    font-family: inherit;
    color: var(--sos-secondary);
    transition: all 0.2s ease;
    box-shadow: var(--sos-shadow-sm);
}

.sos-map-wrapper .sos-search-input:focus {
    background: white;
    box-shadow: 0 0 0 3px rgba(10, 31, 68, 0.15), var(--sos-shadow-md);
}

.sos-map-wrapper .sos-search-box::before {
    content: "🔍";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
    opacity: 0.6;
}

/* ============================================
   MAP AREA (with overlay controls)
   ============================================ */
.sos-map-wrapper .sos-map-area {
    position: relative;
    z-index: 1;
}

.sos-map-wrapper .sos-map-container {
    width: 100%;
    border-radius: var(--sos-radius-md);
    background: white;
    box-shadow: var(--sos-shadow-lg);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ============================================
   MAP CONTROL BUTTONS (Overlay on map)
   ============================================ */
.sos-map-wrapper .sos-map-controls {
    position: absolute;
    z-index: 10;
    display: flex;
    gap: 8px;
}

.sos-map-wrapper .sos-controls-top-right {
    top: 12px;
    right: 12px;
    flex-direction: column;
}

.sos-map-wrapper .sos-controls-right {
    right: 12px;
    bottom: 12px;
    flex-direction: column;
}

.sos-map-wrapper .sos-ctrl-group {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sos-map-wrapper .sos-ctrl-btn {
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    color: var(--sos-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.sos-map-wrapper .sos-ctrl-group .sos-ctrl-btn {
    border-radius: 0;
    box-shadow: none;
}

.sos-map-wrapper .sos-ctrl-btn:hover {
    background: #f5f5f5;
    color: #000;
}

.sos-map-wrapper .sos-ctrl-btn:active {
    background: #e5e5e5;
}

.sos-map-wrapper .sos-ctrl-btn svg {
    pointer-events: none;
}

.sos-map-wrapper .sos-ctrl-divider {
    height: 1px;
    background: #e5e5e5;
}

.sos-map-wrapper .sos-ctrl-locate.sos-locating {
    animation: sosPulse 1s ease-in-out infinite;
}

@keyframes sosPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   MAP TYPE PANEL (Google Maps style)
   ============================================ */
.sos-map-wrapper .sos-map-type-panel {
    position: absolute;
    top: 60px;
    right: 12px;
    width: 280px;
    background: white;
    border-radius: var(--sos-radius-md);
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transform-origin: top right;
    transition: all 0.25s ease;
    overflow: hidden;
}

.sos-map-wrapper .sos-map-type-panel.sos-panel-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.sos-map-wrapper .sos-map-type-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--sos-secondary);
    font-size: 15px;
}

.sos-map-wrapper .sos-panel-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.sos-map-wrapper .sos-panel-close:hover {
    background: #f5f5f5;
}

.sos-map-wrapper .sos-map-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
}

.sos-map-wrapper .sos-map-type-option {
    background: none;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 6px;
    border-radius: 10px;
    text-align: center;
    transition: all 0.2s ease;
    font-family: inherit;
}

.sos-map-wrapper .sos-map-type-option:hover {
    background: #f5f5f5;
}

.sos-map-wrapper .sos-map-type-option.sos-active {
    border-color: var(--sos-secondary);
    background: rgba(10, 31, 68, 0.05);
}

.sos-map-wrapper .sos-map-type-option.sos-active span {
    color: var(--sos-secondary);
    font-weight: 700;
}

.sos-map-wrapper .sos-map-type-preview {
    width: 100%;
    height: 70px;
    border-radius: 8px;
    margin-bottom: 6px;
    background-size: cover;
    background-position: center;
}

.sos-map-wrapper .sos-preview-default {
    background: linear-gradient(135deg, #d4e8d4 0%, #c2d8c4 100%);
    background-image:
        linear-gradient(45deg, transparent 25%, rgba(255,255,255,0.4) 25%, rgba(255,255,255,0.4) 50%, transparent 50%, transparent 75%, rgba(255,255,255,0.4) 75%),
        linear-gradient(135deg, #d4e8d4 0%, #c2d8c4 100%);
    background-size: 12px 12px, 100% 100%;
}

.sos-map-wrapper .sos-preview-satellite {
    background: linear-gradient(135deg, #5a6b3a 0%, #2d4525 100%);
    position: relative;
}
.sos-map-wrapper .sos-preview-satellite::before {
    content: '';
    position: absolute;
    inset: 30%;
    background: #1a3a5a;
    border-radius: 50% 30%;
    opacity: 0.5;
}

.sos-map-wrapper .sos-preview-terrain {
    background: linear-gradient(135deg, #d4c5a3 0%, #b8a075 100%);
    background-image: repeating-linear-gradient(60deg, transparent, transparent 4px, rgba(139,90,40,0.2) 4px, rgba(139,90,40,0.2) 5px);
}

.sos-map-wrapper .sos-preview-dark {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    background-image:
        linear-gradient(45deg, transparent 25%, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.1) 50%, transparent 50%, transparent 75%, rgba(255,255,255,0.1) 75%),
        linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    background-size: 12px 12px, 100% 100%;
}

.sos-map-wrapper .sos-map-type-option span {
    display: block;
    font-size: 12px;
    color: #555;
    font-weight: 600;
}

/* ============================================
   LEGEND (bottom-left, collapsible)
   ============================================ */
.sos-map-wrapper .sos-map-legend {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 10;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    max-width: calc(100% - 80px);
}

.sos-map-wrapper .sos-legend-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--sos-secondary);
    font-weight: 600;
    font-size: 12px;
    font-family: inherit;
    width: 100%;
    border-radius: 10px;
}

.sos-map-wrapper .sos-legend-content {
    padding: 0 14px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sos-map-wrapper .sos-legend-expanded .sos-legend-content {
    padding: 0 14px 12px;
    max-height: 200px;
}

.sos-map-wrapper .sos-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--sos-secondary);
    margin-top: 4px;
}

.sos-map-wrapper .sos-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 1.5px white, 0 1px 3px rgba(0,0,0,0.2);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.sos-map-wrapper .sos-no-schools {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 40px 20px;
    text-align: center;
    border-radius: var(--sos-radius-md);
    margin: 20px 0;
    border: 2px dashed rgba(10, 31, 68, 0.3);
    position: relative;
    z-index: 1;
}

.sos-map-wrapper .sos-no-schools p {
    color: var(--sos-secondary);
    font-size: 14px;
    margin: 0;
}

/* ============================================
   HELP TEXT
   ============================================ */
.sos-map-wrapper .sos-help-text {
    margin-top: 16px;
    padding: 14px 20px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--sos-radius-md);
    border-left: 4px solid var(--sos-secondary);
    font-size: 13px;
    color: var(--sos-secondary);
    box-shadow: var(--sos-shadow-sm);
    position: relative;
    z-index: 1;
}

.sos-map-wrapper .sos-help-text strong {
    display: inline-block;
    margin-right: 6px;
    font-weight: 700;
}

/* ============================================
   CUSTOM MARKERS
   ============================================ */
.sos-custom-marker {
    background: transparent !important;
    border: none !important;
}

.sos-custom-marker .sos-marker-inner {
    transform-origin: bottom center;
    transition: transform 0.3s ease;
    cursor: pointer;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    transform: scale(var(--sos-zoom-scale, 1));
}

.sos-custom-marker:hover .sos-marker-inner {
    transform: scale(calc(var(--sos-zoom-scale, 1) * 1.15)) translateY(-3px);
}

.sos-marker-animated .sos-marker-inner {
    animation: sosMarkerDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.sos-marker-animated:nth-child(1) .sos-marker-inner { animation-delay: 0.05s; }
.sos-marker-animated:nth-child(2) .sos-marker-inner { animation-delay: 0.1s; }
.sos-marker-animated:nth-child(3) .sos-marker-inner { animation-delay: 0.15s; }
.sos-marker-animated:nth-child(4) .sos-marker-inner { animation-delay: 0.2s; }
.sos-marker-animated:nth-child(5) .sos-marker-inner { animation-delay: 0.25s; }
.sos-marker-animated:nth-child(n+6) .sos-marker-inner { animation-delay: 0.3s; }

@keyframes sosMarkerDrop {
    0% { transform: translateY(-50px) scale(calc(var(--sos-zoom-scale, 1) * 0.5)); opacity: 0; }
    60% { transform: translateY(0) scale(calc(var(--sos-zoom-scale, 1) * 1.05)); opacity: 1; }
    100% { transform: translateY(0) scale(var(--sos-zoom-scale, 1)); opacity: 1; }
}

/* ============================================
   POPUP REDESIGN
   ============================================ */
.sos-map-wrapper .leaflet-popup-content-wrapper {
    border-radius: var(--sos-radius-md) !important;
    padding: 0 !important;
    overflow: hidden;
    box-shadow: var(--sos-shadow-lg) !important;
    border: none !important;
}

.sos-map-wrapper .leaflet-popup-content {
    margin: 0 !important;
    width: 300px !important;
}

.sos-school-popup {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: white;
    color: #1a1a2e;
    border-radius: var(--sos-radius-md);
    overflow: hidden;
}

.sos-school-popup .sos-popup-photo {
    width: 100%;
    height: 130px;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
}

.sos-school-popup .sos-popup-header {
    padding: 16px 18px 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.sos-school-popup .sos-popup-header::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    pointer-events: none;
}

.sos-school-popup .sos-popup-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    border: 1px solid rgba(255,255,255,0.3);
}

.sos-school-popup .sos-popup-status-icon {
    font-size: 12px;
}

.sos-school-popup .sos-popup-title {
    font-size: 17px;
    margin: 0 0 6px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.sos-school-popup .sos-popup-district {
    font-size: 12px;
    opacity: 0.92;
    font-weight: 500;
}

.sos-school-popup .sos-popup-body {
    padding: 16px 18px 18px;
}

.sos-school-popup .sos-popup-info {
    background: #f8f9fc;
    border-radius: 10px;
    padding: 11px 13px;
    margin-bottom: 12px;
    border-left: 3px solid var(--sos-status-color, #0A1F44);
}

.sos-school-popup .sos-popup-info-label {
    display: block;
    color: var(--sos-status-color, #0A1F44);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 800;
    margin-bottom: 4px;
}

.sos-school-popup .sos-popup-info-text {
    font-size: 12px;
    color: #333;
    line-height: 1.5;
}

.sos-school-popup .sos-popup-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.sos-school-popup .sos-popup-metric {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 11px 8px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.sos-school-popup .sos-popup-metric-icon {
    font-size: 16px;
    margin-bottom: 3px;
}

.sos-school-popup .sos-popup-metric-num {
    color: #0A1F44;
    font-size: 17px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 3px;
}

.sos-school-popup .sos-popup-metric-label {
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sos-school-popup .sos-popup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 11px;
    color: #6b7280;
}

.sos-school-popup .sos-meta-item {
    display: inline-flex;
    align-items: center;
    background: #f8f9fc;
    padding: 4px 9px;
    border-radius: 6px;
    font-weight: 500;
}

.sos-school-popup .sos-popup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, #0A1F44 0%, #1a3a7a 100%);
    color: #FFE600 !important;
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 12px rgba(10, 31, 68, 0.3);
    transition: all 0.25s ease;
}

.sos-school-popup .sos-popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(10, 31, 68, 0.4);
    color: #FFE600 !important;
}

.sos-school-popup .sos-popup-btn-arrow {
    transition: transform 0.25s ease;
}

.sos-school-popup .sos-popup-btn:hover .sos-popup-btn-arrow {
    transform: translateX(4px);
}

/* Mapbox popup */
.sos-popup-wrapper.mapboxgl-popup .mapboxgl-popup-content {
    padding: 0 !important;
    border-radius: var(--sos-radius-md) !important;
    overflow: hidden;
    box-shadow: var(--sos-shadow-lg) !important;
    max-width: 300px !important;
}

.sos-popup-wrapper.mapboxgl-popup .mapboxgl-popup-close-button {
    color: white !important;
    font-size: 22px;
    padding: 4px 10px;
    z-index: 10;
}

/* ============================================
   FULLSCREEN MODE
   ============================================ */
.sos-map-wrapper.sos-is-fullscreen .sos-map-area {
    height: 100vh;
}

.sos-map-wrapper.sos-is-fullscreen .sos-map-container {
    height: 100vh !important;
    border-radius: 0;
}

.sos-map-area:-webkit-full-screen { background: white; }
.sos-map-area:-moz-full-screen { background: white; }
.sos-map-area:fullscreen { background: white; }

.sos-map-area:fullscreen .sos-map-container {
    height: 100vh !important;
    border-radius: 0;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sos-map-wrapper {
        padding: 20px 14px;
        margin: 12px 0;
        border-radius: 16px;
    }

    .sos-map-wrapper .sos-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .sos-map-wrapper .sos-stat-card {
        padding: 14px 10px;
    }

    /* Show mobile filter toggle, hide inner controls by default */
    .sos-map-wrapper .sos-mobile-filter-toggle {
        display: flex;
    }

    .sos-map-wrapper .sos-controls-inner {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-top: 12px;
        padding: 14px;
        background: rgba(255,255,255,0.85);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-radius: var(--sos-radius-md);
        animation: sosSlideDown 0.3s ease;
    }

    .sos-map-wrapper .sos-controls-open .sos-controls-inner {
        display: flex;
    }

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

    .sos-map-wrapper .sos-filters {
        width: 100%;
        justify-content: stretch;
    }

    .sos-map-wrapper .sos-filter-btn {
        flex: 1;
        justify-content: center;
        padding: 9px 8px;
        font-size: 12px;
    }

    .sos-map-wrapper .sos-search-box {
        min-width: auto;
        width: 100%;
    }

    /* Make map controls slightly smaller on mobile */
    .sos-map-wrapper .sos-ctrl-btn {
        width: 38px;
        height: 38px;
    }

    .sos-map-wrapper .sos-controls-top-right,
    .sos-map-wrapper .sos-controls-right {
        gap: 6px;
    }

    /* Map type panel mobile (slide from bottom) */
    .sos-map-wrapper .sos-map-type-panel {
        width: calc(100vw - 24px);
        max-width: 320px;
        right: 12px;
        top: auto;
        bottom: 70px;
    }

    /* Legend mobile */
    .sos-map-wrapper .sos-map-legend {
        max-width: 130px;
        bottom: 12px;
        left: 12px;
    }

    .sos-map-wrapper .sos-legend-toggle {
        padding: 6px 10px;
        font-size: 11px;
    }

    /* Popup mobile */
    .sos-map-wrapper .leaflet-popup-content {
        width: 280px !important;
    }

    .sos-school-popup .sos-popup-photo {
        height: 110px;
    }

    .sos-school-popup .sos-popup-title {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .sos-map-wrapper {
        padding: 16px 12px;
    }

    .sos-map-wrapper .sos-title {
        font-size: 19px;
    }

    .sos-map-wrapper .sos-subtitle {
        font-size: 12px;
    }

    .sos-map-wrapper .sos-stat-num {
        font-size: 22px;
    }

    .sos-map-wrapper .sos-stat-icon {
        font-size: 20px;
    }

    /* Stack stats 2x2 on very small screens */
    .sos-map-wrapper .sos-stats-grid {
        gap: 8px;
    }

    .sos-map-wrapper .leaflet-popup-content {
        width: 260px !important;
    }
}

/* ============================================
   v1.3 NEW FEATURES STYLES
   ============================================ */

/* CLUSTER MARKERS */
.sos-cluster {
    background: transparent !important;
    border: none !important;
}
.sos-cluster-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.sos-cluster-marker:hover {
    transform: scale(1.1);
}
.sos-cluster-marker span {
    color: inherit;
}

/* POPUP - PHOTO with VIDEO BUTTON overlay */
.sos-school-popup .sos-popup-photo {
    position: relative;
}
.sos-school-popup .sos-video-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 5;
    padding: 0;
    transition: transform 0.2s ease;
}
.sos-school-popup .sos-video-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* POPUP - GALLERY thumbnails */
.sos-school-popup .sos-popup-gallery {
    margin-top: 12px;
    margin-bottom: 12px;
}
.sos-school-popup .sos-popup-gallery-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
    margin-bottom: 6px;
}
.sos-school-popup .sos-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}
.sos-school-popup .sos-gallery-thumb {
    width: 100%;
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
}
.sos-school-popup .sos-gallery-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.sos-school-popup .sos-gallery-more {
    background: linear-gradient(135deg, #0A1F44, #1a3a7a) !important;
    color: white;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* POPUP - DONATION PROGRESS */
.sos-school-popup .sos-popup-progress {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    border-left: 3px solid var(--sos-status-color, #16a34a);
}
.sos-school-popup .sos-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
}
.sos-school-popup .sos-progress-label {
    color: #0A1F44;
    font-weight: 700;
}
.sos-school-popup .sos-progress-percent {
    color: var(--sos-status-color, #16a34a);
    font-weight: 800;
    font-size: 14px;
}
.sos-school-popup .sos-progress-bar {
    height: 8px;
    background: rgba(255,255,255,0.7);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.sos-school-popup .sos-progress-fill {
    height: 100%;
    transition: width 0.6s ease;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--sos-status-color, #16a34a) 0%, var(--sos-status-color, #16a34a) 100%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.sos-school-popup .sos-progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #555;
}
.sos-school-popup .sos-progress-stats strong {
    color: #0A1F44;
    font-size: 13px;
}
.sos-school-popup .sos-progress-donors {
    margin-top: 6px;
    font-size: 11px;
    color: #6b7280;
    text-align: center;
    padding-top: 6px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* POPUP - TESTIMONIAL */
.sos-school-popup .sos-popup-testimonial {
    background: #fffbeb;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border-left: 3px solid #f59e0b;
    position: relative;
}
.sos-school-popup .sos-testimonial-quote {
    font-size: 12px;
    color: #333;
    font-style: italic;
    line-height: 1.5;
    margin-bottom: 6px;
}
.sos-school-popup .sos-testimonial-author {
    font-size: 11px;
    color: #6b7280;
    text-align: right;
    font-weight: 600;
}

/* POPUP - SHARE BUTTONS */
.sos-school-popup .sos-popup-share {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.sos-school-popup .sos-share-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.6px;
}
.sos-school-popup .sos-share-buttons {
    display: flex;
    gap: 6px;
}
.sos-school-popup .sos-share-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}
.sos-school-popup .sos-share-facebook { background: #1877f2; color: white; }
.sos-school-popup .sos-share-twitter { background: #000000; color: white; }
.sos-school-popup .sos-share-whatsapp { background: #25d366; color: white; }
.sos-school-popup .sos-share-copy { background: #6b7280; color: white; }
.sos-school-popup .sos-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.sos-school-popup .sos-share-copied {
    background: #16a34a !important;
}

/* LIGHTBOX (Gallery + Video) */
.sos-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sosLightboxFade 0.25s ease;
}
@keyframes sosLightboxFade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.sos-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sos-lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    display: block;
}
.sos-lightbox-close,
.sos-lightbox-prev,
.sos-lightbox-next {
    position: absolute;
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.sos-lightbox-close {
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    font-size: 20px;
}
.sos-lightbox-prev,
.sos-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    font-size: 30px;
}
.sos-lightbox-prev { left: -65px; }
.sos-lightbox-next { right: -65px; }
.sos-lightbox-close:hover,
.sos-lightbox-prev:hover,
.sos-lightbox-next:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}
.sos-lightbox-prev:hover,
.sos-lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}
.sos-lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 13px;
    background: rgba(255,255,255,0.15);
    padding: 6px 14px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* VIDEO MODAL */
.sos-video-modal .sos-video-content {
    width: 90vw;
    max-width: 900px;
    position: relative;
}
.sos-video-modal .sos-video-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.sos-video-modal .sos-video-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* MOBILE LIGHTBOX */
@media (max-width: 768px) {
    .sos-lightbox-prev { left: 5px; width: 40px; height: 40px; font-size: 24px; }
    .sos-lightbox-next { right: 5px; width: 40px; height: 40px; font-size: 24px; }
    .sos-lightbox-close { top: 10px; right: 10px; }
    .sos-school-popup .sos-popup-share {
        justify-content: center;
    }
    .sos-school-popup .sos-gallery-thumbs {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   v1.4: ADVANCED FILTERS + PRINT
   ============================================ */

.sos-map-wrapper .sos-advanced-filter-btn,
.sos-map-wrapper .sos-print-results-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    color: #0A1F44;
    border: 1px solid rgba(10, 31, 68, 0.15);
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    position: relative;
}

.sos-map-wrapper .sos-advanced-filter-btn:hover,
.sos-map-wrapper .sos-print-results-btn:hover {
    background: #0A1F44;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 31, 68, 0.2);
}

.sos-map-wrapper .sos-active-filter-badge {
    background: #ef4444;
    color: white;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 2px;
    font-weight: 700;
}

/* ADVANCED PANEL */
.sos-map-wrapper .sos-advanced-panel {
    background: white;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(10, 31, 68, 0.15);
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid rgba(10, 31, 68, 0.08);
    animation: sosFadeSlide 0.3s ease;
}

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

.sos-map-wrapper .sos-advanced-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: linear-gradient(135deg, #0A1F44 0%, #1a3a7a 100%);
    color: white;
}

.sos-map-wrapper .sos-advanced-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.sos-map-wrapper .sos-advanced-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.sos-map-wrapper .sos-advanced-close:hover {
    background: rgba(255,255,255,0.3);
}

.sos-map-wrapper .sos-advanced-body {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.sos-map-wrapper .sos-filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sos-map-wrapper .sos-filter-field label {
    font-size: 11px;
    color: #5f6368;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
}

.sos-map-wrapper .sos-adv-filter {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: #1f2937;
    background: white;
    outline: none;
    transition: all 0.2s ease;
}

.sos-map-wrapper .sos-adv-filter:focus {
    border-color: #0A1F44;
    box-shadow: 0 0 0 3px rgba(10, 31, 68, 0.1);
}

.sos-map-wrapper .sos-range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sos-map-wrapper .sos-range-inputs input {
    flex: 1;
    min-width: 0;
}

.sos-map-wrapper .sos-range-inputs span {
    color: #9ca3af;
    font-weight: 700;
}

.sos-map-wrapper .sos-advanced-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #f8f9fc;
    border-top: 1px solid #e5e7eb;
}

.sos-map-wrapper .sos-results-info {
    font-size: 13px;
    color: #6b7280;
}

.sos-map-wrapper .sos-results-count {
    color: #0A1F44;
    font-size: 20px;
    margin-right: 4px;
}

.sos-map-wrapper .sos-advanced-actions {
    display: flex;
    gap: 8px;
}

.sos-map-wrapper .sos-btn-clear-adv,
.sos-map-wrapper .sos-btn-print-adv {
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    border: 1.5px solid;
    transition: all 0.2s ease;
}

.sos-map-wrapper .sos-btn-clear-adv {
    background: white;
    color: #6b7280;
    border-color: #e5e7eb;
}

.sos-map-wrapper .sos-btn-clear-adv:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.sos-map-wrapper .sos-btn-print-adv {
    background: linear-gradient(135deg, #0A1F44 0%, #1a3a7a 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(10, 31, 68, 0.2);
}

.sos-map-wrapper .sos-btn-print-adv:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(10, 31, 68, 0.3);
}

/* ACTIVE FILTERS BAR */
.sos-map-wrapper .sos-active-filters-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 230, 0, 0.6);
    border-radius: 10px;
    margin-bottom: 16px;
    border: 1px solid rgba(10, 31, 68, 0.1);
}

.sos-map-wrapper .sos-active-label {
    font-size: 12px;
    color: #0A1F44;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sos-map-wrapper .sos-active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.sos-map-wrapper .sos-active-chip {
    background: white;
    color: #0A1F44;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.sos-map-wrapper .sos-active-chip button {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
    font-size: 14px;
    line-height: 1;
}

.sos-map-wrapper .sos-active-chip button:hover {
    color: #ef4444;
}

.sos-map-wrapper .sos-clear-all-active {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.sos-map-wrapper .sos-clear-all-active:hover {
    background: #dc2626;
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .sos-map-wrapper .sos-advanced-filter-btn,
    .sos-map-wrapper .sos-print-results-btn {
        width: 100%;
        justify-content: center;
    }

    .sos-map-wrapper .sos-advanced-body {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 14px;
    }

    .sos-map-wrapper .sos-advanced-footer {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .sos-map-wrapper .sos-advanced-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .sos-map-wrapper .sos-active-filters-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .sos-map-wrapper .sos-advanced-header {
        padding: 14px 16px;
    }

    .sos-map-wrapper .sos-advanced-header h3 {
        font-size: 15px;
    }
}

/* ============================================
   v1.4 NEW: DISTRICT FILTER & BREAKDOWN CARDS
   ============================================ */

/* District Dropdown in Controls */
.sos-map-wrapper .sos-district-filter-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.95);
    border-radius: var(--sos-radius-md);
    padding: 0;
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: var(--sos-shadow-sm);
    overflow: hidden;
    transition: all 0.2s ease;
}

.sos-map-wrapper .sos-district-filter-wrap:hover {
    box-shadow: var(--sos-shadow-md);
    transform: translateY(-1px);
}

.sos-map-wrapper .sos-district-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sos-secondary);
    pointer-events: none;
    opacity: 0.7;
}

.sos-map-wrapper .sos-district-filter {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    border: none;
    padding: 10px 36px 10px 36px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sos-secondary);
    cursor: pointer;
    outline: none;
    font-family: inherit;
    min-width: 180px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230A1F44' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* DISTRICT BREAKDOWN SECTION */
.sos-map-wrapper .sos-district-breakdown {
    margin-top: 24px;
    padding: 24px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--sos-radius-lg);
    box-shadow: var(--sos-shadow-md);
    position: relative;
    z-index: 1;
}

.sos-map-wrapper .sos-district-breakdown-header {
    text-align: center;
    margin-bottom: 20px;
}

.sos-map-wrapper .sos-district-breakdown-header h3 {
    font-size: 22px;
    font-weight: 800;
    color: var(--sos-secondary);
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}

.sos-map-wrapper .sos-district-breakdown-header p {
    color: var(--sos-text-muted);
    font-size: 13px;
    margin: 0;
}

.sos-map-wrapper .sos-district-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.sos-map-wrapper .sos-district-card {
    background: white;
    border-radius: var(--sos-radius-md);
    padding: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    box-shadow: 0 1px 3px rgba(10, 31, 68, 0.06);
    position: relative;
    overflow: hidden;
}

.sos-map-wrapper .sos-district-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--sos-secondary), #2a4080);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sos-map-wrapper .sos-district-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(10, 31, 68, 0.15);
    border-color: rgba(10, 31, 68, 0.1);
}

.sos-map-wrapper .sos-district-card:hover::before {
    opacity: 1;
}

.sos-map-wrapper .sos-district-card.sos-card-active {
    border-color: var(--sos-secondary);
    background: linear-gradient(135deg, rgba(255, 230, 0, 0.08) 0%, white 100%);
}

.sos-map-wrapper .sos-district-card.sos-card-active::before {
    opacity: 1;
}

.sos-map-wrapper .sos-district-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.sos-map-wrapper .sos-district-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--sos-primary) 0%, #FFD700 100%);
    color: var(--sos-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(255, 230, 0, 0.4);
}

.sos-map-wrapper .sos-district-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--sos-secondary);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.sos-map-wrapper .sos-district-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #f8f9fc 0%, #f1f5f9 100%);
    border-radius: 10px;
}

.sos-map-wrapper .sos-district-stat {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sos-map-wrapper .sos-district-stat-num {
    font-size: 17px;
    font-weight: 800;
    color: var(--sos-secondary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.sos-map-wrapper .sos-district-stat-label {
    font-size: 9px;
    color: var(--sos-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.sos-map-wrapper .sos-district-status-bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
    background: #f0f0f0;
}

.sos-map-wrapper .sos-status-segment {
    height: 100%;
    transition: all 0.3s ease;
}

.sos-map-wrapper .sos-segment-completed { background: #16a34a; }
.sos-map-wrapper .sos-segment-ongoing { background: #eab308; }
.sos-map-wrapper .sos-segment-planned { background: #3b82f6; }

.sos-map-wrapper .sos-district-status-labels {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.sos-map-wrapper .sos-status-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

.sos-map-wrapper .sos-tag-completed { background: #dcfce7; color: #166534; }
.sos-map-wrapper .sos-tag-ongoing { background: #fef3c7; color: #854d0e; }
.sos-map-wrapper .sos-tag-planned { background: #dbeafe; color: #1e3a8a; }

.sos-map-wrapper .sos-district-view-btn {
    width: 100%;
    background: var(--sos-secondary);
    color: var(--sos-primary);
    border: none;
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    letter-spacing: 0.3px;
}

.sos-map-wrapper .sos-district-view-btn:hover {
    background: #1a3a7a;
    transform: translateX(2px);
}

.sos-map-wrapper .sos-district-view-btn svg {
    transition: transform 0.2s ease;
}

.sos-map-wrapper .sos-district-card:hover .sos-district-view-btn svg {
    transform: translateX(4px);
}

/* RESPONSIVE - DISTRICT CARDS */
@media (max-width: 768px) {
    .sos-map-wrapper .sos-district-breakdown {
        padding: 16px;
    }
    .sos-map-wrapper .sos-district-breakdown-header h3 {
        font-size: 18px;
    }
    .sos-map-wrapper .sos-district-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .sos-map-wrapper .sos-district-card {
        padding: 14px;
    }
    .sos-map-wrapper .sos-district-filter-wrap {
        width: 100%;
    }
    .sos-map-wrapper .sos-district-filter {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .sos-map-wrapper .sos-district-stats {
        gap: 4px;
        padding: 10px;
    }
    .sos-map-wrapper .sos-district-stat-num {
        font-size: 15px;
    }
    .sos-map-wrapper .sos-district-stat-label {
        font-size: 8px;
    }
}

/* ============================================
   v1.4.1 CRITICAL FIXES - High Specificity Overrides
   Theme conflict prevention with !important on layout
   ============================================ */

/* Force map area to allow overflow for controls */
.sos-map-wrapper .sos-map-area {
    position: relative !important;
    overflow: visible !important;
}

/* Map control buttons MUST be visible above map */
.sos-map-wrapper .sos-map-controls {
    position: absolute !important;
    z-index: 999 !important;
    display: flex !important;
    pointer-events: auto !important;
}

.sos-map-wrapper .sos-controls-top-right {
    top: 12px !important;
    right: 12px !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.sos-map-wrapper .sos-controls-right {
    right: 12px !important;
    bottom: 12px !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.sos-map-wrapper .sos-ctrl-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    background: white !important;
    border: none !important;
    color: #0A1F44 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.sos-map-wrapper .sos-ctrl-group {
    background: white !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.sos-map-wrapper .sos-ctrl-group .sos-ctrl-btn {
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* DISTRICT BREAKDOWN - FORCE GRID LAYOUT */
.sos-map-wrapper .sos-district-breakdown {
    display: block !important;
    margin-top: 24px !important;
    padding: 24px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 20px !important;
    box-shadow: 0 6px 20px rgba(10, 31, 68, 0.12) !important;
    position: relative !important;
    z-index: 1 !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.sos-map-wrapper .sos-district-breakdown-header {
    display: block !important;
    text-align: center !important;
    margin-bottom: 20px !important;
}

.sos-map-wrapper .sos-district-breakdown-header h3 {
    display: block !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    color: #0A1F44 !important;
    margin: 0 0 4px 0 !important;
    line-height: 1.2 !important;
}

.sos-map-wrapper .sos-district-breakdown-header p {
    display: block !important;
    color: #6b7280 !important;
    font-size: 13px !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

/* GRID - FORCED with !important */
.sos-map-wrapper .sos-district-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    gap: 16px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.sos-map-wrapper .sos-district-card {
    display: block !important;
    background: white !important;
    border-radius: 12px !important;
    padding: 18px !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 2px solid transparent !important;
    box-shadow: 0 1px 3px rgba(10, 31, 68, 0.06) !important;
    position: relative !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    width: 100% !important;
    margin: 0 !important;
}

.sos-map-wrapper .sos-district-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 30px rgba(10, 31, 68, 0.15) !important;
    border-color: rgba(10, 31, 68, 0.1) !important;
}

.sos-map-wrapper .sos-district-card-header {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
    width: 100% !important;
}

.sos-map-wrapper .sos-district-icon-wrap {
    display: flex !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #FFE600 0%, #FFD700 100%) !important;
    color: #0A1F44 !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 6px rgba(255, 230, 0, 0.4) !important;
}

.sos-map-wrapper .sos-district-name {
    display: block !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    color: #0A1F44 !important;
    line-height: 1.2 !important;
    flex: 1 !important;
}

.sos-map-wrapper .sos-district-stats {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
    padding: 12px !important;
    background: linear-gradient(135deg, #f8f9fc 0%, #f1f5f9 100%) !important;
    border-radius: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.sos-map-wrapper .sos-district-stat {
    display: flex !important;
    flex-direction: column !important;
    text-align: center !important;
    gap: 2px !important;
    padding: 0 !important;
    margin: 0 !important;
}

.sos-map-wrapper .sos-district-stat-num {
    display: block !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    color: #0A1F44 !important;
    line-height: 1 !important;
}

.sos-map-wrapper .sos-district-stat-label {
    display: block !important;
    font-size: 9px !important;
    color: #6b7280 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

.sos-map-wrapper .sos-district-status-bar {
    display: flex !important;
    height: 6px !important;
    border-radius: 3px !important;
    overflow: hidden !important;
    margin-bottom: 8px !important;
    background: #f0f0f0 !important;
    width: 100% !important;
}

.sos-map-wrapper .sos-status-segment {
    display: block !important;
    height: 100% !important;
    transition: all 0.3s ease !important;
}

.sos-map-wrapper .sos-segment-completed { background: #16a34a !important; }
.sos-map-wrapper .sos-segment-ongoing { background: #eab308 !important; }
.sos-map-wrapper .sos-segment-planned { background: #3b82f6 !important; }

.sos-map-wrapper .sos-district-status-labels {
    display: flex !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    margin-bottom: 12px !important;
}

.sos-map-wrapper .sos-status-tag {
    display: inline-block !important;
    font-size: 10px !important;
    padding: 2px 8px !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
}

.sos-map-wrapper .sos-tag-completed { background: #dcfce7 !important; color: #166534 !important; }
.sos-map-wrapper .sos-tag-ongoing { background: #fef3c7 !important; color: #854d0e !important; }
.sos-map-wrapper .sos-tag-planned { background: #dbeafe !important; color: #1e3a8a !important; }

.sos-map-wrapper .sos-district-view-btn {
    display: flex !important;
    width: 100% !important;
    background: #0A1F44 !important;
    color: #FFE600 !important;
    border: none !important;
    padding: 9px 14px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.sos-map-wrapper .sos-district-view-btn:hover {
    background: #1a3a7a !important;
    color: #FFE600 !important;
}

/* FILTERS row - proper alignment */
.sos-map-wrapper .sos-controls-inner {
    display: flex !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
}

.sos-map-wrapper .sos-filters {
    display: flex !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    background: rgba(255, 255, 255, 0.6) !important;
    padding: 5px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
}

.sos-map-wrapper .sos-filter-btn {
    background: transparent !important;
    color: #0A1F44 !important;
    border: none !important;
    padding: 8px 14px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
}

.sos-map-wrapper .sos-filter-active {
    background: #0A1F44 !important;
    color: #FFE600 !important;
}

.sos-map-wrapper .sos-district-filter-wrap {
    display: inline-flex !important;
    align-items: center !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 2px 8px rgba(10, 31, 68, 0.08) !important;
    position: relative !important;
    overflow: hidden !important;
}

.sos-map-wrapper .sos-district-filter {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: transparent !important;
    border: none !important;
    padding: 10px 36px 10px 36px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #0A1F44 !important;
    cursor: pointer !important;
    outline: none !important;
    min-width: 180px !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230A1F44' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
}

.sos-map-wrapper .sos-search-box {
    flex: 1 !important;
    min-width: 200px !important;
    position: relative !important;
}

.sos-map-wrapper .sos-search-input {
    width: 100% !important;
    padding: 11px 14px 11px 40px !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    outline: none !important;
    color: #0A1F44 !important;
    box-sizing: border-box !important;
}

.sos-map-wrapper .sos-advanced-filter-btn,
.sos-map-wrapper .sos-print-results-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: white !important;
    color: #0A1F44 !important;
    border: 1px solid rgba(10, 31, 68, 0.15) !important;
    padding: 9px 14px !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
}

.sos-map-wrapper .sos-print-results-btn:hover,
.sos-map-wrapper .sos-advanced-filter-btn:hover {
    background: #f5f5f5 !important;
    transform: translateY(-1px) !important;
}

/* MOBILE - District cards single column */
@media (max-width: 768px) {
    .sos-map-wrapper .sos-district-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .sos-map-wrapper .sos-district-breakdown {
        padding: 16px !important;
    }

    .sos-map-wrapper .sos-controls-inner {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .sos-map-wrapper .sos-filters {
        width: 100% !important;
        justify-content: space-between !important;
    }

    .sos-map-wrapper .sos-filter-btn {
        flex: 1 !important;
        justify-content: center !important;
        padding: 9px 6px !important;
        font-size: 11px !important;
    }

    .sos-map-wrapper .sos-district-filter-wrap {
        width: 100% !important;
    }

    .sos-map-wrapper .sos-district-filter {
        width: 100% !important;
        min-width: auto !important;
    }

    .sos-map-wrapper .sos-search-box {
        width: 100% !important;
        min-width: auto !important;
    }

    .sos-map-wrapper .sos-advanced-filter-btn,
    .sos-map-wrapper .sos-print-results-btn {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ============================================
   v1.4.3 FIXES: 2-Row Filters + White Title + Mobile Perfection
   ============================================ */

/* CONTROLS - 2 ROW LAYOUT */
.sos-map-wrapper .sos-controls-inner {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
}

.sos-map-wrapper .sos-controls-row {
    display: flex !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    width: 100% !important;
}

.sos-map-wrapper .sos-controls-row-1 {
    justify-content: flex-start !important;
}

.sos-map-wrapper .sos-controls-row-2 {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
}

/* ADVANCED FILTERS HEADER - White text on blue */
.sos-map-wrapper .sos-advanced-panel {
    margin-top: 16px !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(10, 31, 68, 0.12) !important;
    overflow: hidden !important;
    border: 1px solid rgba(10, 31, 68, 0.08) !important;
}

.sos-map-wrapper .sos-advanced-header {
    background: linear-gradient(135deg, #0A1F44 0%, #1a3a7a 100%) !important;
    padding: 16px 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    color: white !important;
}

.sos-map-wrapper .sos-advanced-header h3 {
    margin: 0 !important;
    color: white !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.sos-map-wrapper .sos-advanced-header h3 * {
    color: white !important;
}

.sos-map-wrapper .sos-advanced-close {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    border: none !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease !important;
}

.sos-map-wrapper .sos-advanced-close:hover {
    background: rgba(255, 255, 255, 0.25) !important;
}

.sos-map-wrapper .sos-advanced-close svg {
    color: white !important;
    stroke: white !important;
}

.sos-map-wrapper .sos-advanced-body {
    padding: 24px !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
    background: white !important;
}

.sos-map-wrapper .sos-filter-field {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}

.sos-map-wrapper .sos-filter-field label {
    color: #6b7280 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    margin: 0 !important;
}

.sos-map-wrapper .sos-filter-field select,
.sos-map-wrapper .sos-filter-field input {
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 10px 12px !important;
    font-size: 13px !important;
    color: #0A1F44 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    outline: none !important;
}

.sos-map-wrapper .sos-filter-field select:focus,
.sos-map-wrapper .sos-filter-field input:focus {
    border-color: #0A1F44 !important;
    box-shadow: 0 0 0 3px rgba(10, 31, 68, 0.1) !important;
}

.sos-map-wrapper .sos-range-inputs {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.sos-map-wrapper .sos-range-inputs input {
    flex: 1 !important;
    min-width: 0 !important;
}

.sos-map-wrapper .sos-range-inputs span {
    color: #9ca3af !important;
    font-weight: 600 !important;
}

.sos-map-wrapper .sos-advanced-footer {
    padding: 16px 24px !important;
    background: #f8f9fc !important;
    border-top: 1px solid #e5e7eb !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
}

.sos-map-wrapper .sos-results-info {
    color: #6b7280 !important;
    font-size: 13px !important;
}

.sos-map-wrapper .sos-results-info strong {
    color: #0A1F44 !important;
    font-size: 18px !important;
    font-weight: 800 !important;
}

.sos-map-wrapper .sos-advanced-actions {
    display: flex !important;
    gap: 10px !important;
}

.sos-map-wrapper .sos-btn-clear-adv {
    background: white !important;
    color: #0A1F44 !important;
    border: 1px solid #e5e7eb !important;
    padding: 10px 18px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.sos-map-wrapper .sos-btn-clear-adv:hover {
    background: #f5f5f5 !important;
}

.sos-map-wrapper .sos-btn-print-adv {
    background: linear-gradient(135deg, #0A1F44 0%, #1a3a7a 100%) !important;
    color: white !important;
    border: none !important;
    padding: 10px 18px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.sos-map-wrapper .sos-btn-print-adv:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(10, 31, 68, 0.3) !important;
    color: white !important;
}

/* ============================================
   MOBILE PERFECT - All screen sizes
   ============================================ */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    .sos-map-wrapper {
        padding: 18px 14px !important;
        margin: 10px 0 !important;
        border-radius: 16px !important;
    }

    /* Stats - 2 columns */
    .sos-map-wrapper .sos-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .sos-map-wrapper .sos-stat-card {
        padding: 14px 10px !important;
    }

    /* Map height responsive */
    .sos-map-wrapper .sos-map-container {
        height: 400px !important;
    }

    /* Filter rows stack */
    .sos-map-wrapper .sos-controls-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    /* Status filters - equal width */
    .sos-map-wrapper .sos-filters {
        width: 100% !important;
        justify-content: stretch !important;
        gap: 4px !important;
        padding: 4px !important;
    }

    .sos-map-wrapper .sos-filter-btn {
        flex: 1 !important;
        justify-content: center !important;
        padding: 9px 6px !important;
        font-size: 11px !important;
        gap: 4px !important;
    }

    /* Search - full width */
    .sos-map-wrapper .sos-search-box {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* District dropdown - full width */
    .sos-map-wrapper .sos-district-filter-wrap {
        width: 100% !important;
    }

    .sos-map-wrapper .sos-district-filter {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Action buttons - 50/50 split on row 2 */
    .sos-map-wrapper .sos-advanced-filter-btn,
    .sos-map-wrapper .sos-print-results-btn {
        flex: 1 !important;
        justify-content: center !important;
        padding: 10px 12px !important;
        font-size: 12px !important;
        min-width: 0 !important;
    }

    .sos-map-wrapper .sos-controls-row-2 {
        gap: 8px !important;
    }

    /* Advanced filters body - single column */
    .sos-map-wrapper .sos-advanced-body {
        grid-template-columns: 1fr !important;
        padding: 16px !important;
        gap: 14px !important;
    }

    .sos-map-wrapper .sos-advanced-footer {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        padding: 14px 16px !important;
    }

    .sos-map-wrapper .sos-advanced-actions {
        width: 100% !important;
    }

    .sos-map-wrapper .sos-btn-clear-adv,
    .sos-map-wrapper .sos-btn-print-adv {
        flex: 1 !important;
        justify-content: center !important;
    }

    /* District cards - 1 per row */
    .sos-map-wrapper .sos-district-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .sos-map-wrapper .sos-district-card {
        padding: 14px !important;
    }

    /* Header smaller on mobile */
    .sos-map-wrapper .sos-title {
        font-size: 20px !important;
        line-height: 1.2 !important;
    }

    .sos-map-wrapper .sos-subtitle {
        font-size: 13px !important;
        padding: 0 8px !important;
    }

    /* Map controls smaller */
    .sos-map-wrapper .sos-ctrl-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }

    /* Advanced filter close button */
    .sos-map-wrapper .sos-advanced-header {
        padding: 14px 16px !important;
    }

    .sos-map-wrapper .sos-advanced-header h3 {
        font-size: 15px !important;
    }
}

/* Phone (480px and below) - Even tighter */
@media (max-width: 480px) {
    .sos-map-wrapper {
        padding: 14px 10px !important;
        margin: 8px 0 !important;
    }

    .sos-map-wrapper .sos-title {
        font-size: 18px !important;
    }

    .sos-map-wrapper .sos-subtitle {
        font-size: 12px !important;
    }

    /* Stats - smaller */
    .sos-map-wrapper .sos-stat-card {
        padding: 12px 8px !important;
    }

    .sos-map-wrapper .sos-stat-num {
        font-size: 20px !important;
    }

    .sos-map-wrapper .sos-stat-icon {
        font-size: 18px !important;
    }

    .sos-map-wrapper .sos-stat-label {
        font-size: 9px !important;
    }

    /* Map smaller */
    .sos-map-wrapper .sos-map-container {
        height: 350px !important;
    }

    /* Filter buttons super compact */
    .sos-map-wrapper .sos-filter-btn {
        font-size: 10px !important;
        padding: 8px 4px !important;
    }

    /* Hide filter button SVGs on tiny screens to save space */
    .sos-map-wrapper .sos-filter-btn .sos-dot {
        display: none !important;
    }

    /* Action buttons - stack vertically on tiny screens */
    .sos-map-wrapper .sos-controls-row-2 {
        flex-direction: column !important;
    }

    .sos-map-wrapper .sos-advanced-filter-btn,
    .sos-map-wrapper .sos-print-results-btn {
        width: 100% !important;
    }

    /* District cards stats tighter */
    .sos-map-wrapper .sos-district-stats {
        padding: 10px !important;
        gap: 4px !important;
    }

    .sos-map-wrapper .sos-district-stat-num {
        font-size: 14px !important;
    }

    .sos-map-wrapper .sos-district-stat-label {
        font-size: 8px !important;
    }

    /* Popup adjustments */
    .sos-map-wrapper .leaflet-popup-content {
        width: 250px !important;
    }

    /* Map legend smaller */
    .sos-map-wrapper .sos-map-legend {
        max-width: 110px !important;
    }

    .sos-map-wrapper .sos-legend-toggle {
        padding: 5px 8px !important;
        font-size: 10px !important;
    }

    /* Help text */
    .sos-map-wrapper .sos-help-text {
        padding: 12px 14px !important;
        font-size: 12px !important;
    }
}

/* Very small phones (360px and below) */
@media (max-width: 360px) {
    .sos-map-wrapper .sos-stats-grid {
        grid-template-columns: 1fr !important;
    }

    .sos-map-wrapper .sos-stat-card {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        text-align: left !important;
        padding: 10px 14px !important;
    }

    .sos-map-wrapper .sos-stat-icon {
        margin-bottom: 0 !important;
        font-size: 22px !important;
    }

    .sos-map-wrapper .sos-stat-num {
        font-size: 18px !important;
    }
}

/* ============================================
   v1.4.4 ALIGNMENT FIXES - Row 2 Equal Width + Better Layout
   ============================================ */

/* ROW 1: Status filters take their space, search takes remaining */
.sos-map-wrapper .sos-controls-row-1 {
    display: flex !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    width: 100% !important;
}

.sos-map-wrapper .sos-controls-row-1 .sos-filters {
    flex: 0 0 auto !important;
}

.sos-map-wrapper .sos-controls-row-1 .sos-search-box {
    flex: 1 !important;
    min-width: 200px !important;
}

/* ROW 2: District + Advanced + Print - all equal-width on desktop */
.sos-map-wrapper .sos-controls-row-2 {
    display: flex !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    width: 100% !important;
}

.sos-map-wrapper .sos-controls-row-2 > * {
    flex: 1 1 200px !important;
    min-width: 0 !important;
    height: auto !important;
    box-sizing: border-box !important;
}

/* District filter wrap - match button height */
.sos-map-wrapper .sos-controls-row-2 .sos-district-filter-wrap {
    display: flex !important;
    align-items: center !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(10, 31, 68, 0.15) !important;
    box-shadow: 0 2px 8px rgba(10, 31, 68, 0.08) !important;
    padding: 0 !important;
    min-height: 44px !important;
    transition: all 0.2s ease !important;
    position: relative !important;
}

.sos-map-wrapper .sos-controls-row-2 .sos-district-filter-wrap:hover {
    box-shadow: 0 4px 12px rgba(10, 31, 68, 0.12) !important;
    transform: translateY(-1px) !important;
}

.sos-map-wrapper .sos-controls-row-2 .sos-district-icon {
    position: absolute !important;
    left: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #0A1F44 !important;
    pointer-events: none !important;
    opacity: 0.75 !important;
}

.sos-map-wrapper .sos-controls-row-2 .sos-district-filter {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: transparent !important;
    border: none !important;
    padding: 0 38px 0 40px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #0A1F44 !important;
    cursor: pointer !important;
    outline: none !important;
    width: 100% !important;
    min-width: 0 !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230A1F44' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
    text-align: left !important;
}

/* Advanced + Print buttons - match district height */
.sos-map-wrapper .sos-controls-row-2 .sos-advanced-filter-btn,
.sos-map-wrapper .sos-controls-row-2 .sos-print-results-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    background: white !important;
    color: #0A1F44 !important;
    border: 1px solid rgba(10, 31, 68, 0.15) !important;
    padding: 0 16px !important;
    height: 44px !important;
    line-height: 1 !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    box-shadow: 0 2px 8px rgba(10, 31, 68, 0.08) !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    text-decoration: none !important;
}

.sos-map-wrapper .sos-controls-row-2 .sos-advanced-filter-btn:hover,
.sos-map-wrapper .sos-controls-row-2 .sos-print-results-btn:hover {
    background: #f8f9fc !important;
    box-shadow: 0 4px 12px rgba(10, 31, 68, 0.12) !important;
    transform: translateY(-1px) !important;
    color: #0A1F44 !important;
}

.sos-map-wrapper .sos-controls-row-2 .sos-advanced-filter-btn svg,
.sos-map-wrapper .sos-controls-row-2 .sos-print-results-btn svg {
    flex-shrink: 0 !important;
}

/* ROW 1 Status filters and Search - match height */
.sos-map-wrapper .sos-controls-row-1 .sos-filters {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
}

.sos-map-wrapper .sos-controls-row-1 .sos-search-input {
    height: 44px !important;
    box-sizing: border-box !important;
}

/* MAP TILES FIX - Ensure proper loading area */
.sos-map-wrapper .sos-map-container {
    position: relative !important;
    width: 100% !important;
    min-height: 400px !important;
    background: #e6f0f5 !important;
    overflow: hidden !important;
    margin-bottom: 16px !important;
}

.sos-map-wrapper .sos-map-container .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    background: #ddeaf0 !important;
}

/* MOBILE - Row 2 still equal */
@media (max-width: 768px) {
    .sos-map-wrapper .sos-controls-row-2 {
        gap: 8px !important;
    }

    .sos-map-wrapper .sos-controls-row-2 > * {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 0 !important;
    }

    /* District takes full row, then advanced+print share 2nd row */
    .sos-map-wrapper .sos-controls-row-2 .sos-district-filter-wrap {
        flex: 1 1 100% !important;
    }

    .sos-map-wrapper .sos-controls-row-2 .sos-advanced-filter-btn,
    .sos-map-wrapper .sos-controls-row-2 .sos-print-results-btn {
        flex: 1 1 calc(50% - 4px) !important;
    }

    /* Row 1 mobile - stack */
    .sos-map-wrapper .sos-controls-row-1 {
        flex-direction: column !important;
    }

    .sos-map-wrapper .sos-controls-row-1 .sos-filters {
        width: 100% !important;
        display: flex !important;
    }

    .sos-map-wrapper .sos-controls-row-1 .sos-search-box {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* Tiny phones */
@media (max-width: 480px) {
    .sos-map-wrapper .sos-controls-row-2 .sos-advanced-filter-btn,
    .sos-map-wrapper .sos-controls-row-2 .sos-print-results-btn {
        flex: 1 1 100% !important;
        padding: 0 12px !important;
        font-size: 12px !important;
    }

    .sos-map-wrapper .sos-controls-row-2 .sos-advanced-filter-btn span,
    .sos-map-wrapper .sos-controls-row-2 .sos-print-results-btn span {
        font-size: 12px !important;
    }
}

/* ============================================
   v1.4.5 FINAL ALIGNMENT - Row 2 Equal Heights
   ============================================ */

/* Force ALL Row 2 elements to identical size */
.sos-map-wrapper .sos-controls-row-2 {
    align-items: stretch !important;
}

.sos-map-wrapper .sos-controls-row-2 > * {
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* District filter wrap - override any padding */
.sos-map-wrapper .sos-controls-row-2 .sos-district-filter-wrap {
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    border: 1px solid rgba(10, 31, 68, 0.15) !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(10, 31, 68, 0.08) !important;
    display: flex !important;
    align-items: center !important;
    overflow: hidden !important;
    height: 48px !important;
}

.sos-map-wrapper .sos-controls-row-2 .sos-district-filter {
    height: 48px !important;
    line-height: 48px !important;
    margin: 0 !important;
    border: none !important;
    background-color: transparent !important;
    padding: 0 38px 0 40px !important;
}

.sos-map-wrapper .sos-controls-row-2 .sos-district-icon {
    left: 14px !important;
}

/* Buttons exact height */
.sos-map-wrapper .sos-controls-row-2 .sos-advanced-filter-btn,
.sos-map-wrapper .sos-controls-row-2 .sos-print-results-btn {
    height: 48px !important;
    line-height: 1 !important;
    padding: 0 16px !important;
    margin: 0 !important;
    background: white !important;
    border: 1px solid rgba(10, 31, 68, 0.15) !important;
    border-radius: 12px !important;
}

/* Row 1 also consistent height */
.sos-map-wrapper .sos-controls-row-1 > * {
    min-height: 48px !important;
}

.sos-map-wrapper .sos-controls-row-1 .sos-filters {
    height: 48px !important;
}

.sos-map-wrapper .sos-controls-row-1 .sos-search-input {
    height: 48px !important;
    line-height: 48px !important;
    padding: 0 14px 0 40px !important;
}

/* Mobile Row 2 height */
@media (max-width: 768px) {
    .sos-map-wrapper .sos-controls-row-2 > * {
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
    }

    .sos-map-wrapper .sos-controls-row-2 .sos-district-filter-wrap {
        height: 44px !important;
    }

    .sos-map-wrapper .sos-controls-row-2 .sos-district-filter {
        height: 44px !important;
        line-height: 44px !important;
    }

    .sos-map-wrapper .sos-controls-row-1 > * {
        min-height: 44px !important;
    }

    .sos-map-wrapper .sos-controls-row-1 .sos-filters,
    .sos-map-wrapper .sos-controls-row-1 .sos-search-input {
        height: 44px !important;
        line-height: 44px !important;
    }
}

/* ============================================
   v1.4.7 ZOOM-AWARE MARKER SIZING (CSS variable approach)
   Set via JS: container.style.setProperty('--sos-zoom-scale', X)
   ============================================ */

/* Default scale - inherits down to all markers */
.sos-map-wrapper,
.sos-map-wrapper .sos-map-container {
    --sos-zoom-scale: 1;
}
/* Marker scaling rules are defined alongside animation rules above */

/* ============================================
   v1.6 STATS CUSTOMIZATION
   Variables set inline on .sos-stats-grid from settings
   ============================================ */
.sos-map-wrapper .sos-stats-grid .sos-stat-card {
    background: var(--sos-stat-card-bg, #FFFEF5) !important;
}

.sos-map-wrapper .sos-stats-grid .sos-stat-num {
    font-size: var(--sos-stat-num-size, 32px) !important;
    color: var(--sos-stat-num-color, #0A1F44) !important;
}

.sos-map-wrapper .sos-stats-grid .sos-stat-label {
    font-size: var(--sos-stat-label-size, 11px) !important;
    color: var(--sos-stat-label-color, #6b7280) !important;
}

.sos-map-wrapper .sos-stats-grid .sos-stat-icon {
    font-size: var(--sos-stat-icon-size, 36px) !important;
    line-height: 1 !important;
    margin-bottom: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: calc(var(--sos-stat-icon-size, 36px) + 8px) !important;
}

.sos-map-wrapper .sos-stats-grid .sos-stat-icon-img {
    width: var(--sos-stat-icon-size, 36px) !important;
    height: var(--sos-stat-icon-size, 36px) !important;
    object-fit: contain !important;
    display: block !important;
}


/* ============================================
   v1.6.4 - Minimal popup z-index fix
   Only fixes popup z-index without breaking layout
   ============================================ */
.sos-map-wrapper .leaflet-popup {
    z-index: 1000 !important;
}

.sos-map-wrapper .leaflet-marker-icon {
    cursor: pointer;
}
