/* --- Global Styles --- */
#previewPanel {
    background: #212529;
    display: none; /* Initial state, triggered by JS */
    z-index: 10000;
}

#previewPanel iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

/* --- Tablet & Desktop Layout (992px and up) --- */
@media (min-width: 992px) {
    #previewPanel {
        position: fixed;
        top: 0;
        right: 0;
        width: 33.33vw; /* Initial width, overwritten by JS */
        height: 100vh;
        display: block; 
        border-left: 1px solid #495057;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    }

    /* --- Interactive Resizer Handle --- */
    #resizer {
        position: fixed;
        top: 0;
        right: 33.33vw; 
        width: 16px; 
        height: 100vh;
        cursor: col-resize;
        z-index: 10001;
        background: transparent;
        transition: background 0.2s;
        /* FIXED: Removed flex centering, using block for manual positioning */
        display: block !important;
    }

    /* Visual "drag" handle (three vertical dots) */
    #resizer::after {
        content: "⋮"; 
        position: absolute;
        /* ADJUST THIS: Positioning next to control elements */
        top: 65px; 
        left: 50%;
        transform: translateX(-50%);
        
        color: #adb5bd;
        font-size: 32px;
        font-weight: bold;
        background: #343a40;
        border: 1px solid #495057;
        border-radius: 6px;
        padding: 12px 3px;
        opacity: 0.6;
        transition: all 0.2s ease;
        pointer-events: none;
        line-height: 1;
        display: block !important;
    }

    #resizer:hover::after, #resizer.active::after {
        opacity: 1;
        color: #f8f9fa; 
        border-color: #adb5bd;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    }

    #resizer:hover, #resizer.active {
        background: transparent !important;
        border-left: none !important;
    }

    .container {
        margin-left: 2rem !important;
        margin-right: calc(33.33vw + 2rem) !important; 
        max-width: none !important;
        width: auto !important;
        display: block;
        overflow: hidden;
    }
}

/* --- Mobile & Small Tablets (Below 992px) --- */
@media (max-width: 991px) {
    .container {
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow: visible !important;
    }

    #previewPanel, #resizer {
        display: none !important;
    }

    #mobileFilterWrapper {
        max-width: 500px;
        margin: 0 auto;
    }
}

/* Dual range slider styles for Bootstrap dark theme */
.form-range.position-absolute {
    pointer-events: none;
    background: none;
    appearance: none;
    width: 100%;
}
#rangeMin {
    z-index: 3;
}
#rangeMax {
    z-index: 2;
}
#rangeMin:active, #rangeMax:active {
    z-index: 4;
}
.form-range::-webkit-slider-thumb {
    pointer-events: auto;
    cursor: pointer;
    background-color: var(--bs-info);
    border: 2px solid var(--bs-dark);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-top: -6px;
}
/* LEFT THUMB: Keeping right shift to align with the edge */
#rangeMin::-webkit-slider-thumb {
    transform: translateX(10px);
}
#rangeMin::-moz-range-thumb {
    transform: translateX(10px);
}
/* RIGHT THUMB: Shift slightly back to the LEFT (negative value) */
#rangeMax::-webkit-slider-thumb {
    transform: translateX(-6px);
}
#rangeMax::-moz-range-thumb {
    transform: translateX(-6px);
}
.form-range::-moz-range-thumb {
    pointer-events: auto;
    cursor: pointer;
    background-color: var(--bs-info);
    border: 2px solid var(--bs-dark);
    width: 20px;
    height: 20px;
    border-radius: 50%;
}
.form-range:focus, .form-range:active {
    outline: none;
    box-shadow: none;
}
.form-range::-webkit-slider-runnable-track {
    background-color: rgba(255, 255, 255, 0.1) !important;
    height: 8px;
    border-radius: 4px;
}
.form-range::-moz-range-track {
    background-color: rgba(255, 255, 255, 0.1) !important;
    height: 8px;
    border-radius: 4px;
}

/* --- Additional Elements --- */
a { text-decoration: none; }
.external-icon svg { vertical-align: middle; }
#listingFilterWrapper { max-width: 500px; }

/* --- Global Stability Fix --- */
/* Prevents page jumping on mobile when results are filtered out */
main { 
    min-height: 100vh; 
    align-content: flex-start; 
}
