/**
 * Aura Filters - Public Styles
 *
 * Modern horizontal filter design (Booking.com style)
 * Hardened with !important to prevent Elementor reset interference
 *
 * @package    Aura_Filters
 * @subpackage Aura_Filters/public/css
 */

/* ============================================================================
   RESET ELEMENTOR INTERFERENCE
   ============================================================================ */

.wpbs-availability-wrapper *,
.wpbs-availability-wrapper *::before,
.wpbs-availability-wrapper *::after {
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Reset específico para inputs y selects */
.wpbs-filter-input,
.wpbs-filter-select,
.wpbs-date-picker {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-decoration: none !important;
    vertical-align: baseline !important;
    min-height: auto !important;
    max-height: none !important;
    height: auto !important;
    width: 100% !important;
}

/* Reset para botones */
.wpbs-circle-btn {
    margin: 0 !important;
    padding: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-style: normal !important;
    text-decoration: none !important;
    line-height: 1 !important;
    font-variant: normal !important;
}

/* ============================================================================
   WRAPPER PRINCIPAL
   ============================================================================ */

.wpbs-availability-wrapper {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 2rem auto !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    box-sizing: border-box !important;
}

/* ============================================================================
   FORMULARIO
   ============================================================================ */

.wpbs-availability-form {
    background: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    margin: 0 !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

/* ============================================================================
   CAMPOS DE FILTRO
   ============================================================================ */

.wpbs-filter-field {
    flex: 1 !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    padding: 0.75rem 1.25rem !important;
    border-right: 1px solid #e0e0e0 !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    min-height: 60px !important;
    margin: 0 !important;
    background: transparent !important;
    gap: 0 !important;
}

.wpbs-filter-field:last-of-type {
    border-right: none !important;
}

.wpbs-filter-field:hover {
    background: #f8f9fa !important;
}

/* ============================================================================
   ICONOS
   ============================================================================ */

.wpbs-field-icon {
    color: #6c757d !important;
    font-size: 1em !important;
    margin-right: 0.75rem !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    min-width: 20px !important;
    text-align: center !important;
    display: inline-block !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

/* ============================================================================
   INPUTS Y SELECTS
   ============================================================================ */

.wpbs-filter-input,
.wpbs-filter-select {
    flex: 1 !important;
    border: none !important;
    background: transparent !important;
    font-size: 1em !important;
    color: #2d4052 !important;
    font-weight: 500 !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    line-height: normal !important;
    font-family: inherit !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

/* Textarea de Flatpickr - comportamiento como input */
.wpbs-flatpickr-input {
    min-width: 400px !important;
    max-width: fit-content !important;
    width: auto !important;
    resize: none !important;
    overflow: hidden !important;
    vertical-align: middle !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Ajuste automático de altura en desktop */
.wpbs-flatpickr-input[rows="1"] {
    height: auto !important;
    min-height: 1.5em !important;
}

/* Select de guests - quitar borde del dropdown */
select[name="guests"].wpbs-filter-select {
    border: none !important;
    outline: none !important;
    padding: 5px 10px !important;
}

/* Opciones del dropdown de guests - diseño personalizado */
select[name="guests"].wpbs-filter-select option {
    padding: 5px 10px !important;
    border: none !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #2d4052 !important;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 1em !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    margin: 2px 0 !important;
}

/* Hover y selección con color oliva */
select[name="guests"].wpbs-filter-select option:hover,
select[name="guests"].wpbs-filter-select option:focus,
select[name="guests"].wpbs-filter-select option:active,
select[name="guests"].wpbs-filter-select option:checked,
select[name="guests"].wpbs-filter-select option[selected] {
    background: rgba(104, 119, 7, 0.15) !important;
    color: #2d4052 !important;
}

.wpbs-filter-input::placeholder {
    color: #6c757d !important;
    font-weight: 400 !important;
    font-size: 1em !important;
    opacity: 1 !important;
}

/* ============================================================================
   DATE PICKER ESPECÍFICO
   ============================================================================ */

.wpbs-date-picker {
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    caret-color: transparent !important;
    position: relative !important;
}

/* Mostrar formato de fecha nativo del navegador */
.wpbs-date-picker::-webkit-datetime-edit-text,
.wpbs-date-picker::-webkit-datetime-edit-month-field,
.wpbs-date-picker::-webkit-datetime-edit-day-field,
.wpbs-date-picker::-webkit-datetime-edit-year-field {
    color: #6c757d !important;
}

/* Cuando tiene valor, mostrar la fecha en color oscuro */
.wpbs-date-picker:valid::-webkit-datetime-edit-text,
.wpbs-date-picker:valid::-webkit-datetime-edit-month-field,
.wpbs-date-picker:valid::-webkit-datetime-edit-day-field,
.wpbs-date-picker:valid::-webkit-datetime-edit-year-field {
    color: #2d4052 !important;
}

.wpbs-date-picker::-webkit-datetime-edit-fields-wrapper,
.wpbs-date-picker::-webkit-datetime-edit-text,
.wpbs-date-picker::-webkit-datetime-edit-month-field,
.wpbs-date-picker::-webkit-datetime-edit-day-field,
.wpbs-date-picker::-webkit-datetime-edit-year-field {
    user-select: none !important;
    -webkit-user-select: none !important;
    pointer-events: none !important;
}

.wpbs-date-picker::-webkit-calendar-picker-indicator {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Ocultar flechas spinner de los inputs de fecha */
.wpbs-date-picker::-webkit-inner-spin-button,
.wpbs-date-picker::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

.wpbs-date-picker:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.wpbs-date-picker:disabled::before {
    color: #999 !important;
}

/* ============================================================================
   FOCUS STATES
   ============================================================================ */

.wpbs-filter-input:focus,
.wpbs-date-picker:focus,
.wpbs-filter-select:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
    color: #000 !important;
}

.wpbs-filter-input::selection,
.wpbs-date-picker::selection {
    background: transparent !important;
    color: inherit !important;
}

.wpbs-filter-input::-moz-selection,
.wpbs-date-picker::-moz-selection {
    background: transparent !important;
    color: inherit !important;
}

/* ============================================================================
   SELECT ESPECÍFICO
   ============================================================================ */

.wpbs-filter-select {
    background-image: none !important;
    background-repeat: no-repeat !important;
    background-position: right center !important;
    padding-right: 0 !important;
}

/* Ocultar flecha nativa del select */
.wpbs-filter-select::-ms-expand {
    display: none !important;
}

/* ============================================================================
   CONTENEDOR DE BOTONES
   ============================================================================ */

.wpbs-action-buttons {
    display: flex !important;
    gap: 0.5rem !important;
    padding: 0 0.5rem !important;
    margin: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

/* ============================================================================
   BOTONES CIRCULARES
   ============================================================================ */

.wpbs-circle-btn {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    border-radius: 50% !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1em !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    background-color: #687707 !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    text-decoration: none !important;
    flex-shrink: 0 !important;
}

/* Botón de búsqueda - Verde/Amarillo */
.wpbs-search-btn {
    background: #687707 !important;
    color: #ffffff !important;
}

.wpbs-search-btn:hover {
    background: #687707 !important;
    transform: scale(1.05) !important;
}

.wpbs-search-btn:active {
    transform: scale(0.98) !important;
}

.wpbs-search-btn:disabled {
    background: #cccccc !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Botón de limpiar - Rojo */
.wpbs-clear-circle-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    color: #ffffff !important;
}

.wpbs-clear-circle-btn:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%) !important;
    transform: scale(1.05) !important;
}

.wpbs-clear-circle-btn:active {
    transform: scale(0.98) !important;
}

/* ============================================================================
   ANIMACIONES
   ============================================================================ */

.wpbs-btn-spinner {
    animation: wpbs-spin 1s linear infinite !important;
}

@keyframes wpbs-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================================================
   CAMPOS DESHABILITADOS
   ============================================================================ */

.wpbs-filter-field:has(input:disabled) {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    background: #f8f9fa !important;
}

.wpbs-filter-field:has(input:disabled):hover {
    background: #f8f9fa !important;
}

/* ============================================================================
   RESPONSIVE - MOBILE
   ============================================================================ */

@media (max-width: 992px) {
    .wpbs-availability-form {
        flex-direction: column !important;
        border-radius: 8px !important;
        padding: 1rem !important;
    }

    .wpbs-filter-field {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid #e0e0e0 !important;
        padding: 1rem !important;
    }

    .wpbs-filter-field:last-of-type {
        border-bottom: none !important;
    }

    .wpbs-action-buttons {
        width: 100% !important;
        justify-content: center !important;
        padding: 1rem 0 0.5rem 0 !important;
    }

    .wpbs-circle-btn {
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        min-height: 60px !important;
        font-size: 1em !important;
    }

    /* Input de Flatpickr responsive - permitir 2 líneas */
    .wpbs-flatpickr-input {
        min-width: 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        line-height: 1.4 !important;
        min-height: auto !important;
        height: auto !important;
        padding: 0.5rem 0 !important;
        word-wrap: break-word !important;
    }

    .wpbs-filter-field:has(.wpbs-flatpickr-input) {
        align-items: flex-start !important;
        font-size: 0.9rem !important;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .wpbs-availability-wrapper {
        margin: 1rem auto !important;
    }

    .wpbs-filter-field {
        padding: 0.875rem !important;
    }

    /* Input de fechas más pequeño en tablets */
    .wpbs-flatpickr-input {
        min-width: 100% !important;
        font-size: 0.85em !important;
    }

    /* Guests select más pequeño */
    select[name="guests"].wpbs-filter-select {
        font-size: 0.95em !important;
    }
}

/* Mobile pequeño */
@media (max-width: 480px) {
    .wpbs-availability-form {
        padding: 0.75rem !important;
    }

    .wpbs-filter-field {
        padding: 0.75rem !important;
        min-height: 50px !important;
    }

    .wpbs-field-icon {
        font-size: 0.9em !important;
        margin-right: 0.5rem !important;
    }

    .wpbs-flatpickr-input {
        font-size: 0.8em !important;
    }

    select[name="guests"].wpbs-filter-select {
        font-size: 0.9em !important;
    }

    .wpbs-circle-btn {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
        font-size: 0.9em !important;
    }

    .wpbs-action-buttons {
        gap: 0.5rem !important;
    }
}

/* ============================================================================
   ESTILOS PARA OVERLAY DEL LOOP GRID
   ============================================================================ */

.wpbs-grid-loading {
    position: relative !important;
    min-height: 200px !important;
}

.wpbs-grid-loading::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    z-index: 100 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
}

.wpbs-grid-loading::after {
    content: '\f110' !important;
    font-family: 'Font Awesome 6 Free' !important;
    font-weight: 900 !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 1em !important;
    color: #92c83e !important;
    z-index: 101 !important;
    animation: wpbs-spin 1s linear infinite !important;
}

/* ============================================================================
   MENSAJES
   ============================================================================ */

.wpbs-no-results-message {
    text-align: center !important;
    padding: 3rem 2rem !important;
    color: #666 !important;
    background: #f8f9fa !important;
    border-radius: 12px !important;
    margin: 2rem 0 !important;
}

.wpbs-no-results-message .wpbs-icon {
    display: block !important;
    font-size: 1em !important;
    margin-bottom: 1rem !important;
}

.wpbs-no-results-message p {
    margin: 0 !important;
    font-size: 1em !important;
}

.wpbs-results-count {
    text-align: center !important;
    padding: 1rem !important;
    margin: 1rem 0 !important;
    background: #e8f4fd !important;
    border-radius: 12px !important;
    color: #2c3e50 !important;
    font-weight: 600 !important;
    font-size: 1em !important;
    animation: wpbs-fadeIn 0.5s ease-out !important;
}

@keyframes wpbs-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   SPECIFICITY OVERRIDES PARA ELEMENTOR
   ============================================================================ */

/* Forzar que los inputs no tengan estilos de Elementor */
.elementor-widget-container .wpbs-filter-input,
.elementor-widget-container .wpbs-filter-select,
.elementor-widget-container .wpbs-date-picker {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Forzar que los botones no tengan estilos de Elementor */
.elementor-widget-container .wpbs-circle-btn {
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    text-transform: none !important;
}

/* Forzar layout del formulario */
.elementor-widget-container .wpbs-availability-form {
    display: flex !important;
    flex-wrap: nowrap !important;
}

/* Prevenir que el wrapper de Elementor rompa el diseño */
.elementor-widget-container > .wpbs-availability-wrapper {
    width: 100% !important;
    max-width: 1200px !important;
}

/* ============================================================================
   FLATPICKR CUSTOM STYLING
   ============================================================================ */

/* Container principal de Flatpickr */
.aura-flatpickr-calendar.flatpickr-calendar {
    background: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    padding: 1rem !important;
}

/* Meses contenedor */
.aura-flatpickr-calendar .flatpickr-months {
    margin-bottom: 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

/* Mes individual */
.aura-flatpickr-calendar .flatpickr-month {
    background: transparent !important;
    color: #000000 !important;
    fill: #000000 !important;
    height: auto !important;
    padding: 0.5rem 0 !important;
    position: relative !important;
    overflow: visible;
    height: 30px !important;
}

/* Título del mes */
.aura-flatpickr-calendar .flatpickr-current-month {
    font-size: 1.2em !important;
    font-weight: 700 !important;
    color: #000000 !important;
    padding: 0.75rem 0 !important;
    height: auto !important;
    line-height: 1 !important;
}

.aura-flatpickr-calendar .flatpickr-current-month .flatpickr-monthDropdown-months {
    font-size: 1.2em !important;
    font-weight: 700 !important;
    color: #000000 !important;
    background: transparent !important;
    border: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

.aura-flatpickr-calendar .flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: transparent !important;
}

.aura-flatpickr-calendar .flatpickr-current-month span.cur-month {
    font-weight: 400 !important;
    color: #000000 !important;
    font-size: 1em !important;
}

/* Input numérico del año */
.aura-flatpickr-calendar .numInputWrapper {
    width: 70px !important;
}

.aura-flatpickr-calendar .numInputWrapper input {
    font-size: 1em !important;
    font-weight: 400 !important;
    color: #000000 !important;
    background: transparent !important;
    border: none !important;
}

.aura-flatpickr-calendar .numInputWrapper input:hover {
    background: transparent !important;
}

.aura-flatpickr-calendar .numInputWrapper span {
    display: none !important;
}

/* Flechas de navegación */
.aura-flatpickr-calendar .flatpickr-prev-month,
.aura-flatpickr-calendar .flatpickr-next-month {
    fill: #6c757d !important;
    transition: fill 0.2s ease !important;
}

.aura-flatpickr-calendar .flatpickr-prev-month:hover,
.aura-flatpickr-calendar .flatpickr-next-month:hover {
    fill: #687707 !important;
}

/* Nombres de días de la semana */
.aura-flatpickr-calendar .flatpickr-weekday {
    color: #6c757d !important;
    font-size: 0.9em !important;
    font-weight: 600 !important;
}

/* Días del calendario */
.aura-flatpickr-calendar .flatpickr-day {
    color: #2d4052 !important;
    border: none !important;
    border-radius: 50% !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    margin: 2px !important;
}

.aura-flatpickr-calendar .flatpickr-day:hover {
    background: #f8f9fa !important;
    border: none !important;
}

/* Día actual */
.aura-flatpickr-calendar .flatpickr-day.today {
    border: 2px solid #687707 !important;
    background: transparent !important;
}

.aura-flatpickr-calendar .flatpickr-day.today:hover {
    background: #f8f9fa !important;
    border-color: #687707 !important;
}

/* Días seleccionados */
.aura-flatpickr-calendar .flatpickr-day.selected,
.aura-flatpickr-calendar .flatpickr-day.startRange,
.aura-flatpickr-calendar .flatpickr-day.endRange {
    background: #687707 !important;
    color: #ffffff !important;
    border: none !important;
}

.aura-flatpickr-calendar .flatpickr-day.selected:hover,
.aura-flatpickr-calendar .flatpickr-day.startRange:hover,
.aura-flatpickr-calendar .flatpickr-day.endRange:hover {
    background: #687707 !important;
    color: #ffffff !important;
}

/* Días en el rango (entre start y end) */
.aura-flatpickr-calendar .flatpickr-day.inRange {
    background: rgba(104, 119, 7, 0.15) !important;
    color: #2d4052 !important;
    border-radius: 0 !important;
    box-shadow: -5px 0 0 rgba(104, 119, 7, 0.15), 5px 0 0 rgba(104, 119, 7, 0.15) !important;
}

/* Días deshabilitados (anteriores a hoy) */
.aura-flatpickr-calendar .flatpickr-day.prevMonthDay,
.aura-flatpickr-calendar .flatpickr-day.nextMonthDay,
.aura-flatpickr-calendar .flatpickr-day.disabled {
    color: #e0e0e0 !important;
    cursor: not-allowed !important;
}

/* Espaciado entre los dos meses */
.aura-flatpickr-calendar .flatpickr-months .flatpickr-month {
    margin: 0 0.5rem !important;
}

/* Forzar que todos los elementos del mes sean negros */
.aura-flatpickr-calendar .flatpickr-monthDropdown-month,
.aura-flatpickr-calendar .flatpickr-current-month .cur-year,
.aura-flatpickr-calendar .flatpickr-current-month input.cur-year,
.aura-flatpickr-calendar .flatpickr-current-month .numInput.cur-year {
    color: #000000 !important;
    font-weight: 400 !important;
}

/* Asegurar visibilidad del dropdown del mes */
.aura-flatpickr-calendar select.flatpickr-monthDropdown-months {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #000000 !important;
    font-weight: 700 !important;
    font-size: 1.2em !important;
}

/* Ajustes responsive para Flatpickr */
@media (max-width: 768px) {
    .aura-flatpickr-calendar.flatpickr-calendar {
        width: 100% !important;
    }

    .aura-flatpickr-calendar .flatpickr-months .flatpickr-month {
        margin: 0.5rem 0 !important;
    }
}
