/* Modern Professional Filters CSS */

/* Main card styling */
#filters-form .card {
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-radius: 12px;
    overflow: hidden;
}

/* Filter group styling */
.filter-group {
    border-bottom: 1px solid #f0f0f0;
}

.filter-group:last-of-type {
    border-bottom: none;
}

/* Card header improvements */
.filter-group .card-header {
    background-color: #fff;
    border: none;
    padding: 1rem 1.25rem;
    transition: background-color 0.2s ease;
}

.filter-group .card-header:hover {
    background-color: #f8f9fa;
}

.filter-group .card-header h6 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: -0.02em;
}

.filter-group .card-header .icon-control {
    font-size: 12px;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.filter-group .card-header button[aria-expanded="true"] .icon-control {
    transform: rotate(180deg);
}

/* Card body spacing */
.filter-group .card-body {
    padding: 1rem 1.25rem 1.5rem;
    background-color: #fff;
}

/* List menu container */
.list-menu {
    padding-left: 0;
    margin-left: 0;
}

/* Checkbox improvements */
.filters-form-instance .form-check,
#filters-form-desktop .form-check,
#filters-form-mobile .form-check {
    padding-left: 0 !important;
    margin-bottom: 0.75rem;
    display: flex !important;
    align-items: center;
    margin-left: 0 !important;
}

.filters-form-instance .form-check-input,
#filters-form-desktop .form-check-input,
#filters-form-mobile .form-check-input {
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    margin-right: 12px !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    border: 2px solid #d1d5db !important;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    opacity: 1 !important;
    visibility: visible !important;
}

.form-check-input:hover:not(:disabled) {
    border-color: #0d6efd;
}

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

.form-check-input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.form-check-label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    line-height: 1.4;
    transition: color 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.form-check-input:disabled ~ .form-check-label {
    color: #9ca3af;
    cursor: not-allowed;
}

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

.form-check-label:active {
    opacity: 0.7;
}

/* Badge count styling */
.badge-count {
    font-size: 11px;
    color: #6b7280;
    background-color: #f3f4f6;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Toggle button styling */
.toggle-btn {
    font-size: 13px;
    color: #0d6efd;
    text-decoration: none;
    padding: 0.5rem 0 0 0;
    display: inline-block;
    transition: color 0.2s ease;
}

.toggle-btn:hover {
    color: #0a58ca;
    text-decoration: none;
}

/* Apply filters button - Desktop Sticky */
#filters-form .card-body:last-child {
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 10;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
    border-radius: 0 0 12px 12px;
}

#apply-filters-btn {
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
}

#apply-filters-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

#apply-filters-btn:active {
    transform: translateY(0);
}

/* Pulse animation for mobile "Apply" button */
@keyframes pulseAttention {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 6px rgba(13, 110, 253, 0);
    }
}

.pulse-attention {
    animation: pulseAttention 0.6s ease-out;
}

/* Reset filters button */
#filters-form .btn-outline-secondary {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

/* Price slider improvements */
#price-slider {
    margin: 1.5rem 0 1rem;
}

.noUi-connect {
    background: #0d6efd;
}

.noUi-handle {
    border: 2px solid #0d6efd;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.noUi-handle:hover {
    background: #f8f9fa;
}

.noUi-handle:active {
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

/* Mobile improvements */
@media (max-width: 768px) {
    /* IMPORTANT: Override any styles that hide checkboxes on mobile */
    .filters-form-instance input[type="checkbox"],
    #filters-form-mobile input[type="checkbox"],
    #filters-form-desktop input[type="checkbox"],
    .filters-form-instance .form-check-input,
    #filters-form-mobile .form-check-input,
    #filters-form-desktop .form-check-input {
        display: inline-block !important;
        width: 20px !important;
        height: 20px !important;
        margin-right: 14px !important;
        margin-left: 0 !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
    }

    .filters-form-instance .form-check,
    #filters-form-mobile .form-check,
    #filters-form-desktop .form-check {
        padding-left: 0 !important;
        margin-left: 0 !important;
        display: flex !important;
    }

    .filters-form-instance .form-check-label,
    #filters-form-mobile .form-check-label,
    #filters-form-desktop .form-check-label {
        font-size: 15px;
        margin-left: 0 !important;
    }

    .filter-group .card-header h6 {
        font-size: 16px;
    }

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

    .badge-count {
        font-size: 12px;
        padding: 3px 9px;
    }
}

/* Smooth animations */
.collapse {
    transition: height 0.3s ease;
}

/* Filter title styling */
.filter-group .card-header .title {
    color: #6c757d;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Desktop filters card */
@media (min-width: 769px) {
    aside .card {
        position: sticky;
        top: 20px;
    }
}

/* Ensure more-items are hidden by default */
.filters-form-instance .more-items.d-none,
#filters-form-desktop .more-items.d-none,
#filters-form-mobile .more-items.d-none {
    display: none !important;
}

/* Mobile filter header buttons */
.mobile-filter-header .d-flex.gap-2 {
    gap: 8px;
}

/* Fallback for older browsers */
.mobile-filter-header .d-flex.gap-2 > * + * {
    margin-left: 8px;
}

/* Floating apply button (desktop only) */
.floating-apply-btn {
    background-color: #0d6efd;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease-out;
    white-space: nowrap;
}

.floating-apply-btn:hover {
    background-color: #0b5ed7;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.5);
}

.floating-apply-btn.fade-out {
    opacity: 0;
    transform: translateX(20px);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}