/* =========================================
   Posao EU Custom Map Markers — Filter Panel (v2.3.0)
   Brand: #F28C0F (orange), #D97D0A (dark orange), #1d1b20 (ink)
   ========================================= */

/* --- Filter toggle button (pill with icon + label, sits left of fullscreen) --- */
.pmm-filter-btn {
    position: absolute;
    top: 10px;
    right: 58px;            /* 40px fs button + 8px gap + 10px edge */
    z-index: 6;
    height: 40px;
    padding: 0 14px;
    margin: 0;
    border: none;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1d1b20;
    font-family: Quicksand, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 700;
    transition: background 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.pmm-filter-btn:hover,
.pmm-filter-btn:focus {
    background: #f5f5f5;
    outline: none;
}

.pmm-filter-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    flex: 0 0 auto;
    pointer-events: none;
}

.pmm-filter-btn__label {
    white-space: nowrap;
    pointer-events: none;
}

/* Active-filter count badge */
.pmm-filter-btn__badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #F28C0F;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* When the map is fullscreen, lift the button to match fullscreen.css offsets */
.pmm-map--fullscreen .pmm-filter-btn {
    top: 14px;
    right: 62px;
}

/* Mobile: icon-only square button (hide the text label) */
@media (max-width: 768px) {
    .pmm-filter-btn {
        width: 40px;
        padding: 0;
        justify-content: center;
        gap: 0;
    }
    .pmm-filter-btn__label {
        display: none;
    }
}

/* =========================================
   Panel — shared
   ========================================= */
.pmm-filter-panel {
    position: absolute;
    z-index: 10;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.22);
    font-family: Quicksand, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1d1b20;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}

.pmm-filter-panel--open {
    visibility: visible;
    pointer-events: auto;
}

.pmm-filter-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #eee;
    flex: 0 0 auto;
}

.pmm-filter-panel__title {
    font-size: 16px;
    font-weight: 800;
}

.pmm-filter-panel__close {
    border: none;
    background: transparent;
    color: #1d1b20;
    cursor: pointer;
    padding: 4px;
    display: flex;
    line-height: 0;
    border-radius: 6px;
}
.pmm-filter-panel__close:hover { background: #f2f2f2; }

.pmm-filter-panel__body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.pmm-filter-field {
    margin-bottom: 16px;
}
.pmm-filter-field:last-child { margin-bottom: 0; }

.pmm-filter-field__label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6b6b6b;
    margin-bottom: 6px;
}

.pmm-filter-field__select,
.pmm-filter-field__input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1d1b20;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
}

.pmm-filter-field__select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6b6b' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.pmm-filter-field__select:focus,
.pmm-filter-field__input:focus {
    outline: none;
    border-color: #F28C0F;
    box-shadow: 0 0 0 3px rgba(242, 140, 15, 0.15);
}

.pmm-filter-panel__footer {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid #eee;
    flex: 0 0 auto;
}

.pmm-filter-reset {
    flex: 0 0 auto;
    padding: 11px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #1d1b20;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.pmm-filter-reset:hover { background: #f5f5f5; }

.pmm-filter-apply {
    flex: 1 1 auto;
    padding: 11px 16px;
    border: none;
    border-radius: 8px;
    background: #F28C0F;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease;
}
.pmm-filter-apply:hover { background: #D97D0A; }
.pmm-filter-apply:disabled { opacity: 0.6; cursor: default; }

/* =========================================
   Desktop — slide in from the right (280px)
   ========================================= */
@media (min-width: 769px) {
    .pmm-filter-panel {
        top: 0;
        right: 0;
        bottom: 0;
        width: 280px;
        height: 100%;
        transform: translateX(100%);
        transition: transform 0.25s ease, visibility 0s linear 0.25s;
    }
    .pmm-filter-panel--open {
        transform: translateX(0);
        transition: transform 0.25s ease, visibility 0s;
    }
}

/* =========================================
   Mobile — drawer slides up from the bottom
   Fixed to the VIEWPORT (not the map container) so the footer is always
   on-screen regardless of where the map sits in the page. Uses flex with a
   scrollable body and non-shrinking header/footer so the apply button is
   never pushed off the bottom.
   ========================================= */
@media (max-width: 768px) {
    .pmm-filter-panel {
        position: fixed;
        left: 0;
        right: 0;
        /* Sit above the site's fixed mobile nav bar (~70px) + home indicator */
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
        top: auto;
        width: 100%;
        max-height: 68vh;
        height: auto;
        border-radius: 16px 16px 0 0;
        transform: translateY(120%);
        transition: transform 0.28s ease, visibility 0s linear 0.28s;
        /* Above the map and most theme chrome */
        z-index: 100000;
    }
    .pmm-filter-panel--open {
        transform: translateY(0);
        transition: transform 0.28s ease, visibility 0s;
    }
    /* Body scrolls; header + footer stay put so the apply button is visible */
    .pmm-filter-panel__body {
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .pmm-filter-panel__header,
    .pmm-filter-panel__footer {
        flex: 0 0 auto;
    }
    /* Grab handle */
    .pmm-filter-panel__header::before {
        content: "";
        position: absolute;
        top: 7px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: #ddd;
    }
    .pmm-filter-panel__header {
        position: relative;
        padding-top: 20px;
    }
}

/* Safe-area padding for notched iOS in the bottom drawer footer. */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .pmm-filter-panel__footer {
            padding-bottom: max(14px, env(safe-area-inset-bottom));
        }
    }
}
