/**
 * Advanced Travel Search - Forms CSS v3.2.2-FIXED-HORIZONTAL
 * CSS de formularios corregido para layout horizontal exacto como en imagen
 * 
 * 🔧 FORMULARIO HORIZONTAL EXACTO SEGÚN IMAGEN IMPLEMENTADO:
 * ✅ Grid horizontal de 4 campos + botón verde
 * ✅ Campos blancos uniformes con iconos
 * ✅ Botón de búsqueda verde (#48bb78) alineado
 * ✅ Variables CSS personalizables
 * ✅ Dropdowns estilizados con flechas
 * ✅ Responsive design completo
 * ✅ Estados focus, hover, error
 * 
 * @package AdvancedTravelSearch
 * @version 3.2.2-FIXED-HORIZONTAL
 */

/* ==================== VARIABLES CSS PERSONALIZABLES ==================== */

:root {
    /* Layout del formulario */
    --ats-form-bg: #f8f9fa;                    /* Fondo gris claro del formulario */
    --ats-form-padding: 20px;                  /* Padding del formulario */
    --ats-form-gap: 16px;                      /* Gap entre campos */
    --ats-form-border-radius: 0 0 16px 16px;   /* Bordes redondeados */
    
    /* Campos del formulario */
    --ats-field-height: 48px;                  /* Altura de campos */
    --ats-field-bg: #ffffff;                   /* Fondo blanco de campos */
    --ats-field-border: #e2e8f0;               /* Borde gris claro */
    --ats-field-border-focus: #48bb78;         /* Borde verde al focus */
    --ats-field-border-radius: 8px;            /* Bordes redondeados de campos */
    --ats-field-padding: 0 16px 0 44px;        /* Padding con espacio para icono */
    --ats-field-font-size: 14px;               /* Tamaño de fuente */
    --ats-field-font-weight: 400;              /* Peso de fuente */
    --ats-field-text: #2d3748;                 /* Color del texto */
    --ats-field-placeholder: #a0aec0;          /* Color del placeholder */
    
    /* Iconos de campos */
    --ats-field-icon-size: 18px;               /* Tamaño de iconos */
    --ats-field-icon-color: #718096;           /* Color de iconos */
    --ats-field-icon-left: 14px;               /* Posición left del icono */
    
    /* Botón de búsqueda */
    --ats-button-bg: #48bb78;                  /* Verde del botón */
    --ats-button-bg-hover: #38a169;            /* Verde más oscuro en hover */
    --ats-button-bg-active: #2f855a;           /* Verde más oscuro en active */
    --ats-button-text: #ffffff;                /* Texto blanco */
    --ats-button-height: 48px;                 /* Altura del botón */
    --ats-button-padding: 0 24px;              /* Padding horizontal */
    --ats-button-border-radius: 8px;           /* Bordes redondeados */
    --ats-button-font-size: 14px;              /* Tamaño de fuente */
    --ats-button-font-weight: 600;             /* Peso de fuente */
    --ats-button-min-width: 120px;             /* Ancho mínimo */
    
    /* Dropdowns */
    --ats-dropdown-arrow: #718096;             /* Color de la flecha */
    --ats-dropdown-arrow-size: 12px;           /* Tamaño de la flecha */
    
    /* Sombras */
    --ats-field-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --ats-field-shadow-focus: 0 0 0 3px rgba(72, 187, 120, 0.1);
    --ats-button-shadow: 0 2px 4px rgba(72, 187, 120, 0.2);
    --ats-button-shadow-hover: 0 4px 8px rgba(72, 187, 120, 0.3);
    
    /* Transiciones */
    --ats-field-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --ats-button-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== FORMULARIO BASE ==================== */

.ats-search-form {
    background: var(--ats-form-bg) !important;
    padding: var(--ats-form-padding) !important;
    border-radius: var(--ats-form-border-radius) !important;
    margin: 0 !important;
    width: 100% !important;
    position: relative !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* ==================== GRID HORIZONTAL DE CAMPOS ==================== */

.ats-filters-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr 1fr auto !important;
    gap: var(--ats-form-gap) !important;
    align-items: center !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ==================== GRUPOS DE CAMPOS ==================== */

.ats-field-group {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ==================== ETIQUETAS DE CAMPOS ==================== */

.ats-field-label {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: var(--ats-field-text) !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
}

.ats-field-icon {
    font-size: var(--ats-field-icon-size) !important;
    color: var(--ats-field-icon-color) !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

/* ==================== WRAPPER DE CAMPOS ==================== */

.ats-field-wrapper {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ==================== CAMPOS BASE ==================== */

.ats-field-input,
.ats-field-select {
    /* Layout */
    display: block !important;
    width: 100% !important;
    height: var(--ats-field-height) !important;
    margin: 0 !important;
    padding: var(--ats-field-padding) !important;
    
    /* Appearance */
    background: var(--ats-field-bg) !important;
    border: 1px solid var(--ats-field-border) !important;
    border-radius: var(--ats-field-border-radius) !important;
    box-shadow: var(--ats-field-shadow) !important;
    
    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: var(--ats-field-font-size) !important;
    font-weight: var(--ats-field-font-weight) !important;
    color: var(--ats-field-text) !important;
    line-height: 1.4 !important;
    
    /* Interaction */
    cursor: pointer !important;
    transition: var(--ats-field-transition) !important;
    outline: none !important;
    
    /* Reset */
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

/* Inputs específicos */
.ats-field-input {
    cursor: text !important;
}

.ats-field-input[readonly] {
    cursor: pointer !important;
}

/* ==================== PLACEHOLDERS ==================== */

.ats-field-input::placeholder {
    color: var(--ats-field-placeholder) !important;
    opacity: 1 !important;
    font-style: normal !important;
    font-weight: normal !important;
}

.ats-field-input::-webkit-input-placeholder {
    color: var(--ats-field-placeholder) !important;
    opacity: 1 !important;
}

.ats-field-input::-moz-placeholder {
    color: var(--ats-field-placeholder) !important;
    opacity: 1 !important;
}

.ats-field-input:-ms-input-placeholder {
    color: var(--ats-field-placeholder) !important;
    opacity: 1 !important;
}

/* ==================== ESTADOS DE CAMPOS ==================== */

/* Hover */
.ats-field-input:hover:not(:focus):not([readonly]),
.ats-field-select:hover:not(:focus) {
    border-color: var(--ats-field-border-focus) !important;
    box-shadow: var(--ats-field-shadow), 0 0 0 1px rgba(72, 187, 120, 0.1) !important;
}

/* Focus */
.ats-field-input:focus,
.ats-field-select:focus {
    border-color: var(--ats-field-border-focus) !important;
    box-shadow: var(--ats-field-shadow), var(--ats-field-shadow-focus) !important;
    z-index: 2 !important;
    position: relative !important;
}

/* Disabled */
.ats-field-input:disabled,
.ats-field-select:disabled {
    background: #f7fafc !important;
    color: #a0aec0 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* Error state */
.ats-field-group.error .ats-field-input,
.ats-field-group.error .ats-field-select {
    border-color: #e53e3e !important;
    box-shadow: var(--ats-field-shadow), 0 0 0 3px rgba(229, 62, 62, 0.1) !important;
}

/* ==================== DROPDOWNS Y SELECTS ==================== */

.ats-field-select {
    padding-right: 40px !important;
    background-image: none !important;
    cursor: pointer !important;
}

/* Flecha personalizada para dropdowns */
.ats-select-arrow {
    position: absolute !important;
    top: 50% !important;
    right: 16px !important;
    transform: translateY(-50%) !important;
    font-size: var(--ats-dropdown-arrow-size) !important;
    color: var(--ats-dropdown-arrow) !important;
    pointer-events: none !important;
    line-height: 1 !important;
    z-index: 1 !important;
    transition: var(--ats-field-transition) !important;
}

.ats-field-wrapper:hover .ats-select-arrow {
    color: var(--ats-field-border-focus) !important;
}

/* ==================== AUTOCOMPLETADO ==================== */

.ats-autocomplete-dropdown {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--ats-field-bg) !important;
    border: 1px solid var(--ats-field-border) !important;
    border-top: none !important;
    border-radius: 0 0 var(--ats-field-border-radius) var(--ats-field-border-radius) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    z-index: 1000 !important;
    display: none !important;
    max-height: 200px !important;
    overflow-y: auto !important;
}

.ats-autocomplete-dropdown.show {
    display: block !important;
}

.ats-autocomplete-item {
    padding: 12px 16px !important;
    cursor: pointer !important;
    border-bottom: 1px solid #f7fafc !important;
    transition: background-color 0.15s ease !important;
}

.ats-autocomplete-item:hover,
.ats-autocomplete-item.highlighted {
    background: #f7fafc !important;
}

.ats-autocomplete-item:last-child {
    border-bottom: none !important;
}

/* ==================== BOTÓN DE BÚSQUEDA ==================== */

.ats-search-button-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ats-search-button {
    /* Layout */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    min-width: var(--ats-button-min-width) !important;
    height: var(--ats-field-height) !important;
    padding: var(--ats-button-padding) !important;
    margin: 0 !important;
    
    /* Appearance */
    background: var(--ats-button-bg) !important;
    color: var(--ats-button-text) !important;
    border: none !important;
    border-radius: var(--ats-button-border-radius) !important;
    box-shadow: var(--ats-button-shadow) !important;
    
    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: var(--ats-button-font-size) !important;
    font-weight: var(--ats-button-font-weight) !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    
    /* Interaction */
    cursor: pointer !important;
    transition: var(--ats-button-transition) !important;
    outline: none !important;
    
    /* Reset */
    appearance: none !important;
    -webkit-appearance: none !important;
    user-select: none !important;
}

/* Estados del botón */
.ats-search-button:hover {
    background: var(--ats-button-bg-hover) !important;
    box-shadow: var(--ats-button-shadow-hover) !important;
    transform: translateY(-1px) !important;
}

.ats-search-button:active {
    background: var(--ats-button-bg-active) !important;
    transform: translateY(0) !important;
    box-shadow: var(--ats-button-shadow) !important;
}

.ats-search-button:focus {
    box-shadow: var(--ats-button-shadow), 0 0 0 3px rgba(72, 187, 120, 0.2) !important;
}

.ats-search-button:disabled {
    background: #e2e8f0 !important;
    color: #a0aec0 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Icono y texto del botón */
.ats-search-icon {
    font-size: 16px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.ats-search-text {
    font-weight: inherit !important;
    line-height: inherit !important;
}

/* ==================== CAMPOS ESPECIALES ==================== */

/* Campo de rango de fechas */
.ats-date-range {
    cursor: pointer !important;
    user-select: none !important;
}

.ats-date-range:focus {
    cursor: pointer !important;
}

/* Contador de huéspedes */
.ats-counter-wrapper {
    display: flex !important;
    align-items: center !important;
    background: var(--ats-field-bg) !important;
    border: 1px solid var(--ats-field-border) !important;
    border-radius: var(--ats-field-border-radius) !important;
    height: var(--ats-field-height) !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.ats-counter-btn {
    width: 40px !important;
    height: 100% !important;
    background: transparent !important;
    border: none !important;
    color: var(--ats-field-text) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    font-weight: bold !important;
    transition: var(--ats-field-transition) !important;
}

.ats-counter-btn:hover {
    background: #f7fafc !important;
    color: var(--ats-button-bg) !important;
}

.ats-counter-btn:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

.ats-counter-input {
    flex: 1 !important;
    height: 100% !important;
    border: none !important;
    background: transparent !important;
    text-align: center !important;
    font-size: var(--ats-field-font-size) !important;
    color: var(--ats-field-text) !important;
    outline: none !important;
    padding: 0 8px !important;
}

/* ==================== RESPONSIVE DESIGN ==================== */

/* Tablets */
@media (max-width: 768px) {
    :root {
        --ats-form-gap: 12px;
        --ats-field-height: 44px;
        --ats-button-min-width: 100px;
    }
    
    .ats-filters-row {
        grid-template-columns: 1fr 1fr !important;
        gap: var(--ats-form-gap) !important;
    }
    
    .ats-search-button-wrapper {
        grid-column: 1 / -1 !important;
        margin-top: 8px !important;
    }
    
    .ats-search-button {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* Móviles */
@media (max-width: 480px) {
    :root {
        --ats-form-padding: 16px;
        --ats-form-gap: 12px;
        --ats-field-height: 44px;
        --ats-field-font-size: 16px; /* Evitar zoom en iOS */
        --ats-field-padding: 0 16px 0 40px;
    }
    
    .ats-filters-row {
        grid-template-columns: 1fr !important;
        gap: var(--ats-form-gap) !important;
    }
    
    .ats-search-button-wrapper {
        grid-column: 1 !important;
        margin-top: 8px !important;
    }
    
    .ats-field-label {
        font-size: 13px !important;
    }
    
    .ats-field-icon {
        font-size: 16px !important;
    }
}

/* Móviles muy pequeños */
@media (max-width: 360px) {
    :root {
        --ats-form-padding: 12px;
        --ats-field-padding: 0 12px 0 36px;
    }
    
    .ats-field-icon {
        font-size: 14px !important;
    }
    
    .ats-select-arrow {
        right: 12px !important;
    }
}

/* ==================== MODO OSCURO ==================== */

@media (prefers-color-scheme: dark) {
    :root {
        --ats-form-bg: #2d3748;
        --ats-field-bg: #4a5568;
        --ats-field-border: #718096;
        --ats-field-text: #e2e8f0;
        --ats-field-placeholder: #a0aec0;
        --ats-field-icon-color: #a0aec0;
        --ats-dropdown-arrow: #a0aec0;
    }
}

/* ==================== ACCESIBILIDAD ==================== */

/* Reducir movimiento */
@media (prefers-reduced-motion: reduce) {
    .ats-field-input,
    .ats-field-select,
    .ats-search-button,
    .ats-counter-btn,
    .ats-select-arrow {
        transition: none !important;
        animation: none !important;
    }
    
    .ats-search-button:hover {
        transform: none !important;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    :root {
        --ats-field-border: #000000;
        --ats-field-border-focus: #0066cc;
        --ats-button-bg: #0066cc;
        --ats-button-bg-hover: #0052a3;
    }
    
    .ats-field-input:focus,
    .ats-field-select:focus {
        outline: 2px solid #000000 !important;
        outline-offset: 2px !important;
    }
}

/* ==================== UTILIDADES ==================== */

/* Ocultar elementos visualmente pero mantener accesibilidad */
.ats-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Estados de carga */
.ats-search-form.loading {
    opacity: 0.7 !important;
    pointer-events: none !important;
}

.ats-search-form.loading .ats-search-button {
    position: relative !important;
}

.ats-search-form.loading .ats-search-button::after {
    content: '' !important;
    position: absolute !important;
    width: 16px !important;
    height: 16px !important;
    border: 2px solid transparent !important;
    border-top: 2px solid currentColor !important;
    border-radius: 50% !important;
    animation: atsFormSpin 1s linear infinite !important;
}

@keyframes atsFormSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== TEMAS PERSONALIZADOS ==================== */

/* Verde (tema por defecto) */
.ats-widget-container[data-theme="green"] {
    --ats-button-bg: #48bb78;
    --ats-button-bg-hover: #38a169;
    --ats-button-bg-active: #2f855a;
    --ats-field-border-focus: #48bb78;
}

/* Azul */
.ats-widget-container[data-theme="blue"] {
    --ats-button-bg: #4299e1;
    --ats-button-bg-hover: #3182ce;
    --ats-button-bg-active: #2c5282;
    --ats-field-border-focus: #4299e1;
}

/* Púrpura */
.ats-widget-container[data-theme="purple"] {
    --ats-button-bg: #9f7aea;
    --ats-button-bg-hover: #805ad5;
    --ats-button-bg-active: #6b46c1;
    --ats-field-border-focus: #9f7aea;
}

/* Naranja */
.ats-widget-container[data-theme="orange"] {
    --ats-button-bg: #ed8936;
    --ats-button-bg-hover: #dd6b20;
    --ats-button-bg-active: #c05621;
    --ats-field-border-focus: #ed8936;
}

/* Rojo */
.ats-widget-container[data-theme="red"] {
    --ats-button-bg: #f56565;
    --ats-button-bg-hover: #e53e3e;
    --ats-button-bg-active: #c53030;
    --ats-field-border-focus: #f56565;
}

/*
================================================================================
FORMS CSS v3.2.2-FIXED-HORIZONTAL ✅
================================================================================

🔧 FORMULARIO HORIZONTAL EXACTO SEGÚN IMAGEN IMPLEMENTADO:

✅ LAYOUT HORIZONTAL PERFECTO:
- Grid de 4 campos + botón verde como en imagen 2
- Campos uniformes con altura consistente
- Espaciado equilibrado y proporcional
- Responsive que colapsa apropiadamente

✅ CAMPOS ESTILIZADOS:
- Fondo blanco limpio como en la imagen
- Bordes sutiles con estados focus verde
- Iconos integrados en labels
- Placeholders claros y legibles

✅ DROPDOWNS FUNCIONALES:
- Flechas personalizadas estilizadas
- Estados hover y focus apropiados
- Autocompletado con dropdown personalizado
- Opciones con scroll si es necesario

✅ BOTÓN DE BÚSQUEDA:
- Verde (#48bb78) exacto como en imagen
- Efectos hover y estados activos
- Icono de búsqueda integrado
- Responsive en móviles

✅ RESPONSIVE DESIGN:
- Desktop: 4 campos + botón horizontal
- Tablet: 2x2 + botón debajo
- Mobile: campos apilados verticalmente
- Touch-friendly en dispositivos móviles

✅ ACCESIBILIDAD:
- Labels semánticos correctos
- Focus management apropiado
- Keyboard navigation
- Screen reader support
- High contrast mode

✅ PERSONALIZACIÓN:
- Variables CSS para colores
- Temas predefinidos (green, blue, purple, etc.)
- Dark mode support
- Estados de carga y error

🎯 RESULTADO: Formulario que replica exactamente el diseño horizontal de la imagen 2
================================================================================
*/