/**
 * UK Traffic Updates — Shared Map Styles
 * ========================================
 * Server path: /assets/css/uktu-map.css
 *
 * Styles for UKTU.pin(), UKTU.dot(), UKTU.createCluster()
 * and UKTU.coverageCircle() used across the entire site.
 *
 * Load AFTER leaflet.css and MarkerCluster.css
 */

/* ===== PIN MARKERS ===== */
.uktu-pin {
    background: none !important;
    border: none !important;
}

.uktu-pin-inner {
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 700;
    border: 3px solid #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    z-index: 2;
    line-height: 1;
}

.uktu-pin:hover .uktu-pin-inner {
    transform: scale(1.15);
    box-shadow: 0 5px 16px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.2);
}

.uktu-pin-tail {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #0891b2; /* overridden inline */
    margin: -2px auto 0;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
}


/* ===== DOT MARKERS (user location, etc.) ===== */
.uktu-dot-wrap {
    background: none !important;
    border: none !important;
}

.uktu-dot {
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    position: relative;
    z-index: 2;
}

.uktu-dot-pulse {
    position: absolute;
    border-radius: 50%;
    border: 2px solid #dc2626; /* overridden inline */
    opacity: 0;
    z-index: 1;
    animation: uktu-pulse 2s ease-out infinite;
}

@keyframes uktu-pulse {
    0%   { transform: scale(0.5); opacity: 0.6; }
    100% { transform: scale(1.8); opacity: 0; }
}


/* ===== CLUSTER MARKERS ===== */
.uktu-cluster-wrap {
    background: none !important;
    border: none !important;
}

.uktu-cluster {
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 800;
    border: 3px solid rgba(255,255,255,0.9);
    box-shadow: 0 3px 12px rgba(0,0,0,0.25), 0 0 0 4px rgba(8,145,178,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.uktu-cluster:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 18px rgba(0,0,0,0.3), 0 0 0 6px rgba(8,145,178,0.2);
}

.uktu-cluster span {
    font-size: inherit;
    line-height: 1;
}

.uktu-cluster-sm { font-size: 13px; }
.uktu-cluster-md { font-size: 15px; }
.uktu-cluster-lg { font-size: 17px; }
.uktu-cluster-xl { font-size: 19px; }

/* Outer glow ring for clusters */
.uktu-cluster::after {
    content: '';
    position: absolute;
    top: -6px; left: -6px; right: -6px; bottom: -6px;
    border-radius: 50%;
    border: 2px solid rgba(8,145,178,0.2);
    animation: uktu-cluster-breathe 3s ease-in-out infinite;
}

@keyframes uktu-cluster-breathe {
    0%, 100% { transform: scale(1);   opacity: 0.4; }
    50%      { transform: scale(1.1); opacity: 0.1; }
}


/* ===== POPUPS ===== */
.uktu-popup .leaflet-popup-content-wrapper {
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    padding: 0;
    overflow: hidden;
}

.uktu-popup .leaflet-popup-content {
    margin: 0;
    padding: 16px 18px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
}

.uktu-popup .leaflet-popup-content strong {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    display: block;
    margin-bottom: 4px;
}

.uktu-popup .leaflet-popup-tip {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.uktu-popup .leaflet-popup-close-button {
    top: 8px !important;
    right: 8px !important;
    font-size: 18px;
    color: #94a3b8;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uktu-popup .leaflet-popup-close-button:hover {
    color: #0f172a;
}

/* Popup link style */
.uktu-popup-link {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 14px;
    background: #0891b2;
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.uktu-popup-link:hover {
    background: #0e7490;
    transform: translateY(-1px);
}

/* Popup badge (operator, status, etc.) */
.uktu-popup-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    margin-left: 6px;
    vertical-align: middle;
}

/* Popup details row */
.uktu-popup-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 13px;
    color: #64748b;
}


/* ===== OVERRIDE DEFAULT LEAFLET MARKER CLUSTER CSS ===== */
/* Hide defaults — our custom ones take over */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: none !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: none !important;
}


/* ===== MAP CONTAINER GLOBAL OVERRIDES ===== */
/* Rounded corners on map containers */
.leaflet-container {
    border-radius: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Better zoom controls */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12) !important;
    border-radius: 10px !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 18px !important;
    color: #1e293b !important;
    background: #fff !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.leaflet-control-zoom a:hover {
    background: #f1f5f9 !important;
    color: #0891b2 !important;
}

/* Attribution - smaller and cleaner */
.leaflet-control-attribution {
    font-size: 10px !important;
    background: rgba(255,255,255,0.85) !important;
    padding: 2px 8px !important;
    border-radius: 6px 0 0 0 !important;
}

.leaflet-control-attribution a {
    color: #64748b !important;
}


/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
    .leaflet-control-zoom a {
        background: #1e293b !important;
        color: #e2e8f0 !important;
        border-bottom-color: #334155 !important;
    }
    .leaflet-control-zoom a:hover {
        background: #334155 !important;
        color: #22d3ee !important;
    }
    .leaflet-control-attribution {
        background: rgba(15,23,42,0.85) !important;
        color: #94a3b8 !important;
    }
    .uktu-popup .leaflet-popup-content-wrapper {
        background: #1e293b;
        border-color: #334155;
    }
    .uktu-popup .leaflet-popup-content {
        color: #e2e8f0;
    }
    .uktu-popup .leaflet-popup-content strong {
        color: #f1f5f9;
    }
    .uktu-popup .leaflet-popup-tip {
        background: #1e293b;
        border-color: #334155;
    }
}

/* Also support manual dark class */
body.dark-mode .leaflet-control-zoom a,
[data-theme="dark"] .leaflet-control-zoom a {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border-bottom-color: #334155 !important;
}