/* assets/css/locations-map-section.css */

.map-hologram-container {
    --map-bg: #141314;
    --map-panel: rgba(20, 19, 20, 0.88);
    --map-panel-soft: rgba(238, 238, 238, 0.045);
    --map-line: rgba(238, 238, 238, 0.14);
    --map-line-strong: rgba(238, 238, 238, 0.22);
    --map-ink: #eeeeee;
    --map-muted: rgba(238, 238, 238, 0.58);
    --map-brand: #00f2ff;
    --map-warm: #f4b35d;
    --map-radius: 8px;
    position: relative;
    min-height: 700px;
    height: 700px;
    isolation: isolate;
    overflow: visible;
    color: var(--map-ink);
    background: var(--map-bg);
    font-family: var(--font-sans), "Sarabun", sans-serif;
}

.map-section-title {
    position: absolute;
    top: 24px;
    right: 28px;
    z-index: 20;
    max-width: min(360px, calc(100% - 112px));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    pointer-events: none;
    text-align: right;
}

.map-section-title span {
    color: var(--map-muted);
    font-family: "Geist Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
}

.map-section-title strong {
    color: var(--map-ink);
    font-size: clamp(18px, 2vw, 28px);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: 0;
}

.map-hologram-container::before,
.map-hologram-container::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
}

.map-hologram-container::before {
    inset: -1px 0 auto;
    height: 80px;
    background: linear-gradient(180deg, var(--map-bg) 0%, rgba(20, 19, 20, 0) 100%);
}

.map-hologram-container::after {
    inset: auto 0 -1px;
    height: 96px;
    background: linear-gradient(0deg, var(--map-bg) 0%, rgba(20, 19, 20, 0) 100%);
}

#map {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--map-bg);
}

.leaflet-tile-pane {
    filter: grayscale(1) invert(0.92) brightness(0.66) contrast(1.12) saturate(0.9) !important;
}

#toggle-sidebar-btn {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 10010;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--map-ink);
    background: rgba(20, 19, 20, 0.82);
    border: 1px solid var(--map-line);
    border-radius: var(--map-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(18px);
    transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

#toggle-sidebar-btn.toggle-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
}

#toggle-sidebar-btn:hover {
    background: rgba(20, 19, 20, 0.94);
    border-color: var(--map-line-strong);
    transform: translateY(-1px);
}

#toggle-sidebar-btn svg {
    width: 22px;
    height: 22px;
}

#sidebar {
    position: absolute;
    top: -24px;
    bottom: -24px;
    left: 0;
    z-index: 10000;
    width: min(380px, 34vw);
    max-width: calc(100% - 96px);
    height: auto;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: 0;
    color: var(--map-ink);
    background: var(--map-panel);
    border: 0;
    border-top: 1px solid var(--map-line);
    border-right: 1px solid var(--map-line);
    border-bottom: 1px solid var(--map-line);
    border-radius: 0;
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(22px);
    transition: transform 360ms cubic-bezier(0.4, 0, 0.2, 1), opacity 260ms ease;
}

.sidebar-hidden {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

#sidebar > div:first-child {
    position: relative;
    flex: 0 0 auto;
    padding: 22px 58px 16px 22px;
    background: rgba(238, 238, 238, 0.035);
    border-bottom: 1px solid var(--map-line);
}

#sidebar-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--map-muted);
    background: rgba(238, 238, 238, 0.04);
    border: 1px solid var(--map-line);
    border-radius: 6px;
    cursor: pointer;
    transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

#sidebar-close-btn:hover {
    color: var(--map-ink);
    background: rgba(238, 238, 238, 0.07);
    border-color: var(--map-line-strong);
}

#sidebar-close-btn svg {
    width: 18px;
    height: 18px;
}

#sidebar > div:first-child h1 {
    margin: 0 0 6px;
    color: var(--map-ink);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.32;
    letter-spacing: 0;
    text-shadow: none;
}

#sidebar > div:first-child p {
    margin: 0;
    color: var(--map-muted);
    font-family: "Geist Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 10px;
    letter-spacing: 0.06em;
}

#sidebar > div:nth-child(2) {
    flex: 0 0 auto;
    display: grid;
    gap: 10px;
    padding: 14px;
    background: rgba(20, 19, 20, 0.62);
    border-bottom: 1px solid var(--map-line);
}

#sidebar > div:nth-child(2) > div:first-of-type {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

#location-search,
#filter-status,
#filter-traffic {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 0 12px;
    color: var(--map-ink);
    background: rgba(238, 238, 238, 0.055);
    border: 1px solid var(--map-line);
    border-radius: 6px;
    outline: none;
    font-family: var(--font-sans), "Sarabun", sans-serif;
    font-size: 12px;
    letter-spacing: 0;
    transition: border-color 160ms ease, background-color 160ms ease;
}

#filter-status,
#filter-traffic {
    appearance: none;
    color: var(--map-ink);
    padding-right: 28px;
    background-color: rgba(34, 33, 34, 0.96);
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(238, 238, 238, 0.72) 50%),
        linear-gradient(135deg, rgba(238, 238, 238, 0.72) 50%, transparent 50%);
    background-position:
        calc(100% - 16px) 16px,
        calc(100% - 11px) 16px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

#filter-status option,
#filter-traffic option {
    color: #eeeeee;
    background: #222122;
}

#location-search::placeholder {
    color: rgba(238, 238, 238, 0.42);
}

#location-search:focus,
#filter-status:focus,
#filter-traffic:focus {
    background: rgba(238, 238, 238, 0.075);
    border-color: rgba(0, 242, 255, 0.55);
}

#result-count {
    display: inline-flex;
    width: fit-content;
    min-height: 24px;
    align-items: center;
    padding: 4px 9px;
    color: var(--map-muted);
    background: rgba(238, 238, 238, 0.045);
    border: 1px solid rgba(238, 238, 238, 0.09);
    border-radius: 999px;
    font-size: 11px;
}

#location-list {
    flex: 1;
    min-height: 0;
    padding: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.adgo-location-card,
#location-list > div {
    position: relative;
    display: grid;
    gap: 8px;
    min-height: 68px;
    margin: 0 0 6px;
    padding: 12px;
    color: var(--map-ink);
    background: var(--map-panel-soft);
    border: 1px solid rgba(238, 238, 238, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.adgo-location-card:hover,
#location-list > div:hover {
    transform: translateX(1px);
    background: rgba(238, 238, 238, 0.07);
    border-color: rgba(238, 238, 238, 0.18);
}

.adgo-location-card::before,
#location-list > div::before {
    content: "";
    position: absolute;
    inset: 12px auto 12px 0;
    width: 2px;
    background: var(--map-brand);
    opacity: 0.78;
}

#location-list h4 {
    margin: 0;
    color: var(--map-ink);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.36;
}

#location-list .adgo-location-card span {
    color: var(--map-muted);
    background: transparent;
    border-color: transparent;
}

#location-list .adgo-location-card > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

#location-list .adgo-location-card > div:last-child span {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    padding: 0 7px;
    color: var(--map-muted);
    background: rgba(20, 19, 20, 0.52);
    border: 1px solid rgba(238, 238, 238, 0.08);
    border-radius: 999px;
    font-size: 10px;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
    cursor: pointer;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
    cursor: pointer;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(238, 238, 238, 0.18);
    border-radius: 999px;
    cursor: pointer;
}

.custom-scrollbar:hover::-webkit-scrollbar-thumb {
    background: rgba(238, 238, 238, 0.34);
    cursor: pointer;
}

.custom-pin {
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
    border: 0 !important;
}

.adgo-map-pin {
    --pin-color: var(--map-brand);
    position: relative;
    display: block;
    width: 30px;
    height: 30px;
    transform: translate(-15px, -15px);
}

.adgo-map-pin--pending {
    --pin-color: var(--map-warm);
}

.adgo-map-pin__pulse,
.adgo-map-pin__core {
    position: absolute;
    inset: 0;
    border-radius: 999px;
}

.adgo-map-pin__pulse {
    border: 1px solid color-mix(in srgb, var(--pin-color) 78%, transparent);
    animation: adgo-map-pulse 2s ease-out infinite;
}

.adgo-map-pin__core {
    inset: 9px;
    background: var(--pin-color);
    border: 3px solid rgba(20, 19, 20, 0.95);
    box-shadow: 0 0 16px color-mix(in srgb, var(--pin-color) 45%, transparent);
}

@keyframes adgo-map-pulse {
    0% {
        transform: scale(0.52);
        opacity: 0.6;
    }
    80%,
    100% {
        transform: scale(1.24);
        opacity: 0;
    }
}

.leaflet-control-zoom {
    overflow: hidden;
    border: 1px solid var(--map-line) !important;
    border-radius: var(--map-radius) !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4) !important;
    margin-right: 18px !important;
    margin-bottom: 18px !important;
}

.leaflet-control-zoom a {
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    color: var(--map-ink) !important;
    background: rgba(20, 19, 20, 0.88) !important;
    border-color: var(--map-line) !important;
}

.leaflet-control-zoom a:hover {
    color: #141314 !important;
    background: var(--map-brand) !important;
}

.leaflet-popup-content-wrapper {
    overflow: hidden;
    color: var(--map-ink) !important;
    background: rgba(20, 19, 20, 0.94) !important;
    border: 1px solid var(--map-line);
    border-radius: var(--map-radius);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

.leaflet-popup-tip {
    background: rgba(20, 19, 20, 0.94) !important;
}

.leaflet-popup-close-button {
    color: var(--map-muted) !important;
}

.leaflet-popup-content {
    margin: 14px;
}

.leaflet-popup-content h3 {
    color: var(--map-ink);
    border-bottom-color: var(--map-line);
}

.leaflet-popup-content button {
    color: #141314 !important;
    background: var(--map-brand) !important;
    border: 1px solid var(--map-brand) !important;
    border-radius: 6px !important;
    font-weight: 600;
}

@media (max-width: 767px) {
    .map-hologram-container {
        min-height: 620px;
        height: 620px;
    }

    .map-section-title {
        top: 16px;
        right: 16px;
        max-width: calc(100% - 86px);
    }

    .map-section-title strong {
        font-size: 18px;
    }

    #sidebar {
        top: -16px;
        bottom: -16px;
        width: min(360px, calc(100% - 72px));
        max-width: calc(100% - 72px);
    }

    #toggle-sidebar-btn {
        top: 14px;
        left: 14px;
    }

    #sidebar > div:nth-child(2) > div:first-of-type {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    #sidebar {
        width: calc(100% - 64px);
        max-width: calc(100% - 64px);
    }

    .leaflet-control-zoom a {
        width: 36px !important;
        height: 36px !important;
        line-height: 36px !important;
    }
}
