/**
 * Category Filters - Horizontal Dropdown Style
 * Theo mẫu số 2 và số 3
 */

/* ========================================
   Main Container
   ======================================== */
.category-filters-horizontal {
    position: relative;
    width: 100%;
}

.category-filters-horizontal form {
    margin-bottom: 0;
}

/* ========================================
   Filters Bar
   ======================================== */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.filters-left {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    flex-wrap: wrap;
}

.filters-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ========================================
   Filter Dropdown Buttons
   ======================================== */
.filter-dropdown {
    position: relative;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #ffffff;
    border: 2px solid #e8eaed;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    color: #344054;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    border-color: #1b74e4;
    color: #1b74e4;
}

.filter-btn svg:not(.chevron) {
    width: 16px;
    height: 16px;
    stroke: #667085;
    transition: stroke 0.25s ease;
}

.filter-btn .chevron {
    width: 12px;
    height: 12px;
    stroke: #98a2b3;
    transition: transform 0.3s ease;
}

.filter-btn:hover {
    border-color: #1b74e4;
    background: #f0f4ff;
    color: #1b74e4;
}

.filter-btn:hover svg {
    stroke: #1b74e4;
}

.filter-btn.active {
    border-color: #1b74e4;
    background: #1b74e4;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(27, 116, 228, 0.3);
}

.filter-btn.active svg {
    stroke: #ffffff;
}

.filter-btn.active .chevron {
    transform: rotate(180deg);
}

/* ========================================
   Dropdown Content
   ======================================== */
.filter-dropdown-content {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 520px;
    max-width: 600px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid #e8eaed;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: visible;
    /* Changed from hidden to visible */
}

.filter-dropdown-content.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ========================================
   Dropdown Sections
   ======================================== */
.dropdown-section {
    padding: 20px;
    border-bottom: 1px solid #f0f2f5;
    background: #ffffff;
}

.dropdown-section:last-child {
    border-bottom: none;
}

/* Make sure content is visible */
.filter-dropdown-content.show .dropdown-section {
    display: block;
}

.dropdown-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1f36;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, #1b74e4, #155ab8);
    border-radius: 2px;
}

/* ========================================
   Dropdown Search
   ======================================== */
.dropdown-search {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f2f5;
}

.search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
    background: #fafbfc url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none"><circle cx="7" cy="7" r="5" stroke="%2398a2b3" stroke-width="1.5"/><path d="M10.5 10.5L13 13" stroke="%2398a2b3" stroke-width="1.5" stroke-linecap="round"/></svg>') no-repeat 12px center;
}

.search-input:focus {
    border-color: #1b74e4;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(27, 116, 228, 0.1);
}

/* ========================================
   Filter Options Grid
   ======================================== */
.filter-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.filter-options-grid.vendor-list {
    max-height: 250px;
}

/* Custom scrollbar */
.filter-options-grid::-webkit-scrollbar {
    width: 6px;
}

.filter-options-grid::-webkit-scrollbar-track {
    background: #f8f9fb;
    border-radius: 3px;
}

.filter-options-grid::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 3px;
}

.filter-options-grid::-webkit-scrollbar-thumb:hover {
    background: #98a2b3;
}

/* ========================================
   Filter Options (Checkboxes)
   ======================================== */
.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: #fafbfc;
}

.filter-option:hover {
    background: #f0f4ff;
    border-color: #d6e4ff;
}

.filter-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #d0d5dd;
    border-radius: 5px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background: #ffffff;
    transition: all 0.2s ease;
    position: relative;
}

.filter-option input[type="checkbox"]:hover {
    border-color: #1b74e4;
}

.filter-option input[type="checkbox"]:checked {
    background: #1b74e4;
    border-color: #1b74e4;
}

.filter-option input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.filter-option .option-text {
    font-size: 14px;
    font-weight: 500;
    color: #344054;
    flex: 1;
    line-height: 1.4;
}

.filter-option input[type="checkbox"]:checked~.option-text {
    color: #1b74e4;
    font-weight: 600;
}

/* ========================================
   Filter Badge (Count)
   ======================================== */
.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    position: absolute;
    right: 0;
    top: -7px;
}

.filter-btn.active .filter-badge {
    background: #ffffff;
    color: #1b74e4;
}

/* ========================================
   Clear Filters Button (Xóa lọc)
   ======================================== */
.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #1b74e4;
    border: 2px solid #e8eaed;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    border-color: #1b74e4;
    color: #ffffff;
}

.btn-clear-filters svg {
    width: 16px;
    height: 16px;
    stroke: #ffffff;
    transition: transform 0.2s ease;
}

.btn-clear-filters:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(27, 116, 228, 0.4);
}

.btn-clear-filters:hover svg {
    transform: rotate(90deg);
}

.btn-clear-filters:active {
    transform: translateY(0);
}

/* Total Filters Badge */
.total-filters-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 11px;
    margin-left: 4px;
}

/* ========================================
   Search Box (Right Side)
   ======================================== */
.filter-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-search-input {
    width: 300px;
    padding: 10px 48px 10px 16px;
    border: 2px solid #e8eaed;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
}

.filter-search-input:focus {
    border-color: #1b74e4;
    box-shadow: 0 0 0 4px rgba(27, 116, 228, 0.1);
}

.btn-search {
    position: absolute;
    right: 4px;
    padding: 8px;
    background: #1b74e4;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.btn-search svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
}

.btn-search:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(27, 116, 228, 0.4);
}

/* ========================================
   Overlay
   ======================================== */
.filters-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.filters-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .filter-search-input {
        width: 250px;
    }

    .filter-dropdown-content {
        min-width: 450px;
    }
}

@media (max-width: 768px) {
    .filters-bar {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .filters-left,
    .filters-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 1;
        min-width: calc(50% - 6px);
        justify-content: center;
    }

    .btn-clear-filters {
        width: 100%;
        justify-content: center;
    }

    .filter-search-box {
        width: 100%;
    }

    .filter-search-input {
        width: 100%;
    }

    .filter-dropdown-content {
        left: 0;
        right: 0;
        min-width: 100%;
        max-width: 100%;
    }

    .filter-options-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .filters-bar {
        padding: 12px;
    }

    .filter-btn {
        min-width: 100%;
        font-size: 13px;
        padding: 8px 14px;
    }

    .dropdown-section {
        padding: 16px;
    }

    .dropdown-title {
        font-size: 13px;
    }

    .filter-option {
        padding: 6px 10px;
    }

    .filter-option .option-text {
        font-size: 13px;
    }
}

/* ========================================
   Animation
   ======================================== */
@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-dropdown-content.show {
    animation: dropdownSlideIn 0.3s ease forwards;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .category-filters-horizontal {
        display: none;
    }
}