/* REF Mobile Cockpit - Stitch Design (Optimized) */
:root {
    --ref-primary: #212759;
    --ref-secondary: #2BA8A8;
    --ref-surface: #FFFFFF;
    --ref-bg: #F8F9FA;
    --ref-text: #333333;
    --ref-border: #E5E7EB;
    --ref-radius-lg: 12px;
}

/* Dark Mode Support (via .dark class on body) */
.dark {
    --ref-primary: #212759;
    /* Kept brand logic */
    --ref-secondary: #2BA8A8;
    --ref-surface: #1E1E1E;
    --ref-bg: #121212;
    --ref-text: #E0E0E0;
    --ref-border: #374151;
}

/* Base Styles */
.ref-cockpit-trigger {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ref-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.ref-cockpit-trigger:hover {
    transform: translateX(-50%) scale(1.05);
}

.ref-mobile-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    /* Default mobile */
    max-width: 420px;
    /* Stitch Design constraint */
    background: var(--ref-surface);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.ref-mobile-modal.is-open {
    transform: translateX(0);
}

/* Header */
.ref-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--ref-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ref-surface);
}

.ref-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ref-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ref-btn-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #9CA3AF;
    transition: color 0.2s;
}

.ref-btn-close:hover {
    color: var(--ref-primary);
}

/* Body */
.ref-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--ref-surface);
}

/* Inputs & Selects (Stitch Design) */
.ref-input-group {
    margin-bottom: 24px;
}

.ref-label {
    display: block;
    font-size: 0.75rem;
    /* text-xs */
    font-weight: 700;
    color: var(--ref-primary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ref-select,
.ref-text-input {
    width: 100%;
    padding: 10px 12px;
    background: #F9FAFB;
    border: 1px solid var(--ref-border);
    border-radius: var(--ref-radius);
    color: var(--ref-text);
    font-size: 0.875rem;
    /* text-sm */
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ref-select:focus,
.ref-text-input:focus {
    outline: none;
    border-color: var(--ref-primary);
    box-shadow: 0 0 0 1px var(--ref-primary);
}

/* Checkbox Grid (Amenities/Rooms) */
.ref-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.ref-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--ref-radius);
    cursor: pointer;
    transition: background 0.2s;
}

.ref-checkbox-label:hover {
    background: #F3F4F6;
}

.ref-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid #D1D5DB;
    accent-color: var(--ref-primary);
}

/* Chips (Rooms/Suites) */
.ref-chips-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.ref-chip-label {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    background: #F9FAFB;
    border: 1px solid transparent;
    border-radius: var(--ref-radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.ref-chip-label:hover {
    border-color: #E5E7EB;
}

.ref-chip-input {
    display: none;
}

/* Checked State for Chips */
.ref-chip-input:checked+span {
    background: rgba(33, 39, 89, 0.05);
    /* primary/5 */
    border-color: var(--ref-primary);
    color: var(--ref-primary);
    font-weight: 600;
}

/* Footer */
.ref-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--ref-border);
    background: var(--ref-surface);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ref-btn-apply {
    width: 100%;
    background: var(--ref-primary);
    color: white;
    padding: 14px;
    border: none;
    border-radius: var(--ref-radius);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, transform 0.1s;
}

.ref-btn-apply:hover {
    background: #1a1f4b;
}

.ref-btn-apply:active {
    transform: scale(0.98);
}

/* Real Dual Range Slider */
.ref-range-wrapper {
    position: relative;
    height: 24px;
    margin-bottom: 12px;
}

.ref-range-track-bg {
    width: 100%;
    height: 4px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #E5E7EB;
    border-radius: 2px;
    z-index: 1;
}

/* JS will update this span to show active range */
.ref-range-track-fill {
    position: absolute;
    height: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--ref-primary);
    z-index: 2;
    pointer-events: none;
}

.ref-range-input {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    /* Let clicks pass through */
    position: absolute;
    width: 100%;
    height: 24px;
    /* Match wrapper height */
    top: 0;
    left: 0;
    background: none;
    z-index: 3;
    margin: 0;
}

/* Thumb Styles */
.ref-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: all;
    /* Catch clicks on thumb */
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--ref-primary);
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 4;
}

.ref-range-input::-moz-range-thumb {
    pointer-events: all;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--ref-primary);
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 4;
}

/* Remove default focus outline */
.ref-range-input:focus {
    outline: none;
}

/* Toast Message (Limit Feedback) */
.ref-limit-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #EF4444;
    /* Red 500 */
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    white-space: nowrap;
}

.ref-limit-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}