/* Products section inherits background from main.css */

.products-filter {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 25px;
}

.search-container, .select-container {
    position: relative;
}

#brand-search, #category-filter {
    padding: 12px 45px 12px 20px;
    border: 1px solid var(--border-color-medium);
    border-radius: 25px;
    font-size: 16px;
    background-color: var(--card-bg-lighter);
    color: var(--text-light);
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-height: 48px;
}
#brand-search::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#brand-search {
    width: 280px;
}

#category-filter {
    width: 220px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#category-filter option {
    background-color: var(--secondary-bg);
    color: var(--text-light);
}


#brand-search:focus-visible, #category-filter:focus-visible {
    /* Focus handled by global style in main.css */
    border-color: var(--accent-gold);
    background-color: rgba(0, 0, 0, 0.5);
}

.search-icon, .select-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-gold);
    pointer-events: none;
    font-size: 16px;
}
.select-icon {
     font-size: 14px;
}


.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
    min-height: 150px;
}

.brand-item {
    /* REVERTED to light background for better logo visibility */
    background-color: #f0f0f0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    /* Adjusted shadow for light background */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd; /* Light border for light bg */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 180px;
    position: relative;
    overflow: hidden;
}

.brand-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    /* Use dark text on light background */
    color: var(--text-dark);
    text-decoration: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px;
}
.brand-item a:hover, .brand-item a:focus {
     color: #000000; /* Black text on hover/focus */
     text-decoration: none;
     outline: none;
}

.brand-item:hover, .brand-item:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15); /* Enhanced shadow */
    background-color: #ffffff; /* White background on hover */
    border-color: #ccc;
}
.brand-item:focus-within {
     outline: 2px solid var(--focus-outline-color);
     outline-offset: 1px;
     box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}


.brand-item img {
    width: 100%;
    max-width: 110px;
    height: 70px;
    object-fit: contain;
    margin: 0 auto 15px auto;
    /* Remove filters intended for dark background */
    filter: none;
    transition: transform 0.3s ease; /* Only transition transform */
}
.brand-item:hover img, .brand-item:focus-within img {
    /* Keep subtle scale effect */
    transform: scale(1.05);
}

.brand-item p {
    font-size: 14px;
    /* Use dark text on light background */
    color: var(--text-dark);
    font-weight: 500;
    margin-top: auto;
    line-height: 1.4;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Styling for placeholder/error states */
.brand-item.is-placeholder img,
.brand-item.has-image-error img {
    opacity: 0.3; /* Dim the placeholder/broken image */
    filter: grayscale(80%);
}
.brand-item.is-placeholder::after,
.brand-item.has-image-error::after {
     content: "Image Unavailable";
     position: absolute;
     bottom: 40%; /* Position near center */
     left: 0;
     right: 0;
     font-size: 10px;
     color: #888;
     text-align: center;
}
.brand-item.has-image-error::after {
    content: "Load Error";
    color: #b55; /* Reddish tint for error */
}


/* Pagination Styles - Remain unchanged, already suitable for dark theme */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    gap: 15px;
}

.page-btn {
    background-color: var(--card-bg-lighter);
    color: var(--accent-gold);
    border: 1px solid var(--border-color-medium);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, transform 0.2s, border-color 0.3s;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    min-width: 110px;
}

.page-btn:hover:not(:disabled) {
    background-color: var(--accent-gold);
    color: #ffffff;
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}
.page-btn:focus-visible:not(:disabled) {
     background-color: var(--accent-gold);
     color: #ffffff;
     border-color: var(--accent-gold);
}
.page-btn:active:not(:disabled) {
    transform: translateY(0);
}

.page-btn:disabled {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    transform: none;
}

.page-btn i {
    font-size: 14px;
}
.page-btn i.fa-chevron-left { margin-right: 8px; }
.page-btn i.fa-chevron-right { margin-left: 8px; }


#page-info {
    font-size: 16px;
    color: var(--text-medium);
    background-color: transparent;
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 500;
    min-width: 120px;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 15px;
    }
     .brand-item {
         padding: 15px;
         height: 160px;
     }
     .brand-item img {
         height: 60px;
         margin-bottom: 10px;
     }
     .brand-item p {
         font-size: 13px;
     }
     .pagination {
        gap: 10px;
     }
     .page-btn {
         padding: 8px 15px;
         font-size: 14px;
         min-width: 90px;
     }
     #page-info {
         padding: 6px 12px;
         font-size: 14px;
         min-width: 100px;
     }
}