.ms-collections-header {
    text-align: center;
    padding: 20px 20px 40px; /* Reduced top padding */
}

.ms-collections-header h1 {
    font-size: var(--h1);
    font-weight: 400;
    margin: 0;
    text-transform: uppercase;
    font-family: var(--font-family, sans-serif);
    color: var(--text-dark);
}

.ms-collections-container {
    max-width: 1250px; /* Reduced width */
    margin: 0 auto;
    padding: 0 20px 60px;
    display: flex;
    gap: 40px;
    align-items: flex-start;
    font-family: var(--font-family, sans-serif);
}

/* Sidebar */
.ms-collections-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--white);
}

.ms-collections-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--fs-14);
    font-weight: 500;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-default);
}

.ms-collections-sidebar .widget {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-default);
    padding-bottom: 20px;
}

.ms-collections-sidebar .widget-title {
    font-size: var(--fs-14);
    font-weight: 600;
    margin-bottom: 15px;
}

/* Hardcoded Filter UI */
.ms-sidebar-filters {
    margin-bottom: 30px;
}

.ms-filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-light);
}

.ms-filter-label {
    font-size: var(--fs-14);
    font-weight: 600;
    color: var(--text-dark);
}

/* Toggle Switch */
.ms-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.ms-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ms-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-placeholder);
    transition: .4s;
}

.ms-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: var(--white);
    transition: .4s;
}

input:checked + .ms-slider {
    background-color: var(--accent-toggle);
}

input:checked + .ms-slider:before {
    transform: translateX(20px);
}

.ms-slider.round {
    border-radius: 20px;
}

.ms-slider.round:before {
    border-radius: 50%;
}

.ms-filter-caret {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--bg-gray-200);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
}

.ms-collections-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ms-collections-sidebar ul li {
    margin-bottom: 10px;
}

.ms-collections-sidebar ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--fs-14);
    transition: color 0.3s;
}

.ms-collections-sidebar ul li a:hover {
    color: var(--text-dark);
}

/* Main Content */
.ms-collections-main {
    flex: 1;
    min-width: 0;
}

.ms-collections-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 30px;
    font-size: var(--fs-13);
}

.ms-collections-toolbar .woocommerce-result-count {
    display: none; /* Hidden based on screenshot, only 'Sort by' is visible */
}

.ms-collections-toolbar .woocommerce-ordering {
    display: flex;
    align-items: center;
    margin: 0;
}

.ms-collections-toolbar .woocommerce-ordering::before {
    content: "Sort by:";
    font-weight: 600;
    margin-right: 10px;
}

.ms-collections-toolbar select.orderby {
    display: none !important; /* Managed by JS now */
}

/* Custom Dropdown Styles */
.ms-custom-select-wrapper {
    position: relative;
    user-select: none;
    display: flex;
    align-items: center;
}

.ms-custom-select-trigger {
    display: flex;
    align-items: center;
    font-size: var(--fs-14);
    color: var(--text-gray-500);
    cursor: pointer;
}

.ms-custom-select-trigger span:first-child {
    border-bottom: 1px solid var(--text-gray-500);
    margin-right: 10px;
}

.ms-custom-select-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--text-placeholder);
    border-radius: 50%;
    color: var(--white);
    transition: transform 0.3s;
}

.ms-custom-select-wrapper.open .ms-custom-select-icon {
    transform: rotate(180deg);
}

.ms-custom-select-options {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--white);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--overlay-medium);
    list-style: none;
    padding: 10px 0;
    margin-bottom: 0;
    width: 200px;
    z-index: 100;
    display: none;
}

.ms-custom-select-wrapper.open .ms-custom-select-options {
    display: block;
}

.ms-custom-select-options li {
    padding: 8px 20px;
    font-size: var(--fs-14);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.ms-custom-select-options li:hover {
    background: var(--bg-lighter);
    color: var(--text-dark);
}

.ms-custom-select-options li.selected {
    font-weight: 600;
    color: var(--text-dark);
}

/* Pagination (overridden via loop/pagination.php) */
.ms-pagination {
    display: flex;
    justify-content: center;
    margin-top: 50px;
}

.ms-pagination-inner {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border-strong);
    border-radius: 50px;
    padding: 8px 20px;
    font-size: var(--fs-14);
    color: var(--text-gray-500);
    font-weight: 500;
}

.ms-pagination-link {
    color: var(--text-gray-500);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ms-pagination-link.disabled {
    color: var(--text-placeholder);
    pointer-events: none;
}

.ms-pagination-text {
    margin: 0 10px;
}

.ms-pagination-current {
    color: var(--accent-blue);
}

/* ============================================================
   DYNAMIC FILTER UI  (price slider + attribute checkboxes)
   ============================================================ */

/* Accordion-style filter sections */
.ms-filter-accordion {
    cursor: pointer;
    user-select: none;
}

.ms-filter-content {
    padding: 0 0 12px 0;
    display: none;
}

.ms-filter-content-open {
    display: block;
}

/* Price Range Slider */
.ms-price-range-wrap {
    padding: 12px 0 4px;
}

.ms-price-slider {
    position: relative;
    height: 32px;
    margin-bottom: 6px;
}

.ms-slider-track-bg {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    height: 4px;
    background: var(--border-medium);
    border-radius: 2px;
}

.ms-slider-fill {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
}

.ms-range-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.ms-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--white);
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    transition: box-shadow 0.15s;
}

.ms-range-input::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 4px rgba(229, 57, 53, 0.15);
}

.ms-range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--white);
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
}

.ms-range-input:focus {
    outline: none;
}

.ms-price-values {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--fs-13);
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-family);
}

/* Attribute checkboxes */
.ms-attr-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.ms-attr-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: var(--fs-13);
    font-family: var(--font-family);
    color: var(--text-secondary);
    line-height: 1.3;
}

.ms-attr-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.ms-cb-mark {
    width: 16px;
    min-width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-medium);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.ms-attr-checkbox input:checked + .ms-cb-mark {
    background: var(--primary);
    border-color: var(--primary);
}

.ms-attr-checkbox input:checked + .ms-cb-mark::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -1px;
}

.ms-attr-name {
    flex: 1;
}

.ms-attr-count {
    color: var(--text-placeholder);
    font-size: var(--fs-11);
}

/* Apply button */
.ms-filter-apply {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50px;
    font-family: var(--font-family);
    font-size: var(--fs-14);
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ms-filter-apply:hover {
    opacity: 0.85;
}

/* Responsive */
@media (max-width: 900px) {
    .ms-collections-container {
        flex-direction: column;
    }
    
    .ms-collections-sidebar {
        width: 100%;
    }
    
    .ms-collections-toolbar {
        justify-content: space-between;
    }
}
