/* ==========================================================================
   pax-room-selectors.css
   Estilos para los selectores portables (Bootstrap 5 + jQuery).
   Clases namespaced .psel-* / .rsel-* para no chocar con Bootstrap.
   Funciona en desktop (popover) y mobile (bottom-sheet).
   ========================================================================== */

/* --- Trigger (input que abre el panel) --------------------------------- */
.psel-trigger,
.rsel-trigger {
    cursor: pointer;
    background-color: #fff;
}
.psel-trigger:focus,
.rsel-trigger:focus {
    cursor: pointer;
}
/* icono dentro del input */
.psel-trigger-wrap,
.rsel-trigger-wrap {
    position: relative;
    width: 100%;
}
.psel-trigger-wrap .psel-trigger-icon,
.rsel-trigger-wrap .rsel-trigger-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: #555;
    pointer-events: none;
    display: flex;
}
.psel-trigger-wrap .psel-trigger,
.rsel-trigger-wrap .rsel-trigger {
    padding-left: 40px;
}

/* --- Backdrop (sólo visible en mobile) --------------------------------- */
.psel-backdrop,
.rsel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1080;
    display: none;
}
.psel-backdrop.psel-open,
.rsel-backdrop.rsel-open {
    display: none; /* en desktop no se muestra */
}

/* --- Panel flotante ----------------------------------------------------- */
.psel-panel,
.rsel-panel {
    position: absolute;
    z-index: 1090;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16);
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.psel-panel.psel-open,
.rsel-panel.rsel-open {
    display: flex;
}
.psel-panel {
    width: 320px;
}
.rsel-panel {
    width: 500px;
    max-width: calc(100vw - 24px);
}

.psel-body {
    padding: 20px;
}
.rsel-body {
    max-height: 60vh;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

/* --- Fila de contador (compartida) ------------------------------------- */
.psel-counter-row,
.rsel-counter-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.psel-counter-row + .psel-counter-row {
    border-top: 1px solid #e9ecef;
    margin-top: 12px;
    padding-top: 12px;
}

.psel-counter-label,
.rsel-counter-label {
    flex: 1;
}
.psel-label-main,
.rsel-label-main {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
}
.psel-label-sub,
.rsel-label-sub {
    font-size: 12px;
    color: #888;
    margin-top: 1px;
}

.psel-counter-control,
.rsel-counter-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Botones +/- con área táctil >= 44px (mobile) */
.psel-btn,
.rsel-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: 1px solid #bdbdbd;
    border-radius: 50%;
    background: #fff;
    color: #1a1a2e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.15s, border-color 0.15s;
}
.psel-btn:hover,
.rsel-btn:hover {
    background: #f1f3f5;
}
.psel-btn:disabled,
.rsel-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.psel-btn svg,
.rsel-btn svg {
    width: 18px;
    height: 18px;
}

.psel-counter-display,
.rsel-counter-display {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    color: #1a1a2e;
}

/* --- Footer (Listo) ----------------------------------------------------- */
.psel-footer,
.rsel-footer {
    border-top: 1px solid #e9ecef;
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
    background: #fff;
}

/* ===== Específico roomSelector ========================================= */
.rsel-room-item + .rsel-room-item {
    border-top: 1px solid #e9ecef;
    margin-top: 16px;
    padding-top: 16px;
}
.rsel-room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.rsel-room-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: #1a1a2e;
}
.rsel-room-remove {
    border: none;
    background: transparent;
    color: #d32f2f;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.rsel-room-remove:hover {
    background: rgba(211, 47, 47, 0.08);
}
.rsel-guest-counter {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}
.rsel-counter-group {
    flex: 1;
}
.rsel-children-ages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 4px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
}
.rsel-age-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rsel-age-label {
    font-size: 12px;
    font-weight: 500;
    color: #1a1a2e;
}
/* font-size 16px evita el zoom automatico de iOS al enfocar el select */
.rsel-age-select {
    font-size: 16px;
}
.rsel-add-room-wrap {
    padding: 12px 16px;
    border-top: 1px solid #e9ecef;
}
.rsel-add-room {
    border: none;
    background: transparent;
    color: var(--bs-primary, #1976d2);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
}
.rsel-add-room:hover {
    text-decoration: underline;
}

/* ==========================================================================
   MOBILE: panel como bottom-sheet full-width con backdrop
   ========================================================================== */
@media (max-width: 575.98px) {
    .psel-backdrop.psel-open,
    .rsel-backdrop.rsel-open {
        display: block;
    }

    .psel-panel,
    .rsel-panel {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
        animation: psel-slide-up 0.22s ease-out;
    }

    .psel-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .rsel-body {
        max-height: none;
        flex: 1;
    }

    /* footer pegado abajo */
    .psel-footer,
    .rsel-footer {
        position: sticky;
        bottom: 0;
    }

    .rsel-guest-counter {
        gap: 16px;
    }
}

@keyframes psel-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
