:root {
 --light-primary: #f8f8f8;
 --text-dark: #333333;
 --text-light: #fdfdfd;
 --accent-gold: #b49b66;
 --card-background: #ffffff;
 --border-color: #e5e5e5;
}

html, body {
 margin: 0; padding: 0;
 scroll-behavior: smooth;
 background-color: var(--light-primary); color: var(--text-dark);
}

* {
 -webkit-tap-highlight-color: rgb(0 0 0 / 10%);
 transition: all .25s; font-family: 'Poppins', sans-serif;
 box-sizing: border-box;
}

::-webkit-scrollbar {width: 9.5px;}
::-webkit-scrollbar-track {background: #ccc; margin: 5px; border-radius: 50px;}
::-webkit-scrollbar-thumb {background: #555; border-radius: 50px;}
::-webkit-scrollbar-thumb:hover {background: #333;}
::-webkit-scrollbar:horizontal {height: 9.5px;}

/* Main Content Layout */
.search-main-content {
    display: grid;
    grid-template-columns: 280px 1fr; /* Sidebar and Results */
    gap: 30px;
    padding: 10px;
}

/* Filter Sidebar */
#filter-sidebar {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

@media (min-width: 901px) {
    #filter-sidebar {
        position: sticky;
        top: 146px;
        max-height: calc(100vh - 155px);
        overflow-y: auto;
    }
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.filter-header h2 {
    margin: 0;
    font-size: 20px;
}

#apply-filters-btn {
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    font-weight: bold;
    cursor: pointer;
}

.filter-group {
    margin-bottom: 25px;
}

.filter-group h3 {
    font-size: 16px;
    margin: 0 0 10px 0;
    color: #333;
}

.offer-banner {
    position: sticky;
    top: 144px;
    margin: 0 0 20px -30px;
    width: calc(100% + 40px);
    z-index: 99;
    background-color: #B49B66; /* Your accent gold */
    color: white;
    padding: 1px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.offer-banner p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    flex-grow: 1;
}
.offer-banner button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}
@media (max-width: 900px) {
    .offer-banner { top: 90px; margin: 0 0 20px -10px; width: calc(100% + 20px); } /* Mobile header height adjustment */
    .offer-banner p { font-size: 12px; }
}

/* Price Filter Styling */
.price-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-input-container input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}
/* Hides the arrows on number inputs */
.price-input-container input::-webkit-outer-spin-button,
.price-input-container input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Checkbox Options Styling */
.filter-options .option {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.filter-options label {
    margin-left: 8px;
    cursor: pointer;
    color: #555;
}

.filter-options input[type="checkbox"] {
    cursor: pointer;
}

/* Results Area */
#results-container {
    background-color: transparent;
}

.results-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
}

#results-title {
    margin: 0 0 5px 0;
}

#results-count {
    margin: 0;
    color: #666;
}

.breadcrumb-nav {
    padding: 15px 10px;
    font-size: 13px;
    color: #888;
}
.breadcrumb-nav a {
    text-decoration: none;
    color: var(--accent-gold);
}
.breadcrumb-nav .sep {
    margin: 0 8px;
    opacity: 0.5;
}
.breadcrumb-nav .query-text {
    color: var(--text-dark);
    font-weight: 500;
}

#products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

/* Product Card Styling (Placeholder) */
.product-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.12);
}

.product-image {
    height: 180px;
    background-color: #eee;
    margin-bottom: 15px;
    border-radius: 4px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


.product-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-bottom: 10px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.product-variety {
    font-size: 15px;
    color: #555;
    margin: 2px 0 0 0;
}

.product-separator {
    border: none;
    height: 1px;
    background-color: #eee;
    margin: 10px 0;
}

.product-meta-details {
    font-size: 12px;
    color: #888;
    margin: 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-actions button, .product-actions a {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
}

.add-to-cart-btn {
    background-color: #333;
    color: #fff;
    border: none;
    cursor: pointer;
}


/* Responsive Design */
@media (max-width: 900px) {
    .search-main-content {
        grid-template-columns: 1fr; /* Stack sidebar and results */
    }
    #filter-sidebar {
        margin-bottom: 30px;
    }
}

@media (max-width: 600px) {
    #products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}


/* Mobile Filter Sidenav */
/* --- Default styles for new mobile buttons (hidden on desktop) --- */
#mobile-filter-trigger,
#close-filters-btn {
    display: none;
}


/* --- Responsive Design for Mobile Filters --- */
@media (max-width: 900px) {
    
    /* 1. Show the mobile "Filters" button and style it */
    #mobile-filter-trigger {
        display: flex;
        align-items: center;
        gap: 8px;
        background-color: #333;
        color: white;
        border: none;
        padding: 8px 15px;
        border-radius: 20px;
        font-size: 14px;
        font-weight: bold;
        cursor: pointer;
        /* Position it within the results header */
        margin-left: auto; /* Pushes it to the right */
    }

    /* 2. Reposition the sidebar to be a fixed slide-in panel */
    #filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 300px; /* A good width for mobile filters */
        z-index: 2000; /* Above all other content */
        transform: translateX(-100%); /* Start hidden off-screen to the left */
        transition: transform 0.4s ease-in-out;
        overflow-y: auto; /* Allow scrolling if filters are long */
    }

    /* 3. The "open" state for the sidebar */
    #filter-sidebar.is-open {
        transform: translateX(0); /* Slide it into view */
    }
    
    /* 4. Style and show the close button inside the sidebar */
    #close-filters-btn {
        display: block;
        background: none;
        border: none;
        color: #888;
        cursor: pointer;
        margin-left: auto; /* Pushes it to the right */
    }
    .filter-header {
        /* Make space for the close button */
        justify-content: flex-start;
        gap: 15px;
    }
    .filter-header h2 {
        flex-grow: 1; /* Pushes other items to the right */
    }

    /* 5. Create a background overlay */
    body.filter-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.6);
        z-index: 1999; /* Just below the sidebar */
    }

    /* 6. Prevent body scrolling when filter is open */
    body.filter-open {
        overflow: hidden;
    }
}


/* Add to Cart & Quantity Counter */
.product-actions .add-to-cart-wrapper {
  position: relative;
  height: 40px; /* Adjust height to match the button */
}

/* Position both button and counter in the same spot */
.product-actions .add-to-cart-btn,
.product-actions .quantity-counter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

/* Style for the counter itself */
.product-actions .quantity-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--accent-gold);
  border-radius: 5px;
  color: var(--text-light);
  padding: 0 8px;
  
  /* Start hidden */
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
  
  border-radius: 22px;
}

/* When the counter is active/visible */
.quantity-counter.is-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* When the Add to Cart button is hidden */
.add-to-cart-btn.is-hidden {
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

/* Styling for the buttons and input inside the counter */
.qty-btn {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50% !important;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  width: 30px !important;
  height: 30px;
  line-height: 0;
}

.qty-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.qty-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.qty-input {
  background: transparent;
  border: none;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  width: 40px;
  text-align: center;
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}


/* Live Stock Update Notification */
.product-card.stock-updated-flash {
  transition: box-shadow 0.2s ease-in-out, transform 0.2s;
  box-shadow: 0 0 0 3px var(--accent-gold), 0 6px 15px rgba(0,0,0,0.12);
  transform: translateY(-5px);
}


/* --- NEW: Lens Selection Iframe Modal --- */
#lens-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(27, 27, 27, 0.85);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#lens-modal-overlay.is-visible {
    display: flex;
    opacity: 1;
}

#lens-modal-content {
    background-color: #2c3a4a; /* Match lens selector theme */
    width: 95%;
    max-width: 850px; /* Wider for the lens tables */
    height: 90vh;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#lens-modal-overlay.is-visible #lens-modal-content {
    transform: scale(1);
}

#lens-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #aab8c5;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 10;
}

#lens-selector-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 16px;
    visibility: hidden; /* Hide iframe until it's loaded */
}

#lens-modal-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.5rem;
    font-weight: 500;
}







