/**
 * Digitalease Main Filters CSS - Dropdown Filters în zona principală
 * 
 * Stiluri pentru filtrele dropdown afișate deasupra listei de produse
 */

/* [CTX:MAIN_FILTERS:BASE_LAYOUT] */
/* Container principal pentru filtrele main */
.digitalease-main-filters {
    /* margin: 20px 0; */
    padding: 0px 0px 20px 0;
    /* border-bottom: 1px solid #EAD5C3; */
}

.main-filters-container {
    display: flex;
    flex-direction: row;
    gap: 12px;
    max-width: 100%;
    flex-wrap: wrap;
    align-items: center;
}

/* Dropdown-uri pentru filtre */
.filter-dropdown {
    position: relative;
    flex: 0 0 auto;
    min-width: 140px;
}

.filter-dropdown-btn {
    width: 100%;
    background: white;
    border: 2px solid #EAD5C3;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    color: #2D3640;
    transition: all 0.3s ease;
    text-align: left;
    white-space: nowrap;
}

.filter-dropdown-btn:hover {
    border-color: #590202;
    background-color: #fafafa;
}

.filter-dropdown-btn.active {
    border-color: #590202;
    background-color: #590202;
    color: white;
}

.filter-dropdown-btn.active .filter-arrow {
    filter: brightness(0) invert(1);
    transform: rotate(180deg);
}

.filter-btn-text {
    flex: 1;
}

.filter-count {
    background-color: #590202;
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    margin-left: 6px;
    font-weight: 600;
}

.filter-dropdown-btn.active .filter-count {
    background-color: rgba(255, 255, 255, 0.2);
}

.filter-arrow {
    width: 14px;
    height: 14px;
    margin-left: 8px;
    transition: transform 0.3s ease;
}

/* Conținutul dropdown-ului */
.filter-dropdown-content {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: white;
    border: 2px solid #590202;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 390px;
    overflow: hidden;
    min-width: 100%;
    width: max-content;
    max-width: 350px;
}

.filter-dropdown-header {
    padding: 12px 16px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #EAD5C3;
}

.filter-dropdown-header h4 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #2D3640;
}

.filter-options-scroll {
    max-height: 325px;
    overflow-y: auto;
    padding: 8px 0;
}

/* Opțiuni de filtre în dropdown */
.filter-dropdown-content .filter-option {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 6px 14px;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-left: 38px;
    padding-right: 14px;
    font-size: 12px;
    color: #2D3640;
    line-height: 1.4;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    min-height: 28px; /* Înălțime fixă pentru a preveni jump-ul */
    box-sizing: border-box;
}

.filter-dropdown-content .filter-option:hover {
    background-color: #f8f8f8;
}

/* Checkbox-uri în dropdown */
.filter-dropdown-content .filter-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.filter-dropdown-content .filter-option .checkmark {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%) translateZ(0);
    height: 16px;
    width: 16px;
    background-color: #fff;
    border: 2px solid #EAD5C3;
    border-radius: 3px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    will-change: background-color, border-color; /* Optimizează pentru schimbările de culoare */
}

.filter-dropdown-content .filter-option:hover input ~ .checkmark {
    border-color: #590202;
    transform: translateY(-50%) translateZ(0); /* Menține poziția stabilă */
}

.filter-dropdown-content .filter-option input:checked ~ .checkmark {
    background-color: #590202;
    border-color: #590202;
    transform: translateY(-50%) translateZ(0); /* Menține poziția stabilă */
}

.filter-dropdown-content .filter-option .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 50%;
    top: 50%;
    width: 3px;
    height: 7px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg) translateZ(0);
    will-change: opacity; /* Optimizează pentru show/hide */
}

.filter-dropdown-content .filter-option input:checked ~ .checkmark:after {
    display: block;
}

.filter-dropdown-content .filter-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.filter-dropdown-content .product-count {
    color: #888;
    font-size: 10px;
    font-weight: normal;
}

/* Action buttons */
.filter-action-item {
    flex: 0 0 auto;
}

/* [CTX:MAIN_FILTERS:DESKTOP_TOGGLE] */
.desktop-filters-toggle-item {
    display: none;
}

.desktop-filters-toggle {
    white-space: nowrap;
}

.desktop-filters-toggle:active {
    transform: scale(0.98);
}

.main-apply-btn {
    background-color: #590202;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.main-apply-btn:hover {
    background-color: #4a0101;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(89, 2, 2, 0.3);
}

.main-apply-btn:active {
    transform: translateY(0);
}

.main-reset-btn {
    background-color: transparent;
    color: #590202;
    border: 2px solid #590202;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.main-reset-btn:hover {
    background-color: #590202;
    color: white;
    transform: translateY(-1px);
}

.main-reset-btn:active {
    transform: translateY(0);
}

/* Scrollbar personalizat pentru dropdown-uri */
.filter-options-scroll::-webkit-scrollbar {
    width: 8px;
}

.filter-options-scroll::-webkit-scrollbar-track {
    background: #f8f8f8;
    border-radius: 4px;
    margin: 4px 0;
}

.filter-options-scroll::-webkit-scrollbar-thumb {
    background: #EAD5C3;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.filter-options-scroll::-webkit-scrollbar-thumb:hover {
    background: #590202;
    border-color: #590202;
}

.filter-options-scroll::-webkit-scrollbar-thumb:active {
    background: #4a0101;
}

/* Scrollbar pentru Firefox */
.filter-options-scroll {
    scrollbar-width: thin;
    scrollbar-color: #EAD5C3 #f8f8f8;
}

/* Loading overlay */
.products-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #EAD5C3;
    border-top: 4px solid #590202;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content p {
    margin: 0;
    color: #2D3640;
    font-size: 16px;
}

@media (min-width: 1201px) {
    .main-filters-container.has-collapsed-desktop-filters:not(.is-expanded) > .filter-dropdown:nth-child(n + 7) {
        display: none;
    }

    .main-filters-container.has-collapsed-desktop-filters > .desktop-filters-toggle-item {
        display: block;
    }
}

/* [CTX:MAIN_FILTERS:RESPONSIVE] */
/* Responsive design */
@media (max-width: 1200px) {
    /* Ascunde filtrele principale pe mobil/tablet (drawer-ul le afișează în interior) */
    .digitalease-main-filters {
        display: none;
    }
    
    .main-filters-container {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .filter-dropdown {
        min-width: 100%;
    }
    
    .filter-dropdown-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .filter-dropdown-content {
        max-height: 325px;
        max-width: calc(100vw - 40px);
        left: 0;
        right: auto;
    }
    
    .filter-options-scroll {
        max-height: 260px;
    }
    
    .main-apply-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .main-reset-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .filter-action-item {
        width: 100%;
    }
}

/* Efecte de animație pentru dropdown */
.filter-dropdown-content {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
} 