@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --aso-primary: #14A800; /* Original brand green, let's keep it but modernize */
    --aso-primary-hover: #108A00;
    --aso-primary-light: rgba(20, 168, 0, 0.1);
    --aso-bg: #f8f9fc;
    --aso-card-bg: rgba(255, 255, 255, 0.85);
    --aso-text: #1a1e23;
    --aso-text-muted: #64748b;
    --aso-border: rgba(0, 22, 46, 0.1);
    --aso-shadow: 0 10px 40px -10px rgba(0,0,0,0.1);
    --aso-radius: 16px;
}

/* Astra Theme Header & Full Width Overrides for ASO Map */
body.page-id-125 #masthead,
body.page-id-125 .site-header,
body.page-id-125 #ast-desktop-header,
body.page-id-125 #ast-mobile-header,
body:has(.aso-map-wrapper-global) #masthead,
body:has(.aso-map-wrapper-global) .site-header,
body:has(.aso-map-wrapper-global) #ast-desktop-header,
body:has(.aso-map-wrapper-global) #ast-mobile-header {
    display: none !important;
}

body.page-id-125 #content.site-content,
body.page-id-125 .site-content,
body:has(.aso-map-wrapper-global) #content.site-content,
body:has(.aso-map-wrapper-global) .site-content {
    padding: 0 !important;
    margin: 0 !important;
}

body.page-id-125 .site-content .ast-container,
body:has(.aso-map-wrapper-global) .site-content .ast-container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
}

body.page-id-125 #primary.content-area,
body.page-id-125 .site-main,
body.page-id-125 article.post-125,
body.page-id-125 .entry-content,
body:has(.aso-map-wrapper-global) #primary.content-area,
body:has(.aso-map-wrapper-global) .site-main,
body:has(.aso-map-wrapper-global) article,
body:has(.aso-map-wrapper-global) .entry-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.page-id-125 .entry-header,
body:has(.aso-map-wrapper-global) .entry-header {
    display: none !important;
}

.aso-map-wrapper-global {
    font-family: 'Outfit', sans-serif;
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh !important;
    height: 100vh !important;
    background: var(--aso-bg);
    border-radius: 0 !important;
    overflow: hidden;
    box-shadow: none !important;
    display: flex;
    margin: 0 !important;
}

.aso-map-sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 320px;
    max-height: calc(100% - 40px);
    overflow-y: auto;
    background: var(--aso-card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--aso-radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    z-index: 1000; /* Above leaflet map */
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--aso-primary) transparent;
}

.aso-map-sidebar::-webkit-scrollbar {
    width: 6px;
}
.aso-map-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--aso-primary);
    border-radius: 10px;
}

.aso-map-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

/* Hide WordPress page title */
header.entry-header,
h1.entry-title,
.page-title {
    display: none !important;
}

.leaflet-control-attribution {
    display: none !important;
}

.aso-map-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--aso-text);
    margin: 0;
    letter-spacing: -0.5px;
}

.aso-map-logo-text span {
    color: var(--aso-primary);
}

.aso-map-desc {
    color: var(--aso-text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0 0 16px 0;
}

/* Dropdown styling */
.aso-map-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.aso-map-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--aso-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aso-map-group select {
    appearance: none;
    width: 100%;
    height: auto !important;
    box-sizing: border-box !important;
    line-height: normal !important;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--aso-text);
    background-color: #ffffff;
    border: 1px solid var(--aso-border);
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.aso-map-group select:hover:not(:disabled) {
    border-color: var(--aso-primary);
}

.aso-map-group select:focus {
    border-color: var(--aso-primary);
    box-shadow: 0 0 0 3px var(--aso-primary-light);
}

.aso-map-group select:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

/* Custom select arrow */
.aso-map-group::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 40px;
    width: 10px;
    height: 6px;
    background-color: var(--aso-text-muted);
    clip-path: polygon(100% 0%, 0 0%, 50% 100%);
    pointer-events: none;
    transition: background-color 0.2s;
}

.aso-map-group select:disabled + ::after {
    background-color: #cbd5e1;
}

/* Button */
.aso-btn {
    margin-top: 8px;
    padding: 14px;
    background: linear-gradient(135deg, var(--aso-primary), var(--aso-primary-hover));
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--aso-primary-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aso-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(20, 168, 0, 0.25);
}

.aso-btn:active {
    transform: translateY(0);
}

/* Breadcrumb Info */
.aso-map-info {
    margin-top: 10px;
    padding: 16px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid var(--aso-border);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.01);
}

.aso-map-info h4 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    color: var(--aso-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#aso_map_breadcrumb {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--aso-primary);
    line-height: 1.4;
    word-break: break-word;
}

/* Canvas */
.aso-map-canvas-wrapper {
    flex: 1;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#aso_map_canvas {
    width: 100%;
    height: 100%;
    background-color: #e5e5e5; /* Placeholder before map loads */
}

/* Hide focus outline on Leaflet map elements */
.leaflet-container * {
    outline: none !important;
}

/* Fix Leaflet Zoom Controls - hide theme link underlines and leaks */
.entry-content .leaflet-container a,
.entry-content .leaflet-bar a,
.leaflet-container a.leaflet-control-zoom-in,
.leaflet-container a.leaflet-control-zoom-out,
.leaflet-bar a,
.leaflet-bar a span,
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    text-decoration: none !important;
    text-decoration-line: none !important;
    -webkit-text-decoration-line: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

.entry-content .leaflet-container a:hover,
.leaflet-bar a:hover {
    text-decoration: none !important;
    text-decoration-line: none !important;
}

.leaflet-bar a.leaflet-control-zoom-in {
    border-bottom: 1px solid rgba(0, 0, 0, 0.12) !important;
}

/* Hide border bottom on last leaflet control button */
.leaflet-bar a:last-child {
    border-bottom: none !important;
}

/* Loader animation */
.aso-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: aso-spin 1s ease-in-out infinite;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes aso-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* --- Search Box Styling --- */
.aso-map-search-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    margin-bottom: 8px;
}

.aso-map-search-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--aso-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aso-map-search-box {
    position: relative;
    width: 100%;
}

.aso-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
}

#aso_map_search_input {
    width: 100%;
    height: auto !important;
    box-sizing: border-box !important;
    line-height: normal !important;
    padding: 12px 36px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--aso-text);
    background-color: #ffffff;
    border: 1px solid var(--aso-border);
    border-radius: 8px;
    outline: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
}

#aso_map_search_input:focus {
    border-color: var(--aso-primary);
    box-shadow: 0 0 0 3px var(--aso-primary-light);
}

button.aso-search-clear,
.aso-search-clear {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    background: #e2e8f0 !important;
    border: none !important;
    border-radius: 50% !important;
    color: #64748b !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    line-height: 1 !important;
}

.aso-search-clear svg {
    display: block;
    width: 12px;
    height: 12px;
    stroke-width: 2.5;
    pointer-events: none;
}

button.aso-search-clear:hover,
.aso-search-clear:hover {
    background: #cbd5e1 !important;
    color: #0f172a !important;
    transform: translateY(-50%) scale(1.08) !important;
}

button.aso-search-clear:active,
.aso-search-clear:active {
    background: #94a3b8 !important;
    color: #000000 !important;
    transform: translateY(-50%) scale(0.92) !important;
}

.aso-search-spinner {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--aso-primary);
    border-radius: 50%;
    animation: aso-spin 0.8s linear infinite;
}

.aso-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--aso-border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 1010;
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
}

.aso-search-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.aso-search-item:last-child {
    border-bottom: none;
}

.aso-search-item:hover, .aso-search-item.active {
    background: #f8fafc;
}

.aso-search-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.aso-search-item-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aso-search-badge {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.aso-badge-division {
    background: #e0f2fe;
    color: #0369a1;
}

.aso-badge-district {
    background: #dcfce7;
    color: #15803d;
}

.aso-badge-zone {
    background: #fef3c7;
    color: #b45309;
}

.aso-badge-subzone {
    background: #f3e8ff;
    color: #7e22ce;
}

.aso-search-item-sub {
    font-size: 0.76rem;
    color: var(--aso-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aso-search-empty {
    padding: 16px 14px;
    text-align: center;
    color: var(--aso-text-muted);
    font-size: 0.85rem;
}


.aso-my-location-btn {
    display: none !important; /* Hidden on PC */
    position: absolute;
    bottom: 85px;
    right: 22px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #ffffff 0%, #f0fdf4 100%);
    border: 1.5px solid rgba(20, 168, 0, 0.2);
    border-radius: 50%;
    cursor: pointer;
    color: #14A800;
    box-shadow: 0 4px 14px rgba(20, 168, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.aso-my-location-btn svg {
    display: block;
    width: 22px;
    height: 22px;
    transition: all 0.25s ease;
    filter: drop-shadow(0 1px 1px rgba(20, 168, 0, 0.15));
}

.aso-my-location-btn:hover {
    background: linear-gradient(145deg, #f0fdf4 0%, #dcfce7 100%);
    color: #108A00;
    border-color: rgba(20, 168, 0, 0.35);
    box-shadow: 0 6px 20px rgba(20, 168, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.aso-my-location-btn:active {
    background: linear-gradient(145deg, #dcfce7 0%, #bbf7d0 100%);
    color: #0d7a00;
    border-color: rgba(20, 168, 0, 0.45);
    transform: scale(0.93);
    box-shadow: 0 2px 8px rgba(20, 168, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.aso-my-location-btn.loading {
    background: linear-gradient(145deg, #f0fdf4 0%, #dcfce7 100%);
    color: #14A800;
    border-color: rgba(20, 168, 0, 0.3);
    box-shadow: 0 0 0 4px rgba(20, 168, 0, 0.1), 0 4px 14px rgba(20, 168, 0, 0.15);
    pointer-events: none;
}

.aso-my-location-btn.loading svg {
    animation: aso-loc-spin 0.9s linear infinite;
}

@keyframes aso-loc-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* User Location Marker Pulsing Ring */
.aso-my-loc-pulse {
    position: relative;
    width: 18px;
    height: 18px;
    background: #14A800;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
}

.aso-my-loc-pulse::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(20, 168, 0, 0.4);
    animation: aso-loc-pulse-anim 1.8s infinite ease-out;
}

@keyframes aso-loc-pulse-anim {
    0% { transform: scale(0.7); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

@media (max-width: 921px) {
    body.page-id-125 #content.site-content,
    body.page-id-125 .site-content .ast-container,
    body.page-id-125 #primary.content-area,
    body.page-id-125 .site-main,
    body.page-id-125 article.post-125,
    body.page-id-125 .entry-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .aso-map-wrapper-global {
        flex-direction: column !important;
        height: auto !important;
        min-height: auto !important;
        width: 100% !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin: 0 !important;
    }
    
    .aso-map-sidebar {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        border: none !important;
        border-bottom: 1px solid rgba(0, 22, 46, 0.08) !important;
        box-shadow: none !important;
        z-index: 1000 !important;
        backdrop-filter: none !important;
        background: #ffffff !important;
        padding: 20px 16px !important;
        box-sizing: border-box !important;
    }

    .aso-map-canvas-wrapper {
        position: relative !important;
        height: 65vh !important;
        min-height: 450px !important;
        width: 100% !important;
        flex: none !important;
        border-radius: 0 !important;
    }

    #aso_map_canvas {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
    }

    .aso-my-location-btn {
        display: flex !important;
        position: absolute !important;
        bottom: 85px !important; /* Positioned above Astra's #ast-scroll-top button */
        right: 22px !important;
        z-index: 1000 !important;
    }
}

/* Location Permission Guide Modal */
.aso-loc-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.aso-loc-modal-backdrop.active {
    display: flex !important;
    opacity: 1;
}

.aso-loc-modal {
    background: #ffffff;
    width: 100%;
    max-width: 400px;
    border-radius: 18px;
    padding: 24px 20px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    position: relative;
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-align: left;
}

.aso-loc-modal-backdrop.active .aso-loc-modal {
    transform: scale(1);
}

.aso-loc-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.aso-loc-modal-icon {
    width: 44px;
    height: 44px;
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fee2e2;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aso-loc-modal-icon svg {
    width: 24px;
    height: 24px;
}

.aso-loc-modal-title {
    font-size: 1.12rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.aso-loc-modal-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
}

.aso-loc-steps {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aso-loc-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.aso-loc-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #14A800;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.aso-loc-step-text {
    font-size: 0.85rem;
    color: #334155;
    line-height: 1.45;
    margin: 0;
}

.aso-loc-step-text strong {
    color: #0f172a;
}

.aso-chrome-tune-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #334155;
    color: #f8fafc;
    border-radius: 50%;
    vertical-align: middle;
    margin: 0 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.aso-chrome-tune-icon svg {
    display: block;
    width: 15px;
    height: 15px;
}

.aso-loc-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aso-loc-reload-btn {
    width: 100%;
    background: #14A800;
    color: #ffffff;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(20, 168, 0, 0.25);
    transition: all 0.2s ease;
    font-family: inherit;
}

.aso-loc-reload-btn:hover {
    background: #108A00;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(20, 168, 0, 0.35);
}

.aso-loc-reload-btn:active {
    transform: scale(0.98);
}

.aso-loc-close-btn {
    width: 100%;
    background: transparent;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.aso-loc-close-btn:hover {
    background: #f1f5f9;
    color: #334155;
}
