/**
 * Advanced Product Filters Styles
 */

/* ========== SIDEBAR GENERAL ========== */
.product-filters-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.product-filters-sidebar::-webkit-scrollbar {
    width: 6px;
}

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

.product-filters-sidebar::-webkit-scrollbar-thumb {
    background: #c8102e;
    border-radius: 3px;
}

.product-filters-sidebar::-webkit-scrollbar-thumb:hover {
    background: #9c0a25;
}

/* ========== HEADER DE FILTROS ========== */
.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 2px solid #c8102e;
}

.filters-title {
    font-weight: 600;
    color: #333;
    margin: 0;
    font-size: 1.1rem;
}

.filters-title i {
    margin-right: 0.5rem;
    color: #c8102e;
}

.filters-clear {
    color: #c8102e;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filters-clear:hover {
    color: #9c0a25;
    text-decoration: underline;
}

/* ========== GRUPO DE FILTROS ========== */
.filter-group {
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.filter-group:hover {
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.1) !important;
}

.filter-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f1f3 100%);
    cursor: pointer;
    padding: 1rem;
    user-select: none;
    transition: all 0.3s ease;
}

.filter-header:hover {
    background: linear-gradient(135deg, #f0f1f3 0%, #e8eaed 100%);
}

.filter-header h6 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
}

.filter-header i:last-child {
    font-size: 0.8rem;
    color: #666;
    transition: transform 0.3s ease;
}

.filter-header[aria-expanded="true"] i:last-child {
    transform: rotate(180deg);
}

/* ========== CONTENIDO DE FILTROS ========== */
.filter-group .card-body {
    padding: 1rem;
}

.filter-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.form-check-input:hover {
    border-color: #c8102e;
    box-shadow: 0 0 5px rgba(200, 16, 46, 0.3);
}

.form-check-input:checked {
    background-color: #c8102e;
    border-color: #c8102e;
}

.form-check-label {
    margin: 0;
    cursor: pointer;
    user-select: none;
    font-size: 0.95rem;
    color: #555;
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-check-label:hover {
    color: #333;
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
}

/* ========== RANGO DE PRECIO ========== */
.price-range-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-range {
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
}

.form-range::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    background: #c8102e;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-range::-webkit-slider-thumb:hover {
    background: #9c0a25;
    box-shadow: 0 0 8px rgba(200, 16, 46, 0.4);
    transform: scale(1.2);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #c8102e;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.form-range::-moz-range-thumb:hover {
    background: #9c0a25;
    box-shadow: 0 0 8px rgba(200, 16, 46, 0.4);
    transform: scale(1.2);
}

.price-inputs {
    display: flex;
    gap: 0.5rem;
}

.form-control-sm {
    font-size: 0.875rem;
    padding: 0.5rem;
    border-color: #ddd;
    transition: all 0.3s ease;
}

.form-control-sm:focus {
    border-color: #c8102e;
    box-shadow: 0 0 0 0.2rem rgba(200, 16, 46, 0.25);
}

/* ========== SELECT DE ORDENAR ========== */
.form-select-sm {
    font-size: 0.875rem;
    padding: 0.5rem;
    border-color: #ddd;
    transition: all 0.3s ease;
}

.form-select-sm:focus {
    border-color: #c8102e;
    box-shadow: 0 0 0 0.2rem rgba(200, 16, 46, 0.25);
}

/* ========== BOTONES DE ACCIÓN ========== */
.filter-actions {
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.btn-danger {
    background-color: #c8102e;
    border-color: #c8102e;
    font-weight: 600;
    transition: all 0.3s ease;
    border-radius: 6px;
}

.btn-danger:hover {
    background-color: #9c0a25;
    border-color: #9c0a25;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.3);
}

.btn-outline-secondary {
    color: #666;
    border-color: #ddd;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background-color: #f0f1f3;
    border-color: #999;
    color: #333;
}

/* ========== CURSOR POINTER ========== */
.cursor-pointer {
    cursor: pointer;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991.98px) {
    .product-filters-sidebar {
        position: static;
        top: auto;
        max-height: none;
        overflow-y: auto;
        margin-bottom: 2rem;
    }

    .filter-group {
        margin-bottom: 1rem;
    }

    .filters-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    .price-inputs {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-header h6 {
        font-size: 0.85rem;
    }

    .form-check-label {
        font-size: 0.9rem;
    }

    .filter-group .card-body {
        padding: 0.75rem;
    }

    .filter-checkbox-group {
        gap: 0.5rem;
    }
}

/* ========== ANIMACIONES ========== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-filters-sidebar {
    animation: slideIn 0.3s ease-out;
}

.filter-group {
    animation: slideIn 0.3s ease-out;
}

/* ========== ESTADOS ========== */
.filter-group.active {
    border-left: 4px solid #c8102e;
}

/* ========== CONTADOR DE FILTROS ========== */
.filter-badge {
    display: inline-block;
    background: #c8102e;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* ========== LOADING STATE ========== */
button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== MOBILE OPTIMIZATIONS ========== */
@media (max-width: 576px) {
    .product-filters-sidebar {
        position: static;
        top: auto;
        max-height: none;
    }

    .filter-header {
        padding: 0.75rem;
    }

    .filter-group .card-body {
        padding: 0.5rem;
    }

    .form-check {
        gap: 0.4rem;
    }

    .form-check-input {
        width: 16px;
        height: 16px;
    }

    .btn-danger,
    .btn-outline-secondary {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
}

/* ========== SCROLL SMOOTH ========== */
html {
    scroll-behavior: smooth;
}

.product-filters-sidebar {
    scroll-behavior: smooth;
}

/* ========== ACCESIBILIDAD ========== */
.form-check-input:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid #c8102e;
    outline-offset: 2px;
}

.filter-header:focus-within {
    outline: 2px solid #c8102e;
    outline-offset: -2px;
}

/* ========== MODO OSCURO (Si aplica) ========== */
@media (prefers-color-scheme: dark) {
    .product-filters-sidebar {
        background: #1e1e1e;
        color: #e0e0e0;
    }

    .filter-header {
        background: #2d2d2d;
    }

    .filter-header h6 {
        color: #e0e0e0;
    }

    .form-check-label {
        color: #d0d0d0;
    }

    .filter-group .card {
        background: #252525;
        border-color: #404040;
    }

    .form-control,
    .form-select {
        background: #2d2d2d;
        color: #e0e0e0;
        border-color: #404040;
    }

    .form-control:focus,
    .form-select:focus {
        background: #2d2d2d;
        color: #e0e0e0;
        border-color: #c8102e;
    }
}

/* ========== TRANSICIONES ========== */
.filter-group,
.form-check-input,
.btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-header i:last-child {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== RESPONSIVE - TABLET ========== */
@media (max-width: 991.98px) {
    .product-filters-sidebar {
        position: static;
        max-height: none;
        margin-bottom: 2rem;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 1rem;
    }
    
    .filter-group {
        margin-bottom: 1rem;
    }
    
    .collapse:not(.show) {
        display: none;
    }
}

/* ========== RESPONSIVE - MOBILE ========== */
@media (max-width: 575.98px) {
    .product-filters-sidebar {
        margin-bottom: 1.5rem;
        padding: 0.75rem;
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        z-index: 1050;
        background: white;
        overflow-y: auto;
    }
    
    .product-filters-sidebar.show {
        display: block;
    }
    
    .filters-header {
        padding-bottom: 0.75rem;
        position: sticky;
        top: 0;
        background: white;
        z-index: 1051;
    }
    
    .filters-title {
        font-size: 1rem;
    }
    
    .filter-group {
        margin-bottom: 0.75rem;
    }
    
    .filter-group .card {
        box-shadow: none;
        border: 1px solid #e0e0e0;
    }
    
    .filter-header {
        padding: 0.75rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    #filters-close-btn {
        margin-left: auto;
    }
}
