/**
 * AID Map Styles — Leaflet/OpenStreetMap
 * Beautiful, consistent map styling across all AID pages.
 */

/* ── Marker Styles ── */
.aid-marker { background: none !important; border: none !important; }

/* ── Popup Styles ── */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06) !important;
    border: 1px solid rgba(0,0,0,0.04) !important;
    padding: 0 !important;
}
.leaflet-popup-content {
    margin: 14px 16px !important;
    font-family: Inter, system-ui, -apple-system, sans-serif !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: #374151 !important;
}
.leaflet-popup-tip {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}
.leaflet-popup-close-button {
    color: #94a3b8 !important;
    font-size: 20px !important;
    padding: 6px 8px !important;
    width: auto !important;
    height: auto !important;
}
.leaflet-popup-close-button:hover {
    color: #1e293b !important;
}

/* ── Control Styles ── */
.leaflet-control-zoom a {
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 16px !important;
    color: #374151 !important;
    border-color: #e2e8f0 !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06) !important;
    transition: all 0.15s ease !important;
}
.leaflet-control-zoom a:hover {
    background: #f8fafc !important;
    color: #5D0C34 !important;
}
.leaflet-control-zoom {
    border: none !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.leaflet-control-zoom a:first-child {
    border-radius: 8px !important;
}
.leaflet-control-zoom a:last-child {
    border-radius: 8px !important;
}

/* ── Layer Control ── */
.leaflet-control-layers {
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
    border: 1px solid #e2e8f0 !important;
    font-family: Inter, system-ui, sans-serif !important;
    font-size: 12px !important;
}
.leaflet-control-layers-toggle {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    background-size: 18px 18px !important;
}
.leaflet-control-layers-expanded {
    padding: 10px 14px !important;
}
.leaflet-control-layers label {
    font-size: 12px !important;
    color: #475569 !important;
    font-weight: 500 !important;
}

/* ── Scale Control ── */
.leaflet-control-scale-line {
    border-color: #94a3b8 !important;
    color: #64748b !important;
    font-size: 10px !important;
    font-family: Inter, system-ui, sans-serif !important;
    background: rgba(255,255,255,0.8) !important;
    border-radius: 3px !important;
    line-height: 1.3 !important;
    padding: 2px 6px !important;
}

/* ── Attribution ── */
.leaflet-control-attribution {
    font-size: 9px !important;
    color: #94a3b8 !important;
    background: rgba(255,255,255,0.7) !important;
    border-radius: 4px 0 0 0 !important;
    padding: 2px 8px !important;
}
.leaflet-control-attribution a {
    color: #64748b !important;
}

/* ── Cluster Markers ── */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
    background: rgba(93, 12, 52, 0.15) !important;
}
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
    background: #5D0C34 !important;
    color: #fff !important;
    font-weight: 700 !important;
    font-family: Inter, system-ui, sans-serif !important;
    font-size: 12px !important;
}

/* ── Custom Map Controls (AID-specific) ── */
.aid-map-control {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    padding: 8px;
    font-family: Inter, system-ui, sans-serif;
}
.aid-map-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #fff;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.aid-map-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}
.aid-map-btn.active {
    background: #5D0C34;
    color: #fff;
    border-color: #5D0C34;
}
.aid-map-btn i { font-size: 11px; }

/* ── Stats bar overlay ── */
.aid-map-stats {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 800;
    display: flex;
    gap: 16px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 8px 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.6);
    font-family: Inter, system-ui, sans-serif;
}
.aid-map-stats span {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}
.aid-map-stats strong {
    color: #1e293b;
    font-size: 14px;
    font-weight: 800;
}

/* ── Legend overlay ── */
.aid-map-legend {
    position: absolute;
    top: 12px;
    right: 52px;
    z-index: 800;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    font-family: Inter, system-ui, sans-serif;
}
.aid-map-legend-title {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.aid-map-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    transition: opacity 0.15s;
}
.aid-map-legend-item:hover { opacity: 0.7; }
.aid-map-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Loading overlay ── */
.aid-map-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 900;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.aid-map-loading.visible {
    opacity: 1;
    pointer-events: auto;
}
.aid-map-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #5D0C34;
    border-radius: 50%;
    animation: aid-spin 0.7s linear infinite;
}
.aid-map-loading-text {
    font-size: 13px;
    color: #475569;
    font-weight: 600;
    font-family: Inter, system-ui, sans-serif;
}
@keyframes aid-spin {
    to { transform: rotate(360deg); }
}

/* ── Pulse animation for markers ── */
@keyframes aid-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}
