/**
 * Lọc Sản Phẩm Nâng Cao Frontend Styles
 */

/* Main filter container */
.custom-product-filters {
    background: #f8f8f8;
    padding: 20px;
    margin: 20px 0;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

/* Filter row */
.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-item {
    display: flex;
    flex-direction: column;
}

.filter-item label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.filter-item select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    min-height: 42px;
}

/* Custom Select Styling */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-display {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    user-select: none;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.3s ease;
}

.custom-select-display:hover {
    border-color: #005bac;
}

.custom-select-display:after {
    content: '▼';
    font-size: 12px;
    color: #666;
    transition: transform 0.3s ease;
}

.custom-select-display.open:after {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dropdown option styling */
.custom-select-dropdown label {
    display: block;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.custom-select-dropdown label:last-child {
    border-bottom: none;
}

.custom-select-dropdown label:hover {
    background-color: #f8f9fa;
}

.custom-select-dropdown input[type="checkbox"] {
    margin-right: 8px;
}

/* Filter actions */
.filter-actions {
    margin-top: 20px;
    text-align: left;
}

.filter-submit {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s ease;
    margin-right: 10px;
}

.filter-submit:hover {
    background: #005a87;
}

.filter-reset {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.filter-reset:hover {
    background: #545b62;
}



/* Filtered values container */
.filtered-values-container {
    background: white;
    padding: 15px 20px;
    margin: 15px 0;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.showing-result-status {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-right: 10px;
}

.selected-filters-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.selected-category {
    display: inline-flex;
    align-items: center;
}

.selected-item {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    color: #333;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 2px;
}

.selected-item .remove-btn {
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.selected-item .remove-btn:hover {
    opacity: 0.7;
}

.selected-item .remove-btn path {
    stroke: #666;
    transition: stroke 0.2s ease;
}

.selected-item:hover .remove-btn path {
    stroke: #333;
}
}

.selected-item:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.selected-item .remove-btn {
    cursor: pointer;
    margin-left: 8px;
    width: 16px;
    height: 16px;
    stroke-width: 2;
    transition: stroke 0.3s ease;
}

.selected-item .remove-btn:hover {
    stroke: #005bac;
}

/* Filter tags (old style for compatibility) */
.filter-tag {
    background: #005bac;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    margin: 2px;
    display: inline-block;
}

.filter-tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    margin-left: 5px;
}

.filter-tag button:hover {
    opacity: 0.8;
}



.woocommerce ul.products {
    position: relative;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .custom-product-filters {
        padding: 15px;
        margin: 15px 0;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filter-item {
        width: 100%;
    }
    
    .filter-item label {
        font-size: 13px;
    }
    
    .filter-item select {
        padding: 12px;
        font-size: 16px; /* Tránh zoom trên iOS */
    }
    
    .active-filters {
        margin-bottom: 10px;
    }
    
    .filter-tag {
        font-size: 11px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .custom-product-filters {
        padding: 10px;
        margin: 10px 0;
    }
    
    .filter-row {
        gap: 12px;
    }
    
    .active-filters {
        gap: 6px;
    }
}
