/* ========== CSS VARIABLES AND MODERN FOUNDATION ========== */
:root {
    /* Modern color system */
    --search-primary: #0057A3;
    --search-primary-hover: #004187;
    --search-secondary: #4A7C23;
    --search-accent: #D9534F;
    --search-success: #28a745;
    --search-warning: #ffc107;
    --search-light: #f8f9fa;
    --search-gray-100: #f1f3f4;
    --search-gray-200: #e9ecef;
    --search-gray-300: #dee2e6;
    --search-gray-400: #ced4da;
    --search-gray-600: #6c757d;
    --search-gray-800: #343a40;
    --search-white: #ffffff;
    --search-black: #000000;

    /* Design tokens */
    --search-border-radius: 8px;
    --search-transition: all 0.2s ease;
    --search-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --search-shadow-focus: 0 0 0 3px rgba(0, 87, 163, 0.25);

    /* Typography scale */
    --search-font-size-sm: 0.875rem;
    --search-font-size-base: 1rem;
    --search-font-size-lg: 1.125rem;

    /* Spacing scale */
    --search-spacing-xs: 0.25rem;
    --search-spacing-sm: 0.5rem;
    --search-spacing-md: 1rem;
    --search-spacing-lg: 1.5rem;
    --search-spacing-xl: 2rem;
}

/* ========== RESET AND BASE STYLES ========== */
body, h1, h2, h3, h4, h5, h6, p, a, div, span, input, select, button {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #fff;
    color: #333;
    line-height: 1.6;
}

/* ========== MOBILE OVERFLOW RESET ========== */
@media (max-width: 767px) {
    /* Force reset all overflow on mobile to prevent sticky behavior */
    html, body, main, header, .site-header, .header-inner {
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
}

/* ========== FOOTER STYLES ========== */
.site-footer {
    background-color: var(--search-gray-800);
    color: var(--search-white);
    padding: var(--search-spacing-lg) 0;
    margin-top: var(--search-spacing-xl);
    border-top: 1px solid var(--search-gray-600);
}

.footer-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 var(--search-spacing-md);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.footer-section {
    flex: 1;
    min-width: 250px;
    margin-bottom: var(--search-spacing-lg);
    padding: 0 var(--search-spacing-md);
}

.footer-section:last-child {
    text-align: right;
}

.footer-section h3 {
    color: var(--search-white);
    margin-bottom: var(--search-spacing-md);
    font-size: 1.3rem;
    border-bottom: 2px solid var(--search-primary);
    padding-bottom: var(--search-spacing-xs);
    display: inline-block;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.footer-section h4 {
    color: var(--search-white);
    margin-bottom: var(--search-spacing-sm);
    font-size: 1.1rem;
}

.footer-section p {
    margin-bottom: var(--search-spacing-md);
    line-height: 1.6;
    color: var(--search-gray-300);
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: var(--search-spacing-sm);
}

.footer-section ul li a {
    color: var(--search-gray-300);
    text-decoration: none;
    transition: var(--search-transition);
    display: inline-block;
    position: relative;
}

.footer-section ul li a:hover {
    color: var(--search-white);
    text-decoration: none;
}

.footer-section ul li a:after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: var(--search-primary);
    transition: var(--search-transition);
}

.footer-section ul li a:hover:after {
    width: 100%;
}

@media (max-width: 767px) {
    .footer-content {
        flex-direction: column;
    }

    .footer-section {
        margin-bottom: var(--search-spacing-md);
    }

    .footer-section:last-child {
        text-align: left;
    }
}

/* ========== HEADER STYLES ========== */
.site-header {
    background: #0057A3;
    color: #fff;
    border-bottom: none;
}

.header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem 1rem 1rem;
    text-align: center;
}

.header-inner.horizontal-layout {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 2rem 1rem 1rem 1rem;
    text-align: left;
    flex-wrap: wrap;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    width: 100px;
    height: 100px;
    border: 2px solid #6C7A89;
}

.logo {
    max-width: 100px;
    height: auto;
}

.site-text {
    text-align: left;
}

.site-title {
    font-size: 2.5rem;
    margin: 0;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(61, 40, 23, 0.7);
}

.site-tagline {
    font-size: 1.2rem;
    color: #A1AAB3;
    margin-top: 0.5rem;
}

/* ========== MODERN SEARCH BAR STYLES (2025) ========== */

/* Search bar wrapper with mobile-first sticky behavior */
.search-bar-wrapper {
    background: var(--search-white);
    border-bottom: 1px solid var(--search-gray-200);
    position: static; /* Mobile-first: static positioning */
    width: 100%;
    z-index: 10;
    box-shadow: var(--search-shadow);
}


/* === FIXED ALIGNMENT & HEIGHTS FOR SEARCH BAR ELEMENTS === */

.search-input,
.search-select,
.search-checkbox,
.btn-reset,
#sale-checkbox {
    height: 44px;
    box-sizing: border-box;
}

.search-select {
    padding: 0 12px;
    line-height: 1.2;
}

/* Align select boxes and buttons */
.search-items-per-page select,
.search-category select,
.btn-reset {
    height: 44px;
    padding: 0 12px;
    font-size: 1rem;
}

/* Reset button alignment fix */
.btn-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 90px;
}

/* On Sale Only checkbox alignment */
.search-checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Adjust checkbox size */
.search-checkbox + .checkbox-indicator {
    width: 20px;
    height: 20px;
}




/* Enable sticky behavior on larger screens */
@media (min-width: 768px) {
    .search-bar-wrapper {
        position: sticky;
        top: 0;
        z-index: 1000;
    }
}

/* Main search form */
.search-form {
    max-width: none;
    margin: 0;
    padding: var(--search-spacing-md);
    background: var(--search-white);
    transition: var(--search-transition);
}

.search-form.sale-active {
    border-left: 4px solid var(--search-accent);
    background: linear-gradient(to right, #fff5f5, var(--search-white));
}

/* Mobile-first grid system for search controls */
/* Mobile-first grid system for search controls */
.search-controls-grid {
    display: grid;
    gap: var(--search-spacing-md);
    grid-template-columns: 1fr;
    margin-bottom: var(--search-spacing-lg);
}

/* Mobile layout order */
.search-primary {
    order: 1;
}

.search-category {
    order: 2;
}

.search-items-per-page {
    order: 3;
}

.search-checkbox-group {
    order: 4;
    justify-self: start;
}

.search-reset-group {
    order: 5;
    justify-self: start;
}

/* Buttons group styling */
.search-buttons-group {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    order: 6; /* Position at the bottom on mobile */
}

.buttons-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

/* Mobile: Center buttons */
@media (max-width: 767px) {
    /* Create a container for the search controls */
    .search-controls-grid {
        display: grid;
        grid-template-columns: 1fr;
    }

    /* Center the buttons group */
    .search-field-group.search-buttons-group {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        margin-top: 10px;
    }

    /* Make buttons slightly more compact on mobile */
    .btn-sale, .btn-reset {
        padding: 6px 12px !important;
        font-size: 14px !important;
    }
}

/* Desktop: Single row layout */
@media (min-width: 768px) {
    .search-controls-grid {
        grid-template-columns: 2fr auto auto auto auto;
        align-items: end;
        gap: var(--search-spacing-lg);
    }

    /* Reset order for desktop */
    .search-primary,
    .search-category,
    .search-items-per-page,
    .search-checkbox-group,
    .search-reset-group {
        order: 0;
    }

    /* Align checkbox and reset button to bottom */
    .search-checkbox-group,
    .search-reset-group {
        align-self: end;
        padding-bottom: 2px;
    }
}

@media (min-width: 1024px) {
    .search-form {
        padding: var(--search-spacing-lg) var(--search-spacing-xl);
    }

    .search-controls-grid {
        gap: var(--search-spacing-xl);
    }
}

/* Field group styling */
.search-field-group {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent overflow */
}

/* Label styling with modern typography */
.search-label {
    display: flex;
    flex-direction: column;
    gap: var(--search-spacing-xs);
    font-weight: 500;
    color: var(--search-gray-800);
    cursor: pointer;
}

.label-text {
    font-size: var(--search-font-size-sm);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.025em;
    color: var(--search-gray-600);
    margin-bottom: var(--search-spacing-xs);
}

/* Enhanced input styling */
.search-input,
.search-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--search-gray-300);
    border-radius: var(--search-border-radius);
    font-size: var(--search-font-size-base);
    line-height: 1.5;
    background: var(--search-white);
    transition: var(--search-transition);
    box-sizing: border-box;
}

.search-input:focus,
.search-select:focus {
    outline: none;
    border-color: var(--search-primary);
    box-shadow: var(--search-shadow-focus);
}

.search-input:hover,
.search-select:hover {
    border-color: var(--search-gray-600);
}

/* Search input wrapper for icon integration */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-submit-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--search-primary);
    color: var(--search-white);
    border: none;
    border-radius: calc(var(--search-border-radius) - 2px);
    padding: 8px;
    cursor: pointer;
    transition: var(--search-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-submit-btn:hover {
    background: var(--search-primary-hover);
}

.search-submit-btn svg {
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Enhanced checkbox styling */
.search-checkbox-group {
    /* Remove align-self here - will be set in grid section */
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--search-spacing-sm);
    cursor: pointer;
    padding: 12px 0;
}

.search-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-indicator {
    position: relative;
    width: 20px;
    height: 20px;
    border: 2px solid var(--search-gray-300);
    border-radius: 4px;
    background: var(--search-white);
    transition: var(--search-transition);
    flex-shrink: 0;
}

.search-checkbox:checked + .checkbox-indicator {
    background: var(--search-primary);
    border-color: var(--search-primary);
}

.search-checkbox:checked + .checkbox-indicator::after {
    content: 'X';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--search-black);
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-checkbox:focus + .checkbox-indicator {
    box-shadow: var(--search-shadow-focus);
}

/* Field help text */
.field-help {
    font-size: 0.75rem;
    color: var(--search-gray-600);
    margin-top: var(--search-spacing-xs);
    line-height: 1.4;
}

/* Action buttons */
.search-actions {
    display: flex;
    gap: var(--search-spacing-md);
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--search-spacing-xs);
    padding: 12px 24px;
    border-radius: var(--search-border-radius);
    font-size: var(--search-font-size-base);
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--search-transition);
    min-height: 44px; /* Touch target size */
    box-sizing: border-box;
}

.btn-primary {
    background: var(--search-primary);
    color: var(--search-white);
}

.btn-primary:hover {
    background: var(--search-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 87, 163, 0.25);
}

.btn-secondary {
    background: var(--search-gray-100);
    color: var(--search-gray-800);
    border-color: var(--search-gray-300);
}

.btn-secondary:hover {
    background: var(--search-gray-200);
    color: var(--search-gray-800);
    text-decoration: none;
}

.btn svg {
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

/* Mobile: Full-width buttons */
@media (max-width: 575px) {
    .search-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Results summary styling */
.results-summary {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--search-spacing-md);
    background: transparent; /* Remove background */
    border: none; /* Remove all borders */
    border-top: none; /* Remove top border */
}

/* Make results count more compact - single line layout */
.results-count {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem;
    line-height: 1;
}

.results-count .count-range,
.results-count .count-total {
    white-space: nowrap;
}

.results-count .page-info {
    white-space: nowrap;
    font-size: 0.9em;
    color: #6c757d;
}

/* Ensure the "of" text doesn't create line breaks */
.results-count {
    font-size: 0.95rem;
}

/* On very small screens, allow controlled wrapping */
@media (max-width: 480px) {
    .results-count {
        flex-direction: row;
        justify-content: flex-start;
    }

    .results-count .page-info {
        flex-basis: 100%;
        margin-top: 0.125rem;
    }
}

/* No results state */
.no-results-container {
    text-align: center;
    padding: var(--search-spacing-xl);
    background: var(--search-white);
    border-radius: var(--search-border-radius);
    border: 1px solid var(--search-gray-200);
}

.no-results-icon {
    display: flex;
    justify-content: center;
    margin-bottom: var(--search-spacing-lg);
    color: var(--search-gray-600);
}

.no-results-icon svg {
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}

.no-results-title {
    font-size: var(--search-font-size-lg);
    font-weight: 600;
    color: var(--search-gray-800);
    margin: 0 0 var(--search-spacing-md) 0;
}

.no-results-message {
    font-size: var(--search-font-size-base);
    color: var(--search-gray-600);
    margin: 0 0 var(--search-spacing-lg) 0;
    line-height: 1.6;
}

/* Search suggestions */
.search-suggestions {
    background: var(--search-gray-100);
    border-radius: var(--search-border-radius);
    padding: var(--search-spacing-lg);
    text-align: left;
    max-width: 500px;
    margin: 0 auto;
}

.search-suggestions h4 {
    font-size: var(--search-font-size-base);
    font-weight: 600;
    color: var(--search-gray-800);
    margin: 0 0 var(--search-spacing-sm) 0;
}

.suggestions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.suggestions-list li {
    padding: var(--search-spacing-xs) 0;
    font-size: var(--search-font-size-sm);
    color: var(--search-gray-600);
    line-height: 1.5;
}

.suggestion-link {
    color: var(--search-primary);
    text-decoration: none;
    font-weight: 500;
}

.suggestion-link:hover {
    text-decoration: underline;
    color: var(--search-primary-hover);
}

/* Results info */
.results-info {
    background: var(--search-white);
    border-radius: var(--search-border-radius);
    padding: var(--search-spacing-lg);
    border: 1px solid var(--search-gray-200);
}

/* Expanded search notice */
.expanded-search-notice {
    display: flex;
    gap: var(--search-spacing-sm);
    background: #e3f2fd;
    border: 1px solid #1976d2;
    border-radius: var(--search-border-radius);
    padding: var(--search-spacing-md);
    margin-bottom: var(--search-spacing-lg);
    color: #1565c0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notice-icon {
    flex-shrink: 0;
    color: #1976d2;
}

.notice-icon svg {
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.notice-content {
    flex: 1;
    font-size: var(--search-font-size-sm);
    line-height: 1.5;
}

.notice-action {
    display: inline-block;
    margin-top: var(--search-spacing-xs);
    color: #1565c0;
    text-decoration: none;
    font-weight: 600;
    padding: var(--search-spacing-xs) var(--search-spacing-sm);
    background: rgba(25, 118, 210, 0.1);
    border-radius: 4px;
    transition: var(--search-transition);
}

.notice-action:hover {
    background: rgba(25, 118, 210, 0.2);
    text-decoration: none;
}

/* Results count */
.results-count {
    font-size: var(--search-font-size-base);
    font-weight: 500;
    color: var(--search-gray-800);
    margin-bottom: var(--search-spacing-md);
}

.count-range,
.count-total {
    font-weight: 600;
    color: var(--search-primary);
}

.page-info {
    color: var(--search-gray-600);
    font-weight: normal;
}

/* Active filters */
.active-filters {
    border-top: 1px solid var(--search-gray-200);
    padding-top: var(--search-spacing-md);
    margin-top: var(--search-spacing-md);
}

.filters-label {
    font-size: var(--search-font-size-sm);
    font-weight: 600;
    color: var(--search-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: block;
    margin-bottom: var(--search-spacing-sm);
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--search-spacing-sm);
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--search-spacing-xs);
    background: var(--search-primary);
    color: var(--search-white);
    padding: var(--search-spacing-xs) var(--search-spacing-sm);
    border-radius: 20px;
    font-size: var(--search-font-size-sm);
    font-weight: 500;
    text-transform: none;
}

.filter-tag.filter-search {
    background: var(--search-secondary);
}

.filter-tag.filter-category {
    background: var(--search-gray-600);
}

.filter-tag.filter-sale {
    background: var(--search-accent);
}

.filter-remove {
    color: currentColor;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: var(--search-transition);
}

.filter-remove:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* No items general state */
.no-items-general {
    text-align: center;
    padding: var(--search-spacing-xl);
    background: var(--search-white);
    border-radius: var(--search-border-radius);
    border: 1px solid var(--search-gray-200);
    color: var(--search-gray-600);
}

/* Enhanced input states */
.search-input.has-content {
    border-color: var(--search-primary);
    background: #fafbff;
}

.search-input:invalid {
    border-color: var(--search-accent);
}

.search-input:invalid:focus {
    box-shadow: 0 0 0 3px rgba(217, 83, 79, 0.25);
}

/* Loading states for progressive enhancement */
.search-form.submitting {
    opacity: 0.8;
    pointer-events: none;
}

.search-form.submitting .btn-primary {
    background: var(--search-gray-400);
}

/* ========== MAIN LAYOUT ========== */
main {
    display: flex;
    justify-content: center;
    width: 100%;
    background: white;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.item-grid-container {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
    width: 100%;
}


/* === REMOVED PREVIOUS ITEM GRID FIX === */

.item-grid-container {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
}

.item-grid {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* key fix */
    gap: 2rem;
    padding: 2rem 0;
}




/* ========== ITEM GRID STYLES ========== */
.item-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 2rem 0;
    margin: 0;
    width: 100%;
    justify-content: flex-start;
}

.item-card {
	position: relative; 
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 16px rgba(61, 40, 23, 0.12);
    border: 1px solid rgba(212, 135, 107, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 500px;
    width: 320px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.item-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(61, 40, 23, 0.2);
    border-color: #0057A3;
}

.item-card img {
    display: block;
    margin: 0 auto 1rem;
    max-height: 300px;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 8px;
}

.item-card h2 {
    font-size: 1.1rem;
    color: #011627;
    margin-bottom: 0.5rem;
    text-align: center;
    line-height: 1.3;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-card p {
    font-size: 1.2rem;
    font-weight: bold;
    color: #4A7C23;
    margin: 0.5rem 0;
    flex-shrink: 0;
}

.sale-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #D9534F;
    color: white;
    padding: 6px 10px;
    font-weight: bold;
    font-size: 0.9rem;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 2;
}

.original-price {
    color: #888;
    text-decoration: line-through;
    font-size: 1rem;
    margin: 0;
}

.sale-price {
    color: #4A7C23;
    font-size: 1.3rem;
    font-weight: bold;
    margin: 0.25rem 0;
}

/* ========== ITEM CARD BUTTON STYLES ========== */
.item-card a.button {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.25rem 0;
    padding: 0.6em 1em;
    text-decoration: none;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s ease;
    flex-shrink: 0;
    color: white;
    border: none;
}

.item-card a.button:hover {
    text-decoration: none;
    transform: translateY(-2px);
}

.item-card a.button.view-details {
    background: #5C4A2A;
    color: white;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6em 1em;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
}

.item-card a.button.view-details:hover {
    background: #011627;
    box-shadow: 0 4px 12px rgba(61, 40, 23, 0.3);
}

.item-card a.button.purchase {
    background: #0074D9;
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center;
    white-space: normal;
    line-height: 1.1;
    height: 56px;
    padding: 0 24px;
    font-size: 16px;
}

.item-card a.button.purchase:hover {
    background: #0057A3;
    color: white;
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.4);
}

.item-card .sold-button {
    background: #002B5C;
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
    height: 56px;
    padding: 0 24px;
    font-size: 16px;
    font-family: inherit;
    width: 100%;
    margin: 0.25rem 0;
}

.item-card .sold-button:hover {
    background: #002B5C;
    transform: none;
    text-decoration: none;
}

/* ========== PAGINATION STYLES ========== */
.pagination-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    margin: 0 0.25rem;
    padding: 0 0.75rem;
    border-radius: 4px;
    background: #A1AAB3;
    text-decoration: none;
    color: #011627;
    font-weight: bold;
    transition: all 0.3s;
    border: 1px solid #6C7A89;
}

.pagination a.active {
    background: #0057A3;
    border: 2px solid #011627;
    color: #fff !important;
    border-radius: 12px;
}

.pagination a:hover {
    background: #6C7A89;
    color: white;
    transform: translateY(-1px);
}

.pagination .disabled {
    pointer-events: none;
    opacity: 0.5;
}

.pagination .dots {
    color: #777;
    background: transparent;
    border: none;
}

/* ========== BACK TO TOP BUTTON ========== */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: none;
    background: #4A7C23;
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
}

#back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 80, 22, 0.3);
}

/* ========== ITEM DETAIL PAGE STYLES ========== */
.container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 2rem auto;
    max-width: 1200px;
    padding: 1rem;
    box-sizing: border-box;
}

.item-gallery {
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 300px;
    max-width: 650px;
}

.item-description {
    flex: 1 1 40%;
    min-width: 300px;
    max-width: 500px;
}

/* ========== PRICE STYLES ========== */
.price {
    color: #4A7C23;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 1rem 0;
}

.price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    margin: 1rem 0;
}

.original-price {
    color: #888;
    text-decoration: line-through;
    font-size: 1.2rem;
    margin: 0;
    font-weight: normal;
    position: relative;
}

.sale-price {
    color: #4A7C23;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
}

/* Enhanced strikethrough effect for better visibility */
.original-price::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #888;
    transform: translateY(-50%);
}

/* ========== ITEM CARD SALE PRICE STYLES ========== */
.item-card .price-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    margin: 0.5rem 0;
    text-align: center;
}

.item-card .original-price {
    color: #888;
    text-decoration: line-through;
    font-size: 1rem;
    margin: 0;
    font-weight: normal;
}

.item-card .sale-price {
    color: #4A7C23;
    font-size: 1.2rem;
    font-weight: bold;
	margin: 0;
}

/* ========== GALLERY STYLES ========== */
.main-image {
   width: calc(100% - 60px);
   max-width: 540px;
   height: auto;
   border: 1px solid #ddd;
   border-radius: 8px;
   margin-bottom: 1rem;
   cursor: pointer;
   margin-left: auto;
   margin-right: auto;
   position: relative;
}

/* Remove margin from the img element inside main-image div to prevent double spacing */
.main-image img.main-image-img,
.main-image .main-image-img {
   margin-bottom: 0;
   width: 100%;
   height: auto;
   object-fit: contain;
   max-height: 500px;
}

.thumbnail-container {
   display: flex;
   flex-wrap: wrap;
   gap: 0.5rem;
   justify-content: center;
   margin-top: 1rem;
}

.thumbnail {
   width: 80px;
   height: 80px;
   object-fit: cover;
   border: 2px solid transparent;
   border-radius: 4px;
   cursor: pointer;
   transition: all 0.3s ease;
}

.thumbnail:hover,
.thumbnail.active {
   border-color: #0057A3;
   transform: scale(1.05);
}

/* ========== ZOOM MODAL STYLES ========== */
.modal {
   display: none;
   position: fixed;
   z-index: 9999;
   left: 0;
   top: 0;
   width: 100%;
   height: 100%;
   background-color: rgba(0,0,0,0.9);
   animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
   from { opacity: 0; }
   to { opacity: 1; }
}

.modal-content {
   display: flex;
   align-items: center;
   justify-content: center;
   height: 100%;
   padding: 20px;
   box-sizing: border-box;
}

.modal-image {
   max-width: 95%;
   max-height: 95%;
   object-fit: contain;
   border-radius: 8px;
}

.modal .close {
   position: absolute;
   top: 20px;
   right: 35px;
   color: #fff;
   font-size: 40px;
   font-weight: bold;
   cursor: pointer;
   z-index: 10000;
   transition: color 0.3s ease;
}

.modal .close:hover {
   color: #0057A3;
}

/* ========== RESPONSIVE DESIGN ========== */

/* Large screens */
@media (min-width: 1200px) {
    .search-bar-wrapper,
    .item-grid-container,
    .main-container {
        max-width: 1200px;
    }

    .item-grid {
        justify-content: flex-start;
        padding-left: 0;
    }
}

/* Medium screens - tablets */
@media (max-width: 768px) {
   .header-inner {
       flex-direction: column;
       text-align: center;
       gap: 1rem;
   }

   .header-inner.horizontal-layout {
       flex-direction: column;
       text-align: center;
   }

   .site-title {
       font-size: 2rem;
   }

   .site-tagline {
       font-size: 1rem;
   }

   .item-grid {
        gap: 1.5rem;
        padding: 1rem 0;
        justify-content: center;
    }

    .search-bar-wrapper,
    .item-grid-container,
    .main-container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

   .item-card {
       width: 100%;
       max-width: 400px;
       min-height: 450px;
   }

   .container {
       flex-direction: column;
       gap: 1.5rem;
       padding: 1rem;
   }

   .item-gallery,
   .item-description {
       min-width: auto;
       max-width: none;
   }

   .main-image {
       width: calc(100% - 40px);
       max-width: 100%;
       margin-left: auto;
       margin-right: auto;
   }
}

/* Small screens - mobile */
@media (max-width: 480px) {
   .header-inner {
       padding: 1rem;
   }

   .logo-wrapper {
       width: 80px;
       height: 80px;
   }

   .logo {
       max-width: 80px;
   }

   .site-title {
       font-size: 1.5rem;
   }

   .site-tagline {
       font-size: 0.9rem;
   }

   .item-grid {
        gap: 1rem;
        padding: 0.5rem 0;
    }

   .item-card {
       width: 100%;
       min-height: 400px;
       padding: 1rem;
   }

   .item-card img {
       max-height: 250px;
   }

   .item-card h2 {
       font-size: 1rem;
   }

   .container {
       padding: 0.5rem;
       gap: 1rem;
   }

   .thumbnail {
       width: 60px;
       height: 60px;
   }

   .modal .close {
       top: 10px;
       right: 20px;
       font-size: 30px;
   }

   .pagination a {
       padding: 0.4rem 0.6rem;
       font-size: 0.9rem;
   }
}

/* Extra small screens */
@media (max-width: 320px) {
   .item-card {
       min-height: 380px;
       padding: 0.8rem;
   }

   .item-card img {
       max-height: 200px;
   }

   .site-title {
       font-size: 1.3rem;
   }

   .site-tagline {
       font-size: 0.8rem;
   }
}

/* ========== ACCESSIBILITY ENHANCEMENTS ========== */

/* Focus management for keyboard navigation */
.search-form *:focus {
   outline: 2px solid var(--search-primary);
   outline-offset: 2px;
}

.search-form *:focus:not(:focus-visible) {
   outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
   :root {
       --search-border-radius: 4px;
       --search-shadow: 0 0 0 2px currentColor;
       --search-shadow-focus: 0 0 0 4px currentColor;
   }

   .search-input,
   .search-select {
       border-width: 3px;
   }

   .btn {
       border-width: 3px;
   }

   .item-card {
       border-width: 2px;
   }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
   :root {
       --search-transition: none;
   }

   .expanded-search-notice,
   .modal {
       animation: none;
   }

   .btn:hover,
   .item-card:hover,
   .filter-remove:hover {
       transform: none;
   }

   .thumbnail:hover {
       transform: none;
   }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
   :root {
       --search-white: #1a1a1a;
       --search-light: #2d2d2d;
       --search-gray-100: #2d2d2d;
       --search-gray-200: #404040;
       --search-gray-300: #525252;
       --search-gray-600: #a3a3a3;
       --search-gray-800: #e5e5e5;
   }

   body {
       background: #1a1a1a;
       color: #e5e5e5;
   }

   .search-form {
       color: var(--search-gray-800);
   }

   .search-input,
   .search-select {
       background: var(--search-gray-100);
       color: var(--search-gray-800);
   }

   .search-input.has-content {
       background: #262638;
   }

   .item-card {
       background: #2d2d2d;
       color: #e5e5e5;
       border-color: #525252;
   }

   .item-card h2 {
       color: #e5e5e5;
   }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
   .btn,
   .search-input,
   .search-select,
   .checkbox-label {
       min-height: 44px; /* WCAG AA touch target size */
   }

   .search-submit-btn {
       min-width: 44px;
       min-height: 44px;
   }

   /* Increase touch targets */
   .filter-remove {
       min-width: 32px;
       min-height: 32px;
   }

   .thumbnail {
       width: 100px;
       height: 100px;
   }

   .pagination a {
       min-height: 44px;
       min-width: 44px;
       display: flex;
       align-items: center;
       justify-content: center;
   }
}

/* Print styles */
@media print {
   .search-bar-wrapper {
       position: static !important;
       box-shadow: none;
       border: 1px solid #000;
   }

   .search-actions,
   .search-submit-btn,
   #back-to-top,
   .modal {
       display: none;
   }

   .results-summary {
       background: transparent;
       border: none;
   }

   .item-card {
       break-inside: avoid;
       box-shadow: none;
       border: 1px solid #000;
   }

   .item-card:hover {
       transform: none;
       box-shadow: none;
   }
}

/* Internet Explorer 11 fallbacks */
@media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) {
   .search-controls-grid {
       display: -ms-flexbox;
       -ms-flex-direction: column;
   }

   .input-wrapper {
       display: -ms-flexbox;
       -ms-flex-align: center;
   }

   .checkbox-label {
       display: -ms-flexbox;
       -ms-flex-align: center;
   }

   .item-grid {
       display: -ms-flexbox;
       -ms-flex-wrap: wrap;
       -ms-flex-pack: center;
   }
}

/* Very large screens */
@media (min-width: 1400px) {
   .search-form {
       padding: var(--search-spacing-xl) 0;
   }

   .search-controls-grid {
       max-width: 1200px;
       margin: 0 auto;
   }

   .results-summary {
       padding: var(--search-spacing-lg) 0;
   }

   .item-grid {
       max-width: 2000px;
   }
}

/* Mobile landscape optimizations */
@media (max-width: 767px) and (orientation: landscape) {
   .search-form {
       padding: var(--search-spacing-sm);
   }

   .search-controls-grid {
       gap: var(--search-spacing-sm);
   }

   .results-summary {
       padding: var(--search-spacing-sm);
   }

   .item-card {
       min-height: 350px;
   }

   .item-card img {
       max-height: 200px;
   }
}

/* Loading animation for search form */
@keyframes pulse {
   0% { opacity: 1; }
   50% { opacity: 0.5; }
   100% { opacity: 1; }
}

.search-form.loading {
   animation: pulse 1.5s ease-in-out infinite;
}

/* Smooth scrolling for modern browsers */
@supports (scroll-behavior: smooth) {
   html {
       scroll-behavior: smooth;
   }
}

/* CSS Grid fallback for older browsers */
@supports not (display: grid) {
   .search-controls-grid {
       display: flex;
       flex-direction: column;
       gap: 1rem;
   }

   @media (min-width: 576px) {
       .search-controls-grid {
           flex-direction: row;
           flex-wrap: wrap;
       }

       .search-controls-grid > * {
           flex: 1;
           min-width: 200px;
       }

       .search-primary {
           flex: 2;
           width: 100%;
       }
   }
}

/* Enhanced sale badge visibility */
.item-card .sale-badge {
   animation: salePulse 2s ease-in-out infinite;
}

@keyframes salePulse {
   0%, 100% { 
       transform: scale(1);
       box-shadow: 0 2px 6px rgba(0,0,0,0.2);
   }
   50% { 
       transform: scale(1.05);
       box-shadow: 0 4px 12px rgba(217, 83, 79, 0.4);
   }
}

/* Disable animation for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
   .item-card .sale-badge {
       animation: none;
   }
}

/* Enhanced button states for better UX */
.btn:active {
   transform: translateY(0);
}

.item-card a.button:active {
   transform: translateY(0);
}

/* Ensure text remains readable on all backgrounds */
.item-card h2,
.item-card p {
   text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
}

/* Loading state for images */
.item-card img {
   background: linear-gradient(90deg, #f0f0f0 25%, transparent 50%, #f0f0f0 75%);
   background-size: 200% 100%;
   animation: loading 1.5s infinite;
}

.item-card img[src] {
   background: none;
   animation: none;
}

@keyframes loading {
   0% { background-position: 200% 0; }
   100% { background-position: -200% 0; }
}

/* Ensure proper stacking context */
.search-bar-wrapper {
   isolation: isolate;
}

.modal {
   isolation: isolate;
}

/* Final accessibility improvements */
.sr-only {
   position: absolute;
   width: 1px;
   height: 1px;
   padding: 0;
   margin: -1px;
   overflow: hidden;
   clip: rect(0, 0, 0, 0);
   white-space: nowrap;
   border: 0;
}

/* Ensure proper focus indicators */
a:focus,
button:focus,
input:focus,
select:focus {
   outline: 2px solid var(--search-primary);
   outline-offset: 2px;
}

/* Skip link for keyboard users */
.skip-link {
   position: absolute;
   top: -40px;
   left: 6px;
   background: var(--search-primary);
   color: white;
   padding: 8px;
   text-decoration: none;
   border-radius: 4px;
   z-index: 10000;
}

.skip-link:focus {
   top: 6px;
}

/* ========== SEARCH BAR ALIGNMENT FIX ========== */
.search-bar-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (max-width: 768px) {
    .search-bar-wrapper {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* ========== COMPACT SEARCH BAR STYLES ========== */

/* Reduce overall padding and spacing */
.search-form {
    padding: 1rem !important;
}

.search-controls-grid {
    gap: 0.75rem !important;
    margin-bottom: 1rem !important;
}

/* Smaller, more compact inputs */
.search-input,
.search-select {
    padding: 8px 12px !important;
    font-size: 0.875rem !important;
    border-radius: 6px !important;
}

/* Compact labels */
.label-text {
    font-size: 0.75rem !important;
    margin-bottom: 0.25rem !important;
}

/* Smaller action buttons */
.btn {
    padding: 8px 16px !important;
    font-size: 0.875rem !important;
    min-height: 44px !important;
    border-radius: 6px !important;
}

.btn svg {
    width: 16px !important;
    height: 16px !important;
}

/* Compact checkbox */
.checkbox-label {
    padding: 8px 0 !important;
    font-size: 0.875rem !important;
}

.checkbox-indicator {
    width: 16px !important;
    height: 16px !important;
}

/* Force desktop layout */
@media (min-width: 768px) {
    .search-controls-grid {
        grid-template-columns: 2fr auto auto auto auto !important;
        align-items: end !important;
    }

    .search-checkbox-group {
        align-self: end !important;
        justify-self: start !important;
    }

    .search-reset-group {
        align-self: end !important;
        justify-self: start !important;
    }
}

/* Compact results summary */
.results-summary {
    padding: 0.75rem !important;
}

.results-count {
    font-size: 0.875rem !important;
    margin-bottom: 0.75rem !important;
}

/* Smaller filter tags */
.filter-tag {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
}

.filter-remove {
    width: 16px !important;
    height: 16px !important;
    font-size: 0.9em !important;
}

/* Style the search button inside input */
.search-submit-btn {
    position: absolute !important;
    right: 4px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: var(--search-primary) !important;
    color: var(--search-white) !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 8px !important;
    cursor: pointer !important;
    transition: var(--search-transition) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    z-index: 10 !important;
}

.search-submit-btn:hover {
    background: var(--search-primary-hover) !important;
}

.search-submit-btn svg {
    stroke: currentColor !important;
    stroke-width: 2 !important;
    fill: none !important;
}

/* Ensure input wrapper is positioned correctly */
.input-wrapper {
    position: relative !important;
    display: block !important;
    width: 100% !important;
}

/* Add padding to search input to avoid text under button */
.search-primary .search-input,
.input-wrapper .search-input {
    padding-right: 45px !important;
    width: 100% !important;
}

/* Reset button positioning and layout */
.search-reset-group {
    align-self: end;
}

.reset-button-wrapper {
    padding-bottom: 2px;
}

.btn-reset svg {
    width: 14px !important;
    height: 14px !important;
}

/* Large desktop: More spacing */
@media (min-width: 1024px) {
    .search-controls-grid {
        gap: var(--search-spacing-xl);
    }
}

/* ========== FORCE DESKTOP LAYOUT FIX ========== */
@media (min-width: 768px) {
    .search-controls-grid {
        display: grid !important;
        grid-template-columns: 2fr auto auto auto auto !important;
        align-items: end !important;
        gap: var(--search-spacing-lg) !important;
    }

    /* Reset all order values to 0 for desktop */
    .search-primary,
    .search-category, 
    .search-items-per-page,
    .search-checkbox-group,
    .search-reset-group {
        order: 0 !important;
    }

    /* Ensure proper alignment */
    .search-checkbox-group,
    .search-reset-group {
        align-self: end !important;
        justify-self: start !important;
        padding-bottom: 2px !important;
    }
}

/* Remove box around results summary */
.results-summary {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Even out sizes of inputs and buttons */
.search-input,
.search-select,

/* Reset button as actual grey button */

.btn-reset:hover {
    background: #e9ecef !important; /* Slightly darker gray */
    border-color: #dee2e6 !important;
    color: #212529 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08) !important;
    text-decoration: none !important;
}

.btn-reset:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(0, 87, 163, 0.25) !important; /* Matches your primary */
}

.results-summary {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0.01rem 0 !important;
    margin: 0 auto !important;
    text-align: center !important;
}

.results-count {
    justify-content: center !important;
    align-items: center !important;
    font-size: 0.90rem !important;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Remove all visible boxes and lines */
.results-summary {
    background: transparent !important;
    border: none !important;
    border-top: none !important;
    box-shadow: none !important;
    padding: var(--search-spacing-md) 0 !important; /* Keep vertical spacing, remove horizontal padding */
}

.results-info {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.results-count {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.search-form {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.search-controls-grid {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.search-input,
.search-select {
    border: 1px solid #ddd !important;
    background: white !important;
    box-shadow: none !important;
}

.search-field-group {
    border: none !important;
    background: transparent !important;
}

.search-bar-wrapper {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.input-wrapper {
    border: none !important;
    box-shadow: none !important;
}

.checkbox-label,

/* Remove box around On Sale Only checkbox */
.search-checkbox-group {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.checkbox-label {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.checkbox-indicator {
    border: 2px solid #ddd !important;
    background: white !important;
}

/* Make On Sale Only font match other search elements but bold */
.checkbox-label .label-text {
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
}

/* Ensure the entire checkbox label inherits the search form typography */
.checkbox-label {
    font-family: inherit !important;
    font-size: inherit !important;
}

/* Fix checkbox and text alignment */
.checkbox-label {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    margin: 0 !important;
    padding: 0 !important;
}

.checkbox-indicator {
    flex-shrink: 0 !important;
    margin: 0 !important;
}

.label-text {
    margin: 0 !important;
    line-height: 2.5 !important;
}

/* Ensure the checkbox group aligns with other form elements */
.search-checkbox-group {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

/* Move results counter close to search boxes with minimal spacing */
.results-summary {
    background: transparent !important;
    border: none !important;
    border-top: none !important;
    box-shadow: none !important;
    padding: 0.75rem 0 var(--search-spacing-md) 0 !important; /* Small top padding for 1 line spacing */
    margin-top: 0 !important;
}

.search-bar-wrapper {
    margin-bottom: 0 !important; /* Remove bottom margin from search bar */
}

.search-form {
    margin-bottom: 0 !important; /* Remove bottom margin from form */
}

/* Remove all space/padding in the area between search bar and results counter */
.search-bar-wrapper {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.search-form {
    margin-bottom: 0 !important;
    padding-bottom: 1rem !important;
}

.search-controls-grid {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.results-summary {
    background: transparent !important;
    border: none !important;
    border-top: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    margin-top: 0 !important;
}

.results-info {
    margin: 0 !important;
    padding: 0 !important;
}

.results-count {
    margin: 0 !important;
    padding: 0 !important;
}

.btn-reset {
    background: #f1f3f4 !important;
    border: 2px solid #e9ecef !important;
    color: #343a40 !important;
    font-weight: 600 !important;
    border-radius: var(--search-border-radius) !important;
    padding: 10px 16px !important; /* Equal L/R spacing */
    font-size: 0.875rem !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important; /* Space between icon and text */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    transition: background 0.2s ease, box-shadow 0.2s ease !important;
}

/* === Alignment Fixes === */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 8px;
    font-size: 0.875rem;
}

.search-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
}

.reset-button-wrapper {
    display: flex;
    align-items: center;
    height: 38px;
}

.btn-reset {
    height: 38px !important;
    padding: 6px 16px !important;
    font-size: 0.875rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* === Uniform Alignment to Match Search Input Height === */
.search-bar .search-field-group select,
.search-bar .search-field-group input[type="checkbox"],
.search-bar .search-field-group .btn-reset,
.search-bar .search-field-group label,
.search-bar .reset-button-wrapper {
    height: 46px !important;
}

.search-bar .search-field-group select,
.search-bar .search-field-group .btn-reset,
.search-bar .reset-button-wrapper,
.checkbox-label {
    display: inline-flex;
    align-items: center;
}

.btn-reset {
    padding: 10px 16px !important;
}

.search-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
}


/* === REMOVED PREVIOUS ITEM GRID PATCH === */

.item-grid-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
    box-sizing: border-box;
}

.item-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* Center the item cards */
    gap: 2rem;
    padding: 2rem 0;
    margin: 0 auto;
    width: 100%;
    max-width: 1800px;
}




/* === REMOVED OLD PAGINATION PATCH === */

.pagination-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem auto;
    max-width: 1800px;
    box-sizing: border-box;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}



/* === REMOVED PREVIOUS PATCH: /* === FINAL FIX: 4-COLUMN GRID + PAGINATION AT BOTTOM === === */

.item-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 2rem 1rem;
    margin: 0 auto;
    width: 100%;
    max-width: 1600px;
}

.item-card {
    flex: 1 1 calc(25% - 2rem); /* 4 per row */
    max-width: 360px;
    min-width: 280px;
    box-sizing: border-box;
}

.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem auto;
    width: 100%;
    max-width: 1600px;
    box-sizing: border-box;
    clear: both;
}



/* === FINAL GRID + PAGINATION LAYOUT FIX (ENFORCED) === */

.item-grid-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

.item-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 2rem 0;
    box-sizing: border-box;
    width: 100%;
    margin: 0 auto;
}

/* Responsive 4-column grid on large screens */
.item-card {
    flex: 1 1 calc(25% - 2rem);
    max-width: calc(25% - 2rem);
    min-width: 280px;
    box-sizing: border-box;
}

.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem auto;
    width: 100%;
    max-width: 1600px;
    box-sizing: border-box;
    clear: both;
}



/* === ENFORCED FIXES: 4-COLUMN GRID + PROPER PAGINATION + CARD WIDTH RESET === */

.item-grid-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
    display: block !important;
}

.item-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 2rem 0;
    margin: 0 auto;
    width: 100%;
    max-width: 1600px;
    box-sizing: border-box;
}

.item-card {
    flex: 1 1 calc(25% - 2rem);
    max-width: calc(25% - 2rem);
    min-width: 280px;
    width: auto !important;
    box-sizing: border-box;
}

.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem auto;
    width: 100%;
    max-width: 1600px;
    box-sizing: border-box;
    clear: both;
}



/* === DARK MODE FIX: RESULTS COUNT TEXT TO WHITE === */

@media (prefers-color-scheme: dark) {
  .results-count,
  .results-count .count-range,
  .results-count .count-total,
  .results-count .page-info {
    color: #ffffff;
  }
}

.dark-mode .results-count,
.dark-mode .results-count .count-range,
.dark-mode .results-count .count-total,
.dark-mode .results-count .page-info {
  color: #ffffff;
}



/* ========== SEARCH BAR WHITE BACKGROUND FIX ========== */
.search-bar-wrapper {
    background: #ffffff !important;
    border-bottom: 1px solid var(--search-gray-200);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid var(--search-gray-200) !important;
    border-radius: 0 !important;
}

.search-form {
    background: #ffffff !important;
}

.search-controls-grid {
    background: #ffffff !important;
}

.search-field-group,
.search-label,
.search-primary,
.search-category,
.search-items-per-page,
.search-checkbox-group,
.search-reset-group {
    background: transparent !important;
}

/* ========== RESULTS COUNT WHITE BACKGROUND FIX ========== */
.results-summary {
    background: #ffffff !important;
    border-bottom: 1px solid var(--search-gray-200) !important;
    padding: var(--search-spacing-md) 0 !important;
    margin: 0 auto !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.results-count,
.results-count .count-range,
.results-count .count-total,
.results-count .page-info {
    color: #333333 !important;
    background: transparent !important;
}

/* ========== DARK MODE OVERRIDE FOR WHITE BACKGROUNDS ========== */
@media (prefers-color-scheme: dark) {
    .search-bar-wrapper,
    .search-form,
    .search-controls-grid,
    .results-summary {
        background: #ffffff !important;
        color: #333333 !important;
    }

    .search-input,
    .search-select {
        background: #ffffff !important;
        color: #333333 !important;
        border: 2px solid var(--search-gray-300) !important;
    }

    .results-count,
    .results-count .count-range,
    .results-count .count-total,
    .results-count .page-info {
        color: #333333 !important;
    }
}

.dark-mode .search-bar-wrapper,
.dark-mode .search-form,
.dark-mode .search-controls-grid,
.dark-mode .results-summary {
    background: #ffffff !important;
    color: #333333 !important;
}

.dark-mode .results-count,
.dark-mode .results-count .count-range,
.dark-mode .results-count .count-total,
.dark-mode .results-count .page-info {
    color: #333333 !important;
}

/* ========== BUTTON STYLING ========== */
.btn-reset {
    background: #f1f3f4 !important;
    border: 1px solid #000 !important; /* Thin black outline */
    color: #343a40 !important;
}

/* On Sale button styling */
.btn-sale {
    background: #f1f3f4 !important;
    border: 1px solid #e9ecef !important;
    color: #343a40 !important;
    margin-right: 8px !important;
}

.btn-sale:hover {
    background: #e9ecef !important;
    border-color: #dee2e6 !important;
    color: #212529 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08) !important;
    text-decoration: none !important;
}

.btn-sale.active {
    background: #ffebee !important; /* Light red background */
    border-color: #ffcdd2 !important;
    color: #c62828 !important;
}

.btn-sale.active:hover {
    background: #ffcdd2 !important;
    border-color: #ef9a9a !important;
    color: #b71c1c !important;
    box-shadow: 0 4px 6px rgba(198, 40, 40, 0.1) !important;
}

/* ========== ITEM DETAIL PAGE BUTTON STYLES ========== */
.button-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-top: 1.5rem;
    gap: 1rem;
}

.return-btn {
    background: #5C4A2A;
    color: white;
    padding: 0 24px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    font-size: 16px;
    width: 100%;
}

.return-btn:hover {
    background: #011627;
    box-shadow: 0 4px 12px rgba(61, 40, 23, 0.3);
    text-decoration: none;
    color: white;
    transform: translateY(-2px);
}

.purchase-btn {
    background: #0074D9;
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.1;
    height: 56px;
    padding: 0 24px;
    font-size: 16px;
    width: 100%;
}

.purchase-btn:hover {
    background: #0057A3;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 87, 163, 0.4);
    text-decoration: none;
    transform: translateY(-2px);
}

.purchase-btn.sold-button {
    background: #002B5C;
    color: white;
    cursor: default;
}

.purchase-btn.sold-button:hover {
    background: #002B5C;
    transform: none;
    box-shadow: none;
}

.toggle-description {
    background: #f1f3f4;
    color: #343a40;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.4em 1em;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.toggle-description:hover {
    background: #e9ecef;
}

/* ========== GALLERY STYLES ========== */
.gallery-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.image-counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 14px;
    z-index: 2;
}

.modal-counter {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 16px;
    z-index: 10001;
}

.image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #333;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 2;
    transition: all 0.3s ease;
}

.image-nav:hover {
    color: #000;
}

.image-nav.prev {
    left: -5px;
}

.image-nav.next {
    right: -5px;
}

.thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.thumbnails img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.thumbnails img:hover,
.thumbnails img.active {
    border-color: #0057A3;
    transform: scale(1.05);
}

/* ========== ZOOM MODAL STYLES ========== */
.zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.zoom-wrapper {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-wrapper img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.zoom-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10000;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.zoom-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Modal navigation arrows */
.image-nav.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    width: 50px;
    height: 50px;
    font-size: 1.8rem;
    z-index: 10000;
}

.image-nav.modal-nav:hover {
    color: rgba(255, 255, 255, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.image-nav.modal-nav.prev {
    left: 20px;
}

.image-nav.modal-nav.next {
    right: 20px;
}

/* Responsive adjustments for modal navigation */
@media (max-width: 768px) {
    .image-nav.modal-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .image-nav.modal-nav.prev {
        left: 10px;
    }

    .image-nav.modal-nav.next {
        right: 10px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Responsive adjustments for item detail page */
@media (max-width: 768px) {
    .image-nav {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .thumbnails img {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .image-nav {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .zoom-close {
        top: -30px;
        width: 30px;
        height: 30px;
        font-size: 1.5rem;
    }
}

/* Match filter tag radius to button style (6px) */
.filter-tag,
.search-tag,
.active-filter {
    border-radius: 6px !important;
}


/* === DARK MODE PRICE COLOR & SHADOW FIX === */
@media (prefers-color-scheme: dark) {
  /* Brighter green price and sale price */
  .item-card .sale-price,
  .sale-price,
  .price {
    color: #c4ff79 !important;
  }

  /* Light gray original price */
  .item-card .original-price,
  .original-price {
    color: #bbbbbb !important;
  }

  /* Remove overly bright text-shadow from dark backgrounds */
  .item-card h2,
  .item-card p {
    text-shadow: none !important;
  }
}
