/* ============================================================
   WIDGET DE RESERVA AUTOMÁTICA (COMPONENTE MODULAR)
   ============================================================ */

.booking-widget-container {
    position: relative;
    margin: 25px auto;
    width: 100%;
    max-width: 500px;
    z-index: 990;
}

/* --- BOTÓN DISPARADOR --- */
.booking-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(to right, #0199ff, #0145ff);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(1, 69, 255, 0.2);
    transition: transform 0.3s ease, background 0.3s ease;
}

.booking-toggle-btn:active {
    transform: scale(0.98);
}

.booking-toggle-btn .icon-close {
    display: none;
}

.booking-toggle-btn.open {
    background: linear-gradient(to right, #ff4800, #ff9e00);
    box-shadow: 0 4px 15px rgba(255, 72, 0, 0.3);
}

.booking-toggle-btn.open .icon-calendar {
    display: none;
}

.booking-toggle-btn.open .icon-close {
    display: inline-block;
}

/* --- PANEL DESPLEGABLE REESTRUCTURADO (COLAPSABLE REAL) --- */
.booking-panel {
    /* Estado Inicial: Altura cero absoluta para eliminar el hueco */
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    margin-top: 0;
    padding: 0 20px;
    /* Quitamos el padding vertical inicial para que no sume espacio */

    border-radius: 20px;
    border: 0px solid transparent;
    /* El borde inicia en 0 para no dejar líneas fantasmas */
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0);

    /* Transición fluida de la altura y el margen para empujar el contenido */
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.3s ease,
        margin-top 0.3s ease,
        padding 0.4s ease,
        border-width 0.2s ease,
        box-shadow 0.3s ease;
}

/* --- ESTADO ACTIVO (EXPANDIDO Y EMPUJANDO CONTENIDO) --- */
.booking-panel.active {
    max-height: 600px;
    /* Altura máxima estimada para que quepa el formulario */
    opacity: 1;
    visibility: visible;
    margin-top: 15px;
    padding: 20px;
    /* Restauramos el relleno cuando se abre */
    border: 2.5px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* --- CAMPOS INTERNOS (ENTRADA ESCALONADA) --- */
.booking-field {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transform: translateX(30px);
    opacity: 0;
    transition: transform 0.3s ease-in, opacity 0.3s ease-in;
}

/* Evitamos que el último campo deje margen extra al colapsar */
.booking-field:last-child {
    margin-bottom: 0;
}

.booking-field label {
    color: #0145ff;
    /* Azul fuerte de tu marca */
    font-weight: 700;
    font-size: 0.9rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    /* Separación limpia entre el icono y el texto */
}

/* Iconos de Font Awesome dentro de los labels */
.booking-field label i {
    color: #0199ff;
    /* Azul claro de tu marca */
    font-size: 1rem;
}

.booking-field input,
.booking-field select {
    padding: 10px 14px;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    color: #333;
    outline: none;
    font-family: inherit;
}

.booking-field input:focus,
.booking-field select:focus {
    border-color: #0199ff;
    box-shadow: 0 0 8px rgba(1, 153, 255, 0.2);
}

/* Botón de envío final */
.btn-enviar-reserva {
    padding: 12px;
    background-color: #25D366;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.2);
    margin-top: 10px;
    transition: transform 0.2s ease;
}

.btn-enviar-reserva:active {
    transform: scale(0.98);
}

/* Disparador de la animación escalonada */
.booking-panel.active .booking-field {
    transform: translateX(0);
    opacity: 1;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

/* Tiempos de retraso (Delays) calculados por campo */
.booking-panel.active .booking-field:nth-child(1) {
    transition-delay: 0.05s;
}

.booking-panel.active .booking-field:nth-child(2) {
    transition-delay: 0.10s;
}

.booking-panel.active .booking-field:nth-child(3) {
    transition-delay: 0.15s;
}

.booking-panel.active .booking-field:nth-child(4) {
    transition-delay: 0.20s;
}

.booking-panel.active .booking-field:nth-child(5) {
    transition-delay: 0.25s;
}

/* ============================================================
   ESTILIZADO PREMIUM PARA LOS CALENDARIOS (INPUT TYPE="DATE")
   ============================================================ */

/* 1. Estilo base de la caja del calendario y el input de número de personas */
.booking-field input[type="date"],
.booking-field input[type="number"],
.booking-field .flatpickr-input {
    position: relative;
    padding: 12px 14px;
    border: 1.5px solid rgba(1, 69, 255, 0.2);
    /* Borde sutil azul de marca */
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.95);
    color: #333;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
    /* Elimina estilos raros heredados en iOS Safari */
    appearance: none;
    box-sizing: border-box;
    width: 100%;
}

/* Ajuste específico para que el input de número mantenga simetría visual exacta */
.booking-field input[type="number"] {
    cursor: text;
    padding: 11px 14px;
}

/* Estilo adicional solo para campos de fecha nativos */
.booking-field input[type="date"] {
    text-transform: uppercase;
    /* Formato de fecha más ordenado */
}

/* 2. Cambiar el color del icono del calendario nativo (Chrome, Edge, Android) */
.booking-field input[type="date"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230145ff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-position: center;
    background-size: contain;
    cursor: pointer;
    opacity: 0.8;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.booking-field input[type="date"]::-webkit-calendar-picker-indicator:hover {
    transform: scale(1.1);
    opacity: 1;
}

/* 3. Ajustes específicos para que en iPhone (iOS) mantenga el color del texto correcto */
.booking-field input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
    /* Evita que iOS centre la fecha por defecto */
    min-height: 1em;
}

/* 4. Efecto de enfoque cuando el usuario pulsa la caja */
.booking-field input[type="date"]:focus,
.booking-field input[type="number"]:focus,
.booking-field .flatpickr-input:focus {
    border-color: #0199ff;
    background-color: #ffffff;
    box-shadow: 0 0 12px rgba(1, 153, 255, 0.25);
    outline: none;
}

/* ============================================================
   PERSONALIZACIÓN DEL CALENDARIO FLATPICKR (TUS COLORES)
   ============================================================ */

/* Contenedor principal del calendario flotante */
.flatpickr-calendar {
    background: rgba(255, 255, 255, 0.98) !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(1, 69, 255, 0.15) !important;
    border: 2px solid rgba(1, 69, 255, 0.1) !important;
    font-family: inherit !important;
}

/* Barra superior (Mes y Año) en degradado naranja de acción */
.flatpickr-months {
    background: linear-gradient(to right, #ff4800, #ff9e00) !important;
    border-radius: 14px 14px 0 0 !important;
}

/* Control del fondo y las letras en el menú desplegable del mes */
.flatpickr-current-month .flatpickr-monthDropdown-months {
    color: white !important;
    background: #0145ff !important;
    /* Fondo azul fuerte para resaltar el texto blanco */
    font-weight: bold !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 2px 6px !important;
    outline: none !important;
}

/* Estilos para textos generales de la cabecera (Año, Días de la semana) */
span.flatpickr-weekday,
.numInputWrapper span,
.flatpickr-current-month input.numInput.cur-year {
    color: white !important;
    font-weight: bold !important;
}

/* Evita que las opciones del menú de meses se queden en blanco */
.flatpickr-monthDropdown-months option {
    background-color: #ffffff !important;
    color: #333333 !important;
    /* Texto oscuro legible al desplegar en celulares */
}

/* Botones de navegación (Atrás / Adelante) */
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: white !important;
    fill: white !important;
}

/* Días de la semana (Lu, Ma, Mi...) */
span.flatpickr-weekday {
    background: #0145ff !important;
    padding-bottom: 8px !important;
}

/* El día seleccionado por el usuario en naranja dinámico */
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: linear-gradient(to right, #ff4800, #ff9e00) !important;
    border-color: transparent !important;
    color: white !important;
    font-weight: bold !important;
}

/* Efecto hover sobre cualquier día común */
.flatpickr-day:hover {
    background: rgba(1, 153, 255, 0.1) !important;
    color: #0145ff !important;
}

/* Estilo para el día de hoy */
.flatpickr-day.today {
    border-color: #0199ff !important;
}



/* --- CONTENEDOR DEL CAMPO RELATIVO PARA EL GLOBO --- */
.booking-field {
    position: relative;
    transition: z-index 0.2s ease;
}

/* Eleva el contenedor padre si tiene CUALQUIER tipo de error activo adentro */
.booking-field:has(.error-mensaje.visible) {
    z-index: 10;
}

/* --- BURBUJA DE NOTIFICACIÓN CON DESPLIEGUE DE CORTINA (ESTILO HAMBURGUESA) --- */
.error-mensaje {
    display: block;
    position: absolute;
    top: 100%;
    /* Pegado justo al borde inferior del input */
    left: 0;
    width: 100%;
    background-color: #ff4800;
    /* Fondo naranja sólido */
    color: white;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 8px 25px rgba(255, 72, 0, 0.4);
    z-index: 1001;
    box-sizing: border-box;
    overflow: hidden;
    /* CRUCIAL: Oculta el texto mientras se va desplegando */

    /* 1. ESTADO INICIAL (COMPLETAMENTE ENCOGIDO) */
    max-height: 0;
    opacity: 0;
    padding: 0 14px;
    /* Sin padding arriba/abajo para que mida 0px de alto */
    margin-top: 0;
    visibility: hidden;

    /* 2. TRANSICIÓN DE DESPLIEGUE SUAVE */
    /* Usamos un ease-in-out limpio para emular la suavidad de un menú móvil */
    transition:
        max-height 0.3s ease-in-out,
        opacity 0.25s ease-in-out,
        padding 0.3s ease-in-out,
        margin-top 0.3s ease-in-out,
        visibility 0.3s;
}

/* La pequeña flecha del globo (también se desvanece suavemente) */
.error-mensaje::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: transparent transparent #ff4800 transparent;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

/* 3. ESTADO ACTIVO (DESPLEGADO COMO MENÚ MÓVIL) */
.error-mensaje.visible {
    max-height: 100px;
    /* Un tope lo suficientemente alto para que quepa el texto */
    opacity: 1;
    padding: 10px 14px;
    /* Recupera su espacio interior */
    margin-top: 8px;
    /* Se separa sutilmente del input al bajar */
    visibility: visible;
}

/* Muestra la flecha solo cuando ya se abrió la cortina */
.error-mensaje.visible::before {
    opacity: 1;
}

/* ============================================================
   LÓGICA VISUAL COMPLEJOS: DROPDOWN FLOTANTE Y CHECKLIST
   ============================================================ */

/* 1. Corrección de desbordamiento en el panel activo */
.booking-panel.active {
    overflow: visible !important;
}

/* 2. Control de capas y prioridad al abrir el menú */
.booking-field {
    position: relative;
    transition: none;
}

.booking-field:has(#dropdownCasitas.open) {
    z-index: 9999 !important;
    opacity: 1 !important;
    transform: none !important;
}

.booking-field:has(#dropdownCasitas.open)~.booking-field {
    z-index: 1 !important;
}

/* 3. EL BOTÓN DISPARADOR */
.casitas-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border: 1.5px solid rgba(1, 69, 255, 0.2);
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.casitas-select-trigger:focus {
    border-color: #0199ff;
    background-color: #ffffff;
    box-shadow: 0 0 12px rgba(1, 153, 255, 0.25);
    outline: none;
}

#textoCasitasSeleccionadas {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px;
    text-align: left;
    flex: 1;
}

.casitas-select-trigger i {
    color: #0145ff;
    transition: transform 0.2s ease;
}

#dropdownCasitas.open+.casitas-select-trigger i {
    transform: rotate(180deg);
}

/* 4. CONTENEDOR FLOTANTE CON ALMA DE SCROLL */
.casitas-options-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 2px solid rgba(1, 69, 255, 0.15);
    border-radius: 14px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    margin-top: 5px;
    padding: 12px;
    box-sizing: border-box;
    max-height: 180px;
    overflow-y: auto;
    z-index: 9999 !important;
    display: none;
}

.casitas-options-dropdown.open {
    display: block;
}

/* 5. DISEÑO DE FILAS (TODO A LA IZQUIERDA Y PALOMITAS CORREGIDAS) */
.option-checkbox {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Todo alineado estrictamente a la izquierda */
    gap: 12px;
    /* Espaciado perfecto entre palomita y texto */
    font-size: 0.95rem;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    text-align: left;
    margin-bottom: 4px;
    width: 100%;
    box-sizing: border-box;
}

.option-checkbox:last-of-type {
    margin-bottom: 0;
}

.option-checkbox:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

/* Ajuste fino de la posición y tamaño de la palomita (checkbox) */
.option-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
    /* Evita que la palomita se aplaste si el texto es largo */
}

/* 6. COLORES AUTOMÁTICOS SEGÚN EL TEXTO/VALOR DEL CHECKBOX */

/* Si el checkbox contiene "Todo" o "Todos", se pinta de Naranja */
.option-checkbox:has(input[value*="Todo"]),
.option-checkbox:has(input[value*="Todos"]),
.master-option {
    font-weight: 700;
    color: #ff4800 !important;
}

.option-checkbox:has(input[value*="Todo"]) input[type="checkbox"],
.option-checkbox:has(input[value*="Todos"]) input[type="checkbox"],
.master-option input[type="checkbox"] {
    accent-color: #ff4800;
    /* Palomita naranja */
}

/* Las casitas o bungalows individuales se quedan en Azul */
.option-checkbox:not(:has(input[value*="Todo"])):not(:has(input[value*="Todos"])),
.individual-option {
    font-weight: 600;
    color: #0145ff !important;
}

.option-checkbox:not(:has(input[value*="Todo"])):not(:has(input[value*="Todos"])) input[type="checkbox"],
.individual-option input[type="checkbox"] {
    accent-color: #0145ff;
    /* Palomita azul */
}

/* 7. SCROLLBAR */
.casitas-options-dropdown::-webkit-scrollbar {
    width: 6px;
}

.casitas-options-dropdown::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
}

.casitas-options-dropdown::-webkit-scrollbar-thumb {
    background: rgba(1, 69, 255, 0.2);
    border-radius: 10px;
}

.casitas-options-dropdown::-webkit-scrollbar-thumb:hover {
    background: #0199ff;
}

/* ============================================================
   TÍTULOS Y SUBSECCIONES DENTRO DEL DROPDOWN (FONDO OPACO CORREGIDO)
   ============================================================ */

/* Títulos principales de los Complejos (El Descanso / Casa Toro) */
.dropdown-section-title {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 10px 12px;
    margin: 4px 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-radius: 6px;
    text-align: left;

    /* Fondo Blanco Absoluto y Opaco para tapar el contenido al hacer scroll */
    background-color: #ffffff !important;

    /* Efecto Premium Sticky Fijo */
    position: -webkit-sticky;
    position: sticky;
    top: -12px;
    z-index: 10;

    /* Sombra ligera inferior para dar volumen sobre los elementos que se ocultan detrás */
    box-shadow: 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Primer bloque principal: El Descanso (Identidad Azul con fondo Blanco) */
.dropdown-section-title:first-of-type {
    color: #0145ff;
    border-left: 4px solid #0145ff;
    border-bottom: 1px solid rgba(1, 69, 255, 0.1);
}

/* Segundo bloque principal: Casa Toro (Identidad Naranja con fondo Blanco) */
.dropdown-section-title:not(:first-of-type) {
    margin-top: 14px;
    color: #ff4800;
    border-left: 4px solid #ff4800;
    border-bottom: 1px solid rgba(255, 72, 0, 0.1);
}

/* Subtítulos de categorías (Bungalows Medianos / Cuartos Familiares) */
.dropdown-subsection-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #0145ff;
    /* Mantenemos el tono vivo */
    padding: 8px 12px 4px 12px;
    text-align: left;
    margin-top: 6px;
    text-transform: none;
    background-color: #ffffff;
    /* Asegura consistencia limpia */
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Punto decorativo dinámico antes del subtítulo */
.dropdown-subsection-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #ff4800;
    /* Contraste en naranja */
    border-radius: 50%;
}