/**
 * WooCommerce AJAX Filters Pro - Estilos
 */

/* Botón toggle filtros para mobile */
.waf-filters-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: #2c3e50;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.waf-filters-toggle:hover {
    background: #34495e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.waf-filters-toggle svg {
    width: 20px;
    height: 20px;
}

/* Overlay para mobile */
.waf-filters-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Botón cerrar dentro del sidebar (mobile) */
.waf-filters-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    z-index: 10;
    transition: all 0.3s ease;
}

.waf-filters-close:hover {
    color: #e74c3c;
    transform: rotate(90deg);
}

.waf-filters-close svg {
    display: block;
}

/* Contenedor principal */
.waf-filters-wrapper {
    display: flex;
    gap: 30px;
    margin: 20px 0;
}

/* Sidebar de filtros */
.waf-filters-sidebar {
    flex: 0 0 280px;
    background: #f8f8f8;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.waf-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
}

.waf-filters-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

/* Campo de búsqueda de productos */
.waf-search-filter {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.waf-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.waf-search-input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.waf-search-input:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.waf-search-icon {
    position: absolute;
    left: 12px;
    color: #fff;
    pointer-events: none;
}

.waf-search-clear {
    position: absolute;
        right: 0px;
    margin-right: 0;
    background: #e74c3c;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.waf-search-input:not(:placeholder-shown) ~ .waf-search-clear {
    display: flex;
}

.waf-search-clear:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Campos de búsqueda dentro de filtros */
.waf-filter-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.waf-filter-search:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.waf-filter-search::placeholder {
    color: #999;
    font-style: italic;
}

/* ============================================
   FORMULARIOS DE BÚSQUEDA (Shortcode)
   ============================================ */

/* Estilo por defecto */
.waf-search-form {
    margin: 20px 0;
}

.waf-search-wrapper {
    display: flex;
    gap: 0;
    max-width: 600px;
}

.waf-search-field {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #ddd;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.waf-search-field:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.waf-search-submit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 0 6px 6px 0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.waf-search-submit:hover {
    background: #34495e;
}

.waf-search-submit svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Estilo minimal */
.waf-search-form-minimal .waf-search-wrapper {
    max-width: 400px;
}

.waf-search-form-minimal .waf-search-field {
    padding: 10px 16px;
    font-size: 14px;
}

.waf-search-form-minimal .waf-search-submit {
    padding: 10px 20px;
    font-size: 14px;
}

.waf-search-form-minimal .waf-search-submit span {
    display: none;
}

/* Estilo modern */
.waf-search-form-modern .waf-search-wrapper {
    background: white;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.waf-search-form-modern .waf-search-field {
    border: none;
    border-radius: 50px 0 0 50px;
    padding: 16px 24px;
}

.waf-search-form-modern .waf-search-submit {
    border-radius: 0 50px 50px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.waf-search-form-modern .waf-search-submit:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Formulario de búsqueda de WooCommerce personalizado */
.waf-product-search {
    display: flex;
    max-width: 500px;
}

.waf-product-search .search-field {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-right: none;
    border-radius: 4px 0 0 4px;
}

.waf-product-search button {
    padding: 0 12px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.waf-product-search button:hover {
    background: #34495e;
}

.waf-clear-filters {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.waf-clear-filters:hover {
    background: #c0392b;
}

/* Grupos de filtros */
.waf-filter-group {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.waf-filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.waf-filter-title {
    margin: 0 0 15px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.waf-filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Scroll para filtros largos */
.waf-filter-scrollable {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

.waf-filter-scrollable::-webkit-scrollbar {
    width: 6px;
}

.waf-filter-scrollable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.waf-filter-scrollable::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.waf-filter-scrollable::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Filtros activos */
.waf-active-filters {
    background: #fff3cd;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ffc107;
}

.waf-active-filters .waf-filter-title {
    color: #856404;
    margin-bottom: 12px;
}

.waf-active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.waf-active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid #ffc107;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    color: #333;
}

.waf-active-filter-tag .filter-label {
    font-weight: 600;
    color: #856404;
}

.waf-active-filter-tag .filter-value {
    color: #333;
}

.waf-active-filter-tag .remove-filter {
    background: #dc3545;
    color: white;
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 4px;
}

.waf-active-filter-tag .remove-filter:hover {
    background: #c82333;
    transform: scale(1.1);
}

.waf-filter-option {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.waf-filter-option:hover {
    background: #f0f0f0;
}

.waf-filter-option.active {
    background: #e8f4f8;
    border-left: 3px solid #2c3e50;
}

.waf-filter-option input {
    margin: 0 10px 0 0;
    cursor: pointer;
}

.waf-filter-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    font-size: 14px;
    color: #555;
}

/* Select de ordenamiento */
.waf-orderby-select,
.waf-perpage-select {
    width: 100%;
    height: 50px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.waf-orderby-select:hover,
.waf-perpage-select:hover {
    border-color: #2c3e50;
}

.waf-orderby-select:focus,
.waf-perpage-select:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

/* Categorías jerárquicas */
.waf-category-child {
    margin-left: 20px;
    border-left: 2px solid #e0e0e0;
    padding-left: 10px;
}

.waf-category-child .waf-filter-label {
    font-size: 13px;
    color: #666;
}

.waf-category-parent.active {
    font-weight: 600;
}

.waf-filter-count {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
}

/* Contenedor de productos */
.waf-products-container {
    flex: 1;
    position: relative;
    min-height: 400px;
}

/* Loader */
.waf-loader {
    position: relative;
    top: 5%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 50px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.waf-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 15px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2c3e50;
    border-radius: 50%;
    animation: waf-spin 1s linear infinite;
}

@keyframes waf-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.waf-loader p {
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}

/* Wrapper de productos */
.waf-products-wrapper {
    position: relative;
    min-height: 300px;
    transition: opacity 0.3s ease;
}

/* Paginación */
.waf-pagination-wrapper {
    margin-top: 30px;
}

/* ============================================
   RESPONSIVE - MOBILE OFF-CANVAS
   ============================================ */

@media (max-width: 768px) {
    /* Mostrar botón toggle en mobile */
    .waf-filters-toggle {
        display: flex;
    }
    
    /* Mostrar botón cerrar en mobile */
    .waf-filters-close {
        display: block;
    }
    
    /* Sidebar off-canvas en mobile */
    .waf-filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        z-index: 999;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
        padding: 60px 20px 25px;
    }
    
    /* Sidebar abierto */
    body.waf-filters-open .waf-filters-sidebar {
        left: 0;
    }
    
    /* Overlay visible cuando está abierto */
    body.waf-filters-open .waf-filters-overlay {
        display: block;
        opacity: 1;
    }
    
    /* Prevenir scroll del body cuando está abierto */
    body.waf-filters-open {
        overflow: hidden;
    }
    
    /* Ajustar wrapper para no usar flex en mobile */
    .waf-filters-wrapper {
        flex-direction: column;
        gap: 0;
    }
    
    /* Productos ocupan todo el ancho */
    .waf-products-container {
        width: 100%;
    }
    
    /* Ajustar header de filtros en mobile */
    .waf-filters-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .waf-filters-header h3 {
        font-size: 20px;
        text-align: center;
    }
    
    .waf-clear-filters {
        width: 100%;
    }
    
    /* Ajustar filtros activos en mobile */
    .waf-active-filter-tag {
        font-size: 12px;
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    /* Sidebar más ancho en pantallas muy pequeñas */
    .waf-filters-sidebar {
        width: 90%;
        max-width: none;
    }
    
    /* Botón toggle más pequeño */
    .waf-filters-toggle {
        padding: 10px 16px;
        font-size: 14px;
    }
}

.waf-pagination {
    text-align: center;
}

.waf-pagination ul {
    display: inline-flex;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.waf-pagination li {
    margin: 0;
}

.waf-pagination a,
.waf-pagination span {
    display: block;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.waf-pagination a:hover {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.waf-pagination .current {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 992px) {
    .waf-filters-wrapper {
        flex-direction: column;
    }
    
    .waf-filters-sidebar {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .waf-filters-sidebar {
        padding: 20px;
    }
    
    .waf-filters-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .waf-clear-filters {
        width: 100%;
    }
}

/* Integración con temas de WooCommerce */
.waf-products-wrapper .products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.waf-products-wrapper .product {
    text-align: center;
}

/* Estilos adicionales para mejorar UX */
.waf-filter-option input:focus {
    outline: 2px solid #2c3e50;
    outline-offset: 2px;
}

.waf-filters-sidebar::-webkit-scrollbar {
    width: 8px;
}

.waf-filters-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.waf-filters-sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.waf-filters-sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}
