/**
 * CSS para widgets avanzados AEU
 * Estilos profesionales para filtros avanzados
 */

/* === CONTAINER PRINCIPAL === */
.aeu-advanced-filters-wrapper {
    position: relative;
}

.aeu-advanced-filters-wrapper.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* === FORMULARIO === */
.aeu-advanced-filters-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* === CAMPOS DE FORMULARIO === */
.aeu-filter-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.aeu-filter-field.hidden {
    display: none !important;
}

/* Anchos responsivos */
.aeu-filter-field.width-25 { flex: 0 0 calc(25% - 11.25px); }
.aeu-filter-field.width-33 { flex: 0 0 calc(33.333% - 10px); }
.aeu-filter-field.width-50 { flex: 0 0 calc(50% - 7.5px); }
.aeu-filter-field.width-66 { flex: 0 0 calc(66.666% - 5px); }
.aeu-filter-field.width-75 { flex: 0 0 calc(75% - 3.75px); }
.aeu-filter-field.width-100 { flex: 0 0 100%; }

@media (max-width: 768px) {
    .aeu-filter-field {
        flex: 0 0 100% !important;
    }
}

/* === ETIQUETAS === */
.aeu-filter-label {
    font-weight: 500;
    margin-bottom: 5px;
    color: #333333;
    font-size: 14px;
}

.aeu-filter-label.required::after {
    content: ' *';
    color: #e74c3c;
}

/* === INPUTS BÁSICOS === */
.aeu-filter-input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #ffffff;
}

.aeu-filter-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.aeu-filter-input:disabled {
    background: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

/* === SELECTS === */
.aeu-filter-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* === CHECKBOXES === */
.aeu-filter-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.aeu-filter-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #007cba;
    cursor: pointer;
}

.aeu-filter-checkbox-label {
    font-size: 14px;
    color: #555;
    cursor: pointer;
    user-select: none;
}

/* === RANGOS DE FECHA === */
.aeu-date-range-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.aeu-date-range-separator {
    color: #666;
    font-size: 14px;
    flex-shrink: 0;
}

.aeu-date-range-wrapper .aeu-filter-input {
    flex: 1;
    min-width: 0;
}

/* === BÚSQUEDA === */
.aeu-search-wrapper {
    position: relative;
}

.aeu-search-input {
    padding-left: 40px;
}

.aeu-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 16px;
    pointer-events: none;
}

/* === BOTONES === */
.aeu-filter-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.aeu-filter-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.aeu-filter-submit-btn {
    background: #007cba;
    color: white;
}

.aeu-filter-submit-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.aeu-filter-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.aeu-filter-reset-btn {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.aeu-filter-reset-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* === ESTADOS DE CARGA === */
.aeu-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
}

.aeu-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: aeu-spin 1s linear infinite;
}

@keyframes aeu-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === MENSAJES DE ERROR === */
.aeu-error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 15px;
    border: 1px solid #f5c6cb;
    font-size: 14px;
    display: none;
}

.aeu-error-message.show {
    display: block;
}

/* === ESTILOS DE ELEMENTOR === */
.elementor-widget-aeu_advanced_filters .elementor-widget-container {
    overflow: visible;
}

/* === TARGET LOADING STATES === */
.aeu-target-loading {
    position: relative;
}

.aeu-target-loading .elementor-loop-container,
.aeu-target-loading .elementor-posts-container,
.aeu-target-loading .elementor-posts {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1024px) {
    .aeu-advanced-filters-form {
        gap: 12px;
    }

    .aeu-advanced-filters-wrapper {
    }
}

@media (max-width: 768px) {
    .aeu-advanced-filters-wrapper {

    }

    .aeu-advanced-filters-form {
        gap: 10px;
    }

    .aeu-filter-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .aeu-filter-btn {
        justify-content: center;
    }

    .aeu-date-range-wrapper {
        flex-direction: column;
        gap: 8px;
    }

    .aeu-date-range-separator {
        align-self: center;
    }
}

/* === ACCESIBILIDAD === */
.aeu-filter-input:focus,
.aeu-filter-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* === ANIMACIONES SUTILES === */
.aeu-filter-field {
    transition: opacity 0.3s ease;
}

.aeu-filter-field.hidden {
    opacity: 0;
    pointer-events: none;
}

.aeu-advanced-filters-wrapper {

}

.aeu-advanced-filters-wrapper:hover {
}

/* === ICONOS === */
.aeu-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
}

/* === COMPATIBILIDAD CON THEMES === */
.aeu-advanced-filters-wrapper * {
    box-sizing: border-box;
}

.aeu-advanced-filters-wrapper input,
.aeu-advanced-filters-wrapper select,
.aeu-advanced-filters-wrapper button {
    font-family: inherit;
}

/* === DARK MODE SUPPORT === */
@media (prefers-color-scheme: dark) {
    .aeu-advanced-filters-wrapper {

    }

    .aeu-filter-input {
        background: #404040;
        border-color: #555;
        color: #ffffff;
    }

    .aeu-filter-input:focus {
        border-color: #4a9eff;
        box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.1);
    }

    .aeu-filter-label {
        color: #e0e0e0;
    }

    .aeu-filter-reset-btn {
        background: #404040;
        color: #e0e0e0;
        border-color: #555;
    }
}