/**
 * Unit Filters Styles - Figma Design
 * Clean, modern design matching Figma mockup
 */

/* Override Bootstrap collapse that hides filters on mobile - ONLY for filters */
#unit-filters-container .collapse:not(.show) {
    display: block !important;
}

.unit-filters-wrapper .collapse:not(.show) {
    display: block !important;
}

/* Main Container */
.unit-filters-wrapper {
    background: #fff;
    border-radius: 8px;
    padding: 0;
}

.unit-filters {
    width: 100%;
}

.filter-loading {
    padding: 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Filter Sections */
.filter-section {
    padding: 0;
    margin-bottom: 0;
    border: none;
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section-features {
    background-color: transparent;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 0;
}

.filter-section.filter-section-features.filter-section-collapsed {
    background-color: transparent;
}

/* Filter Section Header */
.filter-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
}

/* Features Header - Desktop */
.filter-features-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.filter-features-header .filter-section-header {
    margin-bottom: 0;
    flex: 1;
}

.filter-section-number {
    display: none;
}

.filter-section-title {
    font-size: 24px;
    font-weight: 700;
    color: #00173C;
    flex: 1;
}

.filter-section-key {
    display: none;
}

.filter-section-toggle {
    font-size: 12px;
    color: #666;
    transition: transform 0.3s;
}

.filter-section-collapsed .filter-section-toggle {
    transform: rotate(-90deg);
}

/* Filter Options */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 0;
}

.filter-options-collapsed .filter-option-hidden {
    display: none;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background-color: #E6F2FF;
    border-radius: 16px;
    margin-bottom: 1px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.filter-option:hover {
    background-color: #D6E9FF;
}

.filter-option-hidden {
    display: none;
}

/* Checkbox Styling - Figma Design */
.filter-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 4px;
    margin-right: 12px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s;
    background-color: #fff;
}

.filter-checkbox:checked {
    background-color: #0066CC;
    border: none;
}

.filter-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
}

.filter-checkbox:focus {
    outline: 2px solid #0066CC;
    outline-offset: 2px;
}

.checkbox-label {
    font-size: 16px;
    color: #646F79;
    font-weight: 400;
    flex: 1;
}

/* Size Filter Dropdown - Mobile Only */
.filter-size-header {
    display: none; /* Hidden on desktop */
}

.filter-size-header .filter-section-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #00173C;
}

.filter-size-dropdown-wrapper {
    position: relative;
}

.filter-size-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background-color: #fff;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    font-weight: 400;
    color: #646F79;
    min-width: 120px;
}

.filter-size-dropdown-btn:hover {
    background-color: #F5F5F5;
    border-color: #B5B9BE;
}

.filter-size-dropdown-btn.active {
    background-color: #E6F2FF;
    border-color: #0066CC;
    color: #00173C;
    font-weight: 500;
}

.filter-size-dropdown-label {
    flex: 1;
    text-align: left;
}

.filter-size-dropdown-arrow {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.filter-size-dropdown-btn-open .filter-size-dropdown-arrow {
    transform: rotate(180deg);
}

.filter-size-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 100%;
    overflow: hidden;
}

.filter-size-dropdown-menu.filter-size-dropdown-open {
    display: block;
}

.filter-size-dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 16px;
    font-weight: 400;
    color: #646F79;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-size-dropdown-item:hover {
    background-color: #F5F5F5;
    color: #00173C;
}

.filter-size-dropdown-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.filter-size-dropdown-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Show More Button */
.filter-show-more-btn {
    margin-top: 8px;
    padding: 8px 12px;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    color: #0066CC;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
}

.filter-show-more-btn:hover {
    background-color: #0066CC;
    color: #fff;
}

.filter-show-more-btn:focus {
    outline: 2px solid #0066CC;
    outline-offset: 2px;
}

/* Size Filter Specific Styles */
.filter-section:not(.filter-section-features) {
    padding: 16px;
    margin-bottom: 0;
}

.filter-section:not(.filter-section-features) .filter-option {
    background-color: #E6F2FF;
}

.filter-section:not(.filter-section-features) .filter-option:hover {
    background-color: #D6E9FF;
}

/* Reset Button */
.filter-actions {
    padding-top: 0px 16px;
    border-top: none;
}

.btn-reset-filters {
    width: 100%;
    padding: 10px 16px;
    background-color: #B5B9BE;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #4D4D4D;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-reset-filters:hover {
    background-color: #A0A5AA;
}

.btn-reset-filters.active {
    background-color: #0066CC;
    color: #fff;
}

.btn-reset-filters.active:hover {
    background-color: #0052A3;
}

.btn-reset-filters:active {
    transform: translateY(1px);
}

.btn-reset-filters:focus {
    outline: 2px solid #0066CC;
    outline-offset: 2px;
}

/* Hide "Filter Units" header from theme */
.filter-units-header {
    display: none !important;
}

/* Remove border from filter-units container */
.filter-units {
    border: none !important;
    border-radius: 8px;
    padding: 0 16px !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* No Data Message */
.filter-no-data {
    padding: 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 16px;
}

.filter-no-data p {
    margin: 0;
}

/* Skeleton Loader */
.filter-skeleton {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
}

.skeleton-section {
    height: 80px;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive Design */
@media (max-width: 991px) {
    .filter-section {
        padding: 12px;
    }

    .filter-section-features {
        padding: 12px;
    }

    .filter-options {
        gap: 12px;
    }

    .filter-option {
        padding: 8px 10px;
    }
}

@media (max-width: 576px) {
    .filter-section-header {
        gap: 8px;
    }

    .filter-section-number {
        font-size: 12px;
        min-width: 16px;
    }

    .filter-section-title {
        font-size: 14px;
    }

    .filter-section-key {
        font-size: 11px;
    }

    .filter-option {
        padding: 8px;
    }

    .checkbox-label {
        font-size: 13px;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    /* Mobile filter-units styles */
    .filter-units {
        border: 1px solid #b5b9be;
        gap: 12px;
        background-color: hsla(210, 6%, 73%, .12);
    }
    
    /* Override Bootstrap collapse - ONLY for filters */
    #unit-filters-container .collapse:not(.show) {
        display: block !important;
    }
    
    .unit-filters-wrapper .collapse:not(.show) {
        display: block !important;
    }
    
    /* Hide desktop features */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile elements */
    .mobile-only {
        display: block !important;
    }
    
    /* More Filters button should be inline-flex */
    .filter-more-filters-btn.mobile-only {
        display: inline-flex !important;
    }
    
    /* Hide "Unit Sizing" title on mobile - it's duplicated */
    .filter-section-size > .filter-section-header {
        display: none !important;
    }
    
    /* Size header on mobile - title and More Filters button */
    .filter-size-header {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .filter-size-header .filter-section-title {
        font-size: 18px;
        font-weight: 700;
        color: #00173C;
        margin: 0;
        flex: 1;
    }
    
    /* Dropdown wrapper below header */
    .filter-size-dropdown-wrapper.mobile-only {
        display: block !important;
        width: 100%;
        margin-bottom: 0;
    }
    
    /* Hide desktop size filter on mobile */
    .filter-section-size .filter-options.desktop-only {
        display: none !important;
    }
    
    .filter-size-dropdown-btn {
        min-width: auto;
        width: 100%;
    }
    
    /* Features section */
    .filter-section-features {
        margin-bottom: 0;
    }
    
    /* Reset button */
    .btn-reset-filters {
        width: 90%;
        margin: 0 15px;
    }
    
    .filter-size-dropdown-menu {
        min-width: 140px;
        left: 0;
    }
    
    /* Features Header */
    .filter-features-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        margin-bottom: 16px;
    }
    
    /* More Filters Button - Smaller size */
    .filter-more-filters-btn {
        padding: 6px 10px;
        background-color: #00173C;
        color: #fff;
        border: none;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: all 0.2s;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .filter-more-filters-btn:hover {
        background-color: #002a5e;
    }
    
    .filter-more-filters-btn-active {
        background-color: #002a5e;
    }
    
    .filter-more-filters-btn svg {
        width: 12px;
        height: 12px;
        flex-shrink: 0;
    }
    
    /* Mobile Dropdown - Hidden by default */
    .filter-mobile-dropdown {
        display: none !important;
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        padding: 16px;
        z-index: 1000;
        max-height: 400px;
        overflow-y: auto;
    }
    
    .filter-mobile-dropdown-open {
        display: block !important;
    }
    
    /* Dropdown Header with close button */
    .filter-mobile-dropdown-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .filter-mobile-dropdown-title {
        font-size: 16px;
        font-weight: 700;
        color: #00173C;
    }
    
    .filter-mobile-dropdown-close {
        background: none;
        border: none;
        padding: 4px;
        cursor: pointer;
        color: #646F79;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        transition: all 0.2s;
    }
    
    .filter-mobile-dropdown-close:hover {
        background-color: #f0f0f0;
        color: #00173C;
    }
    
    /* 2-column grid layout for features */
    .filter-mobile-dropdown .filter-options-horizontal {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 5px;
        justify-items: stretch;
    }
    
    .filter-mobile-dropdown .filter-options-horizontal .filter-option {
        padding: 0;
        border-bottom: none;
        margin-bottom: 0;
        background-color: transparent;
        border-radius: 20px;
        flex: 0 0 auto;
    }
    
    .filter-mobile-dropdown .filter-options-horizontal .filter-checkbox {
        background-color: #fd66034f;
        margin-right: 10px;
    }
    
    .filter-mobile-dropdown .filter-options {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 5px;
        justify-items: stretch;
    }
    
    .filter-mobile-dropdown .filter-option {
        padding: 0;
        border-bottom: none;
        margin-bottom: 0;
    }
    
    /* Hide feature section header on mobile */
    .filter-section-features .filter-section-header {
        display: none !important;
    }
    
    /* Adjust feature section padding on mobile */
    .filter-section-features {
        padding: 0;
        position: relative;
        margin-bottom: 16px;
    }
    
    /* Ensure dropdown is positioned correctly */
    .filter-section-features {
        position: relative;
    }
}

/* Desktop Styles */
@media (min-width: 769px) {
    /* Hide mobile elements */
    .mobile-only {
        display: none !important;
    }
    
    /* Show desktop elements */
    .desktop-only {
        display: block;
    }
    
    /* Hide mobile size dropdown on desktop */
    .filter-size-header {
        display: none !important;
    }
    
    /* Show desktop size filter checkboxes */
    .filter-section-size .filter-options.desktop-only {
        display: flex !important;
    }
    
    /* More Filters button on desktop - hidden */
    .filter-more-filters-btn {
        display: none !important;
    }
    
    /* Desktop filter options - gap: 0 */
    .filter-options {
        gap: 0;
        padding-left: 0;
    }
    
    /* Desktop filter option - margin-bottom: 8px */
    .filter-option {
        margin-bottom: 8px;
    }
    
    /* Desktop filter section header */
    .filter-section-header {
        margin-bottom: 12px;
    }
    
    /* Desktop filter-units - p-3 (12px) */
    .filter-units {
        border-radius: 8px;
        padding: 0 12px !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
}

/* Desktop Large - p-lg-4 (24px) */
@media (min-width: 992px) {
    .filter-units {
        padding: 0 24px !important;
        padding-top: 0 !important;
    }
}

/* Print Styles */
@media print {
    .unit-filters-wrapper {
        display: none;
    }
}
