/* Make the main content container full-width on this page only */
body.page-browse #wrapper #main .content {
    max-width: none !important;
}
.browse-container {
    display: flex;
    gap: 10px;
    padding: 0 20px;
    margin: 20px auto;
    max-width: 100%; /* Allow container to expand */
    font-family: Arial, sans-serif;
}

.filter-sidebar {
    width: 210px;
    flex-shrink: 0;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.products-main-content {
    flex-grow: 1;
}

.filters-grid {
    display: grid;
    grid-template-columns: 1fr; /* Make filters stack vertically */
    gap: 20px;
    align-items: end;
}

.filter-toggle-btn-wrapper {
    display: none; /* Hidden by default */
}

.mobile-filter-header {
    display: none; /* Hide by default */
}

.filter-toggle-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.filter-count-badge {
    background-color: #fff;
    color: #007bff;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
}

.filters-section {
    /* This is now just a wrapper, remove old styling */
    padding: 0;
    border: none;
    box-shadow: none;
}

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

.filter-group label {
    font-weight: 600;
    margin-bottom: 4px;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group input,
.filter-group select {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px; /* Reverted to 14px for desktop */
    background-color: #fff;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.filter-group select {
    cursor: pointer;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.dropdown-container {
    position: relative;
}

.dropdown-list {
    display: none;
    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;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

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

.clear-filters-btn {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ced4da;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition:
        background-color 0.2s,
        border-color 0.2s;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.clear-filters-btn:hover {
    background-color: #e2e6ea;
}

/* Small screen adjustments - MOVED HERE to ensure they override base styles */
@media (max-width: 992px) {
    .browse-container {
        flex-direction: column;
    }
    .filter-sidebar {
        display: none; /* Hide sidebar by default */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1002;
        overflow-y: auto;
        border-radius: 0;
        box-shadow: none;
    }
    .filter-sidebar.open {
        display: block; /* Show when open */
    }
    .filter-group input,
    .filter-group select {
        font-size: 16px; /* Increase font size on mobile only to prevent zoom */
    }
    .mobile-filter-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 15px;
        border-bottom: 1px solid #eee;
        margin-bottom: 15px;
    }
    .mobile-filter-header h3 {
        margin: 0;
        font-size: 18px;
    }
    .close-filters-btn {
        font-size: 24px;
        font-weight: bold;
        background: none;
        border: none;
        cursor: pointer;
    }
    .filter-toggle-btn-wrapper {
        display: block; /* Show the button wrapper */
        margin-bottom: 20px;
    }
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 30px;
}

.product-card {
    background: white;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.product-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: transparent;
}

.product-image {
    width: 100%; /* Responsive width */
    height: auto;
    aspect-ratio: 1 / 1; /* Maintain square shape */
    background-size: contain; /* Show full product */
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 4px; /* Image radius */
    margin-bottom: 12px;
    display: block;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.product-card:hover .product-image {
    transform: scale(1.02);
}

.product-image-placeholder {
    width: 200px;
    height: 200px;
    background-color: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
}

.product-info {
    margin-top: auto;
    padding-top: 8px;
}

.design-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
    line-height: 1.3;
    height: 36.4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-type {
    font-size: 12px;
    color: #777;
}

.loader {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #555;
}

#load-more-btn {
    display: block;
    width: 200px;
    margin: 20px auto;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#load-more-btn:hover {
    background-color: #218838;
}

#category-filter-list label.selected {
    font-weight: bold;
}

.clear-filter-link {
    font-size: 12px;
    margin-bottom: 5px;
    font-weight: normal;
}
.clear-filter-link a {
    color: #007bff;
    text-decoration: none;
}

#category-filter-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#category-filter-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
    font-size: 14px;
    text-transform: none;
    letter-spacing: 0;
}

#category-filter-list input[type='checkbox'] {
    margin: 0;
    width: 16px;
    height: 16px;
}

#product-type-filter-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#product-type-filter-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
    font-size: 14px;
    text-transform: none;
    letter-spacing: 0;
}

#product-type-filter-list input[type='checkbox'] {
    margin: 0;
    width: 16px;
    height: 16px;
}

#product-type-filter-list label.selected {
    font-weight: bold;
}

#theme-selection-display .theme-breadcrumb,
#child-themes-list .child-theme-link {
    font-size: 14px;
    margin-bottom: 5px;
}

#theme-selection-display .theme-breadcrumb a,
#child-themes-list .child-theme-link {
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
}

#theme-selection-display .theme-breadcrumb .clear-theme-btn {
    color: #dc3545;
    font-weight: bold;
    margin-left: 8px;
    cursor: pointer;
}

/* Wide screen adjustments */
@media (min-width: 993px) {
    .filter-sidebar {
        position: sticky;
        top: 20px;
        align-self: flex-start; /* Aligns the sticky element to the top of the container */
    }
}
