/**
 * Map Specific Styles
 * Google Maps container and overlays
 */

/* =================================================================
   MAP CANVAS
   ================================================================= */

.map-canvas {
    width: 100%;
    height: 100%;
    background-color: var(--color-gray-200);
}

/* =================================================================
   MAP TOP-LEFT STACK (floating toggle + active pills)
   ================================================================= */

.map-top-left-stack {
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    max-width: min(460px, calc(100% - 3rem));
    z-index: 14;
    pointer-events: none;
}

.map-top-left-stack > * {
    pointer-events: auto;
}

.map-top-left-stack .active-state-pills {
    max-width: 100%;
}

.map-top-left-stack .category-floating-toggle {
    align-self: flex-start;
}

.side-panel.is-collapsed + .map-container .map-top-left-stack {
    left: 0.5rem;
    top: 0.75rem;
    gap: 0.55rem;
}

/* =================================================================
   MAP CONTEXT CHIP
   ================================================================= */

.map-context-chip {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    background-color: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
    font-size: 0.8rem;
    z-index: 4;
}

.context-legend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    color: #0f172a;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.legend-swatch--primary {
    background: #1a5632;
    border: 1px solid #0f3a23;
}

.legend-swatch--context {
    background: #f5f8f4;
    border: 1px solid #b6c4ba;
}

/* =================================================================
   PARKING / ACCESSIBILITY LAYERS CONTROL
   ================================================================= */

.parking-accessibility-control {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    left: auto;
    width: min(280px, calc(100% - 2.5rem));
    z-index: 13;
    font-family: inherit;
}

.pa-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.95rem;
    border-radius: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background-color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
    gap: 0.75rem;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.pa-toggle:hover,
.pa-toggle:focus-visible {
    border-color: rgba(26, 86, 50, 0.35);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
}

.pa-toggle:focus-visible {
    outline: 3px solid #1a5632;
    outline-offset: 2px;
}

.pa-toggle-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background-color: rgba(26, 86, 50, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1a5632;
    transition: transform 200ms ease;
}

.parking-accessibility-control.is-open .pa-toggle-icon {
    transform: rotate(180deg);
}

.pa-panel {
    margin-top: 0.6rem;
    padding: 0.9rem 0.85rem;
    background-color: rgba(255, 255, 255, 0.96);
    border-radius: 1.2rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 24px 45px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.pa-panel[hidden] {
    display: none !important;
}

.pa-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border: 0;
}

.pa-section[hidden] {
    display: none;
}

.pa-section-title {
    margin: 0 0 0.3rem;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.6);
    font-weight: 700;
}

.pa-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.pa-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pa-option-body {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.35rem 0.55rem;
    border-radius: 0.85rem;
    transition: background-color 150ms ease, box-shadow 150ms ease;
}

.pa-option:hover .pa-option-body {
    background-color: rgba(26, 86, 50, 0.04);
}

.pa-check-indicator {
    width: 24px;
    height: 24px;
    border-radius: 0.35rem;
    border: 2px solid rgba(15, 23, 42, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    flex-shrink: 0;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.pa-check-indicator::after {
    content: '';
    width: 8px;
    height: 12px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 150ms ease;
}

.pa-option-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    color: #0f172a;
    font-size: 0.92rem;
}

.pa-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.08);
}

.pa-dot-public              { background-color: var(--color-parking-public); }
.pa-dot-student             { background-color: var(--color-parking-student); }
.pa-dot-employee            { background-color: var(--color-parking-employee); }
.pa-dot-accessible-parking  { background-color: #f79c1b; }
.pa-dot-accessible-entrances { background-color: #16a34a; }

.pa-checkbox:checked + .pa-option-body .pa-check-indicator {
    background-color: #1a5632;
    border-color: #1a5632;
}

.pa-checkbox:checked + .pa-option-body .pa-check-indicator::after {
    opacity: 1;
}

.pa-checkbox:checked + .pa-option-body .pa-option-label {
    color: #1a5632;
}

.pa-checkbox:checked + .pa-option-body {
    background-color: rgba(26, 86, 50, 0.08);
    box-shadow: inset 0 0 0 1px rgba(26, 86, 50, 0.12);
}

.pa-checkbox:focus-visible + .pa-option-body {
    box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.4);
    background-color: rgba(26, 86, 50, 0.08);
}

.pa-checkbox:focus-visible + .pa-option-body .pa-check-indicator {
    border-color: rgba(26, 86, 50, 0.55);
}

/* =================================================================
   MAP TYPE TOGGLE (Map / Satellite)
   ================================================================= */

.map-base-toggle {
    position: absolute;
    bottom: 1.5rem;
    left: 1.25rem;
    right: auto;
    top: auto;
    z-index: 4;
}

.map-type-group {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.25rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(10px);
}

.map-type-btn {
    border: none;
    background: transparent;
    color: rgba(15, 23, 42, 0.7);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast), opacity var(--transition-fast);
}

.map-type-btn .map-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: rgba(15, 23, 42, 0.55);
}

.map-type-btn.is-active {
    background: #1a5632;
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(26, 86, 50, 0.25);
}

.map-type-btn.is-active .map-type-icon {
    color: #ffffff;
}

/* =================================================================
   MARKER LABELS
   ================================================================= */

.marker-label {
    position: absolute;
    background-color: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
    transform: translate(-50%, -100%);
    transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, color 150ms ease, opacity 150ms ease;
    pointer-events: auto;
}

.marker-label--stack-1 {
    transform: translate(-50%, calc(-100% - 8px));
}

.marker-label--stack-2 {
    transform: translate(-50%, calc(-100% - 16px));
}

.marker-label.is-selected {
    background-color: #1a5632;
    border-color: rgba(26, 86, 50, 0.9);
    color: #ffffff;
    box-shadow: 0 16px 30px rgba(26, 86, 50, 0.35);
}

.marker-label.is-hovered {
    transform: translate(-50%, -110%) scale(1.05);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.28);
}

.marker-label.is-dimmed {
    opacity: 0.45;
    box-shadow: none;
}

/* =================================================================
   GOOGLE MAPS UI OVERRIDES
   ================================================================= */

.gm-style button {
    min-height: 44px !important;
    min-width: 44px !important;
}

.gm-style button:focus-visible,
.gm-style [tabindex]:focus-visible {
    outline: none;
}

.gm-style .gm-style-iw-c {
    border-radius: var(--radius-lg) !important;
}

.gm-style .gm-style-iw-d {
    overflow: auto !important;
}
/* =================================================================
   RECAPTCHA — hidden on all views (notice kept in feedback form)
   ================================================================= */

.grecaptcha-badge {
    display: none !important;
}
/* =================================================================
   DESKTOP ONLY: Layers control repositions when info panel is open
   (top set dynamically by parking-accessibility-control.js)
   ================================================================= */

@media (min-width: 801px) {
    .parking-accessibility-control.is-panel-open {
        right: auto;
        left: 1.5rem;
        width: min(280px, calc(100% - 3rem));
        transition: top 250ms cubic-bezier(0.4, 0, 0.2, 1), left 250ms cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* =================================================================
   MOBILE / TABLET (≤800px)
   ================================================================= */

@media (max-width: 800px) {

    /* --- Hide layers control (not needed on mobile) --- */
    .parking-accessibility-control {
        display: none;
    }

    /* --- Hide active state pills in map stack --- */
    .map-top-left-stack [data-pills-block] {
        display: none !important;
    }

    /* --- Map/Satellite toggle: move to top-left --- */
    .map-base-toggle {
        top: 0.75rem;
        left: 0.75rem;
        bottom: auto;
        right: auto;
    }

    /* --- Menu button: fixed bottom-center --- */
    .category-floating-toggle {
        display: inline-flex !important;
        position: fixed;
        bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px));
        left: 50%;
        transform: translateX(-50%);
        top: auto;
        right: auto;
        margin: 0;
        z-index: 1049;
        min-width: 130px;
        justify-content: center;
        padding: 0.6rem 1.2rem;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
    }

    /* Chevron points up when closed (menu will open upward) */
    .category-floating-toggle[data-state="collapsed"] .category-toggle-icon i {
        transform: rotate(0deg);
    }

    /* Chevron points down when menu is open */
    .category-floating-toggle[data-state="expanded"] .category-toggle-icon i {
        transform: rotate(180deg);
    }

    /* --- Side panel scroll: fix for mobile --- */
    /* Give content an explicit height so overflow-y can scroll */
    .side-panel-content {
        height: 85vh;
        max-height: 85vh;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* Remove flex stretch that prevents scroll container from working */
    .side-panel-section {
        flex: 0 0 auto;
        min-height: unset;
        overflow: visible;
    }
}

/* =================================================================
   SMALL MOBILE (≤640px)
   ================================================================= */

@media (max-width: 640px) {
    .map-top-left-stack {
        top: 0.75rem;
        left: 0.75rem;
        max-width: min(60vw, 230px);
        gap: 0.35rem;
    }

    .map-top-left-stack .active-state-pills {
        width: 100%;
    }

    .map-type-group {
        padding: 0.2rem;
    }

    .map-type-btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
}
