/**
 * AdBooking Frontend CSS v4.2.6
 *
 * Melhorias v4.2.4:
 * - Variáveis CSS para cores do calendário (sem injeção de <style>)
 * - Backdrop/overlay no dropdown mobile
 * - Botão "Confirmar" e "Fechar" no dropdown mobile
 * - Grid 2 colunas para seleção de idades
 * - Transição suave no botão ao ficar habilitado
 * - Melhorias de acessibilidade e foco
 */

/* ================================================================
   VARIÁVEIS CSS
   ================================================================ */
.adb-search-bar-container {
    --adb-cal-selected: #007cba;
    --adb-cal-range: rgba(0, 124, 186, 0.1);
    --adb-transition: 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

/* ================================================================
   BARRA DE PESQUISA
   ================================================================ */
.adb-search-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

/* Layout horizontal (padrão) */
.adb-layout-horizontal .adb-search-bar {
    flex-direction: row;
}

/* Layout vertical */
.adb-layout-vertical .adb-search-bar {
    flex-direction: column;
}

/* ================================================================
   GRUPOS DE CAMPO
   ================================================================ */
.adb-field-group,
.adb-dates-group,
.adb-guests-group,
.adb-button-group {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
}

/* ================================================================
   INPUT WRAPPER (ícones)
   ================================================================ */
.adb-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.adb-input-wrapper.has-icon-left .adb-input-icon {
    order: -1;
}

.adb-input-wrapper.has-icon-right .adb-input-icon {
    order: 1;
}

.adb-input-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
    font-size: 16px;
    line-height: 1;
    color: #666;
    transition: color var(--adb-transition);
}

/* SVG inline do Elementor 4.x (e-font-icon-svg) */
.adb-input-icon .e-font-icon-svg,
.adb-button-icon .e-font-icon-svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

/* Fallback para ícones <i> (Font Awesome clássico) */
.adb-input-icon i,
.adb-button-icon i {
    font-size: inherit;
    line-height: inherit;
}

.adb-icon-left {
    left: 12px;
}

.adb-icon-right {
    right: 12px;
}

/* Padding extra quando há ícone */
.adb-input-wrapper.has-icon-left .adb-dates-input,
.adb-input-wrapper.has-icon-left .adb-guests-input {
    padding-left: 40px;
}

.adb-input-wrapper.has-icon-right .adb-dates-input,
.adb-input-wrapper.has-icon-right .adb-guests-input {
    padding-right: 40px;
}

/* ================================================================
   INPUTS (Datas + Hóspedes)
   ================================================================ */
.adb-dates-input,
.adb-guests-input {
    width: 100%;
    height: 48px;
    padding: 8px 14px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color var(--adb-transition), background-color var(--adb-transition), color var(--adb-transition);
    outline: none;
}

.adb-dates-input::placeholder,
.adb-guests-input::placeholder {
    color: #999;
}

.adb-dates-input:focus,
.adb-guests-input:focus {
    outline: 2px solid var(--adb-cal-selected);
    outline-offset: -2px;
}

/* ================================================================
   DROPDOWN DE HÓSPEDES
   ================================================================ */
.adb-guests-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 99999;
    min-width: 300px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
    animation: adb-dropdown-in 0.2s ease;
}

.adb-guests-dropdown.active {
    display: block;
}

@keyframes adb-dropdown-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Botão fechar (desktop: oculto) */
.adb-dropdown-close {
    display: none;
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 4px;
    z-index: 2;
}

.adb-dropdown-close:hover {
    color: #333;
}

/* Botão confirmar (desktop: oculto) */
.adb-dropdown-confirm {
    display: none;
    width: 100%;
    margin-top: 12px;
    padding: 10px 16px;
    background: var(--adb-cal-selected);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background-color var(--adb-transition);
}

.adb-dropdown-confirm:hover {
    opacity: 0.9;
}

/* ================================================================
   CONTADORES (Adultos / Crianças)
   ================================================================ */
.adb-counter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.adb-counter-row + .adb-counter-row {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.adb-counter-row label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.adb-label-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.adb-label-subtitle {
    font-size: 11px;
    color: #999;
    font-weight: 400;
}

.adb-counter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.adb-counter-controls button,
.adb-btn-minus,
.adb-btn-plus {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: #f7f7f7;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    line-height: 1;
    padding: 0;
}

.adb-counter-controls button:hover:not(:disabled),
.adb-btn-minus:hover:not(:disabled),
.adb-btn-plus:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #999;
}

.adb-counter-controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.adb-counter-controls input[type="number"] {
    width: 48px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    -moz-appearance: textfield;
    outline: none;
}

.adb-counter-controls input[type="number"]::-webkit-inner-spin-button,
.adb-counter-controls input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ================================================================
   IDADES DAS CRIANÇAS (Grid 2 colunas)
   ================================================================ */
.adb-children-ages {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.adb-child-age-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.adb-child-age-item label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.adb-child-age-select {
    width: 100%;
    height: 36px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: border-color var(--adb-transition);
    outline: none;
    box-sizing: border-box;
}

.adb-child-age-select:focus {
    border-color: var(--adb-cal-selected);
    outline: 2px solid var(--adb-cal-selected);
    outline-offset: -2px;
}

.adb-child-age-select.adb-age-invalid {
    border-color: #e74c3c;
    animation: adb-shake 0.3s ease;
}

@keyframes adb-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

.adb-age-validation-msg {
    grid-column: 1 / -1;
    font-size: 12px;
    color: #e74c3c;
    padding: 4px 0;
    opacity: 0;
    transition: opacity var(--adb-transition);
}

.adb-age-validation-msg.visible {
    opacity: 1;
}

/* ================================================================
   BOTÃO DE PESQUISA
   ================================================================ */
.adb-button-group {
    display: flex;
    align-items: stretch;
}

.adb-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    min-height: 48px;
    padding: 10px 24px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.adb-search-button[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
}

.adb-search-button.adb-btn-ready {
    opacity: 1;
}

.adb-search-button:hover {
    text-decoration: none;
}

.adb-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    color: inherit;
}

.adb-button-text {
    line-height: 1;
}

/* ================================================================
   BACKDROP MOBILE
   ================================================================ */
.adb-dropdown-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.adb-dropdown-backdrop.active {
    display: block;
    opacity: 1;
}

/* Prevenir scroll do body quando dropdown mobile aberto */
body.adb-dropdown-open {
    overflow: hidden;
}


/* ================================================================
   FLATPICKR — Cores via Variáveis CSS
   ================================================================ */
.adb-flatpickr .flatpickr-day.selected,
.adb-flatpickr .flatpickr-day.startRange,
.adb-flatpickr .flatpickr-day.endRange {
    background: var(--adb-cal-selected, #007cba) !important;
    border-color: var(--adb-cal-selected, #007cba) !important;
    color: #fff !important;
}

.adb-flatpickr .flatpickr-day.inRange {
    background: var(--adb-cal-range, rgba(0, 124, 186, 0.1)) !important;
    border-color: transparent !important;
    box-shadow: -5px 0 0 var(--adb-cal-range, rgba(0, 124, 186, 0.1)),
                 5px 0 0 var(--adb-cal-range, rgba(0, 124, 186, 0.1)) !important;
}

.adb-flatpickr .flatpickr-day.today:not(.selected):not(.startRange):not(.endRange) {
    border-bottom: 2px solid var(--adb-cal-selected, #007cba);
}

.adb-flatpickr .flatpickr-day:hover:not(.selected):not(.startRange):not(.endRange):not(.disabled) {
    background: var(--adb-cal-range, rgba(0, 124, 186, 0.1));
}

/* ================================================================
   RESPONSIVO — MOBILE (max-width: 768px)
   ================================================================ */
@media (max-width: 768px) {
    .adb-search-bar {
        flex-direction: column;
    }

    .adb-field-group {
        width: 100% !important;
        flex: none !important;
    }

    /* Dropdown mobile: fullscreen bottom sheet */
    .adb-guests-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        min-width: 100%;
        max-height: 80vh;
        overflow-y: auto;
        border-radius: 16px 16px 0 0;
        z-index: 1001;
        padding: 20px;
        padding-top: 40px;
        animation: adb-slide-up 0.3s ease;
    }

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

    /* Mostrar botão fechar e confirmar no mobile */
    .adb-dropdown-close,
    .adb-dropdown-confirm {
        display: block;
    }

    /* Idades: 1 coluna no mobile */
    .adb-children-ages {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   RESPONSIVO — TABLET (max-width: 1024px)
   ================================================================ */
@media (max-width: 1024px) and (min-width: 769px) {
    .adb-search-bar {
        flex-wrap: wrap;
    }
}

/* ================================================================
   ACESSIBILIDADE — Foco Visível
   ================================================================ */
.adb-search-button:focus-visible,
.adb-counter-controls button:focus-visible,
.adb-child-age-select:focus-visible {
    outline: 2px solid var(--adb-cal-selected, #007cba);
    outline-offset: 2px;
}

/* ================================================================
   PRINT
   ================================================================ */
@media print {
    .adb-search-bar-container {
        display: none;
    }
}
