/* products.css
   Page-specific styles for the Products / Shop page.
   - Relies on global styles from styles.css (colors, typography = Century Gothic, navbar link glow, footer base, etc.)
   - Keeps only what is unique here:
     • extra page vars (light sections, sidebar bg, overlay bg)
     • fixed navbar behavior
     • product cards / sale badge
     • filter overlay / sidebar
     • search + table styling
     • pagination pills
     • responsive tweaks
   - Removes duplicated variables, fonts, footer styling, modal/form/button theming already in styles.css.
*/

/* =========================================
   EXTRA PAGE VARIABLES (not in styles.css)
   ========================================= */
:root {
  --light-bg: #f9f9f9;
  --sidebar-bg: #f8f9fa;

  /* Overlay (dynamic, based on theme vars already defined globally) */
  --overlay-bg: var(--card-bg);
  --overlay-text: var(--text-primary);
}

[data-theme="night"] {
  --light-bg: #2d2d2d;
  --sidebar-bg: #2d2d2d;
}

/* =========================================
   NAVBAR OVERRIDE FOR THIS PAGE
   (Shop page wants a fixed navbar always visible)
   ========================================= */
.navbar {
  background-color: var(--navbar-bg) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1100;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Make navbar toggler icon visible in both themes */
.navbar-toggler-icon {
  filter: invert(0);
  transition: filter 0.3s ease;
}

[data-theme="night"] .navbar-toggler-icon {
  filter: invert(1);
}

/* Content needs breathing room under fixed navbar */
main,
#mainContent,
.content-wrapper {
  margin-top: 60px;
}

/* =========================================
   SEARCH BAR + SMALL TABLE (top controls)
   ========================================= */
.search-table-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.search-input {
  flex: 1 1 300px;
  padding: 0.6rem 1rem;
  border: 2px solid rgba(205, 127, 50, 0.85);
  border-radius: 30px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
  border-color: rgba(205, 127, 50, 1);
  box-shadow: 0 0 8px rgba(205, 127, 50, 0.7);
}

.product-table {
  border-collapse: collapse;
  border: 2px solid rgba(205, 127, 50, 0.85);
  border-radius: 10px;
  overflow: hidden;
  max-width: 700px;
  box-shadow: 0 0 15px rgba(205, 127, 50, 0.15);
}

.product-table th,
.product-table td {
  padding: 0.75rem 1rem;
  border: 1px solid rgba(205, 127, 50, 0.25);
  text-align: left;
  color: var(--text-primary);
  font-weight: 500;
}

.product-table th {
  background-color: rgba(205, 127, 50, 0.15);
}

/* =========================================
   PRODUCT CARD GRID
   ========================================= */
.product-card {
  text-align: center;
  padding: 1rem 0.75rem;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: var(--card-bg);
  box-shadow: 0 0 10px var(--card-shadow);
  transition: box-shadow 0.3s ease;
  position: relative;
  max-width: 280px;
  margin: auto;

  /* for equal-height cards in a row */
  height: 100%;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: 0 0 25px var(--card-hover-shadow);
}

.product-img-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
}

.product-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: block;
}

.product-card:hover img {
  transform: scale(1.05);
  box-shadow: 0 10px 20px rgba(205, 127, 50, 0.85);
}

/* "Add to cart" / CTA button on each card */
.product-card button {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  padding: 0.4rem 1.1rem;
  border-radius: 30px;
  border: 2px solid rgba(205, 127, 50, 0.85);
  background-color: transparent;
  color: rgba(205, 127, 50, 0.85);
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.product-card button:hover {
  background-color: rgba(205, 127, 50, 0.85);
  color: #fff;
  border-color: rgba(205, 127, 50, 0.85);
}

/* Short product description under title/price */
.product-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  /* clamp to 3 lines */
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1rem;
}

/* =========================================
   SALE BADGE
   (corner price badge over product image)
   ========================================= */
.sale-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(205, 127, 50, 0.95);
  color: #fff;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 1.2rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: skew(-12deg);
  cursor: default;
  transition: box-shadow 0.3s ease;
  z-index: 20;
}

.sale-badge:hover {
  box-shadow: 0 6px 16px rgba(205, 127, 50, 0.8);
}

.sale-badge .old-price {
  position: relative;
  font-size: 0.8rem;
  opacity: 0.75;
  color: #fff;
  text-transform: uppercase;
  padding-right: 12px;
  transform: skew(12deg);
}

.sale-badge .old-price::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 5%;
  right: 5%;
  border-top: 2.5px solid #fff;
  transform: rotate(-15deg);
  transform-origin: center;
  opacity: 0.85;
}

.sale-badge .new-price {
  color: #cd7f32;
  font-size: 1.1rem;
  font-weight: 900;
  text-transform: uppercase;
  transform: skew(12deg);
}

/* =========================================
   SECTION TITLES + ANIMATION
   ========================================= */
.section-title {
  text-align: center;
  margin-bottom: 1.25rem;
  color: rgba(205, 127, 50, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  animation: titleFade 1.2s ease both;
}

@keyframes titleFade {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================
   FILTER SIDEBAR (DESKTOP) + MOBILE OVERLAY
   ========================================= */

/* Desktop sidebar (left filters on large screens) */
#filterSidebar {
  background-color: var(--sidebar-bg) !important;
  border-color: var(--border-color) !important;
}

#filterSidebar label {
  color: var(--text-primary);
}

/* Mobile filter overlay (slides in full-screen on small viewports) */
@media (max-width: 991.98px) {

  /* Toggle button hover (optional bronze glow) */
  #filterToggleBtn:hover {
    background: rgba(205, 127, 50, 1);
  }

  #filterOverlay {
    display: none;
    position: fixed;
    top: 56px;
    /* below navbar */
    left: 0;
    width: 100vw;

    /* Use dynamic vh so mobile browser UI doesn't hide content */
    height: calc(100dvh - 56px);

    background-color: var(--overlay-bg);
    color: var(--overlay-text);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);

    /* keep some room so sticky footer actions are visible */
    padding: 1rem 1rem 6rem;

    z-index: 1050;
    overflow-y: auto;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: translateX(-100%);
    opacity: 0;
  }

  /* when overlay is open */
  #filterOverlay.active {
    display: block;
    transform: translateX(0);
    opacity: 1;
  }

  /* close button in the corner under navbar */
  #closeFilterBtn {
    position: fixed;
    top: 56px;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: rgba(205, 127, 50, 0.85);
    transition: color 0.3s ease;
    z-index: 11000;
  }

  #closeFilterBtn:hover {
    color: rgba(205, 127, 50, 1);
  }

  /* push headings down a bit so they don't hide behind close button */
  #filterOverlay>h4 {
    padding-top: 2.5rem;
  }

  /* hide the desktop sidebar when in mobile view */
  #filterSidebar {
    display: none !important;
  }

  /* sticky bottom bar inside the overlay with Apply / Clear buttons */
  .filter-actions {
    position: sticky;
    bottom: 0;
    background: var(--overlay-bg);
    padding: 0.75rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);

    /* support iPhone safe area */
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }
}

/* Make overlay labels readable in both light/dark modes */
#filterOverlay label {
  color: var(--text-primary);
}

/* Theme toggle button inside navbar (reuses global .theme-toggle visuals) */
.theme-toggle {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.3s ease;
  margin-left: 1rem;
}

.theme-toggle:hover {
  background-color: var(--accent-color);
  color: white;
  transform: scale(1.1);
}

/* =========================================
   LAYOUT / GRID CONSISTENCY
   ========================================= */

/* Make every product card in this grid stretch same height */
#products .row.g-4 {
  align-items: stretch;
}

/* =========================================
   PAGINATION (pill-style nav)
   ========================================= */

.custom-pagination {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.custom-pagination .page-link {
  border-radius: 1.5rem;
  padding: 0.4rem 0.8rem;
  min-width: 2rem;
  text-align: center;
  color: #555;
  background-color: #fff;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.custom-pagination .page-link:hover {
  background-color: #f0f0f0;
  color: #333;
}

.custom-pagination .page-item.active .page-link {
  background-color: var(--accent-color);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.custom-pagination .page-item.disabled .page-link {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 400px) {
  .custom-pagination .page-link {
    padding: 0.25rem 0.5rem;
    min-width: 1.6rem;
    font-size: 0.85rem;
  }
}

/* =========================================
   MOBILE MODAL SAFETY
   Make sure centered modals don't sit under the fixed navbar on tiny screens
   ========================================= */
@media (max-width: 576px) {
  .modal-dialog.modal-dialog-centered {
    margin: 56px auto 0 !important;
  }
}

/* ===============================
   FILTER PANEL / OVERLAY RESTYLE
   =============================== */

/* PANEL (desktop sidebar) */
.filter-panel {
  min-width: 260px;
  max-width: 280px;
  background-color: var(--sidebar-bg);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
  max-height: calc(100vh - 120px);
  position: sticky;
  top: 100px;
  padding: 0;
  overflow: hidden;
}

/* header row of panel */
.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--card-bg);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1rem 0.5rem;
}

.filter-panel-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.filter-panel-title i {
  color: var(--accent-color);
  font-size: 1rem;
}

/* "Clear all" link button */
.link-clear {
  background: none;
  border: 0;
  color: var(--accent-color);
  font-size: .8rem;
  font-weight: 500;
  padding: .25rem .5rem;
  line-height: 1;
  text-decoration: underline;
}

.link-clear:hover {
  text-decoration: none;
  color: rgba(205, 127, 50, 1);
}

/* scrollable body inside sidebar */
.filter-panel-body {
  overflow-y: auto;
  padding: 1rem;
  max-height: calc(100vh - 220px);
}

/* footer apply button */
.filter-panel-footer {
  border-top: 1px solid var(--border-color);
  background-color: var(--card-bg);
  padding: .75rem 1rem;
}

.filter-apply-btn {
  background-color: var(--accent-color);
  border: 0;
  color: #fff;
  font-weight: 600;
  border-radius: .75rem;
  box-shadow: 0 8px 24px rgba(205, 127, 50, 0.3);
}

.filter-apply-btn:hover {
  background-color: rgba(205, 127, 50, 1);
  color: #fff;
  box-shadow: 0 10px 28px rgba(205, 127, 50, 0.45);
}

/* ===============================
   OVERLAY (mobile)
   =============================== */
.filter-overlay {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  background-color: var(--overlay-bg);
  color: var(--overlay-text);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  z-index: 1050;
  height: 100dvh;
  display: none;
  flex-direction: column;

  transform: translateX(-100%);
  opacity: 0;
  transition: transform .3s ease-in-out, opacity .3s ease-in-out;
}

/* show state */
.filter-overlay.active {
  display: flex;
  transform: translateX(0);
  opacity: 1;
}

/* sticky top bar inside overlay */
.filter-overlay-header {
  position: sticky;
  top: 0;
  background-color: var(--card-bg);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .9rem 1rem;
  z-index: 20;
}

.filter-overlay-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.filter-overlay-title i {
  color: var(--accent-color);
  font-size: 1rem;
}

/* close button in overlay header */
.filter-close-btn {
  background: none;
  border: 0;
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 1;
  padding: .5rem;
  border-radius: .5rem;
}

.filter-close-btn:hover {
  background-color: var(--accent-color);
  color: #fff;
}

/* scrollable body area of overlay (below header, above footer) */
.filter-scroll-area {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem 1rem 6rem;
  /* leave room for footer actions bar */
}

/* sticky footer actions on mobile */
.filter-footer-actions {
  position: sticky;
  bottom: 0;
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
  display: flex;
  gap: .75rem;
  z-index: 30;
}

.filter-clear-btn {
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: .75rem;
  font-weight: 500;
  color: var(--text-primary);
}

.filter-clear-btn:hover {
  background-color: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
}

@media (max-width: 991.98px) {

  /* hide sidebar on mobile */
  .filter-panel {
    display: none !important;
  }
}

/* ===============================
   FILTER CARDS / ACCORDIONS
   =============================== */
.filter-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: .75rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 24px var(--card-shadow);
  overflow: hidden;
}

.filter-card-header {
  width: 100%;
  background: none;
  border: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  padding: .9rem 1rem;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.filter-card-header i {
  line-height: 1;
}

.filter-card-header .chevron {
  transition: transform .25s ease;
  color: var(--accent-color);
}

.filter-card.is-open .filter-card-header .chevron {
  transform: rotate(180deg);
}

.filter-card-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border-color);
  display: none;
}

.filter-card.is-open .filter-card-body {
  display: block;
}

/* subgroup title inside subcategories section */
.filter-subgroup {
  margin-bottom: 0.75rem;
}

.filter-subgroup-title {
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: .5rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* each row = checkbox + label inline */
.filter-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  padding: .4rem 0;
  cursor: pointer;
}

/* hide default checkbox and draw custom */
.filter-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.filter-row-label {
  color: var(--text-primary);
  line-height: 1.4;
}

/* =====================================
   ACTIVE FILTER CHIPS
   ===================================== */
.active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background-color: transparent;
}

.active-chips:empty {
  display: none;
}

/* little pill chip with an x */
.chip {
  background-color: var(--accent-color);
  color: #fff;
  font-size: .75rem;
  line-height: 1;
  border-radius: 999px;
  padding: .5rem .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  box-shadow: 0 8px 18px rgba(205, 127, 50, .4);
  font-weight: 600;
  white-space: nowrap;
}

.chip-remove-btn {
  background: none;
  border: 0;
  color: #fff;
  font-size: .8rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: .8;
}

.chip-remove-btn:hover {
  opacity: 1;
}

/* =====================================
   PRICE INPUTS SIDE BY SIDE
   ===================================== */
.price-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}

.price-col {
  flex: 1 1 100px;
  min-width: 0;
}

.price-col .form-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .25rem;
}

/* Desktop filter sidebar panel */
.filter-panel {
  background-color: var(--sidebar-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 0.5rem;
  padding: 1rem 1rem 5rem;
  /* space at bottom for sticky footer */
  max-height: calc(100vh - 100px);
  position: sticky;
  top: 80px;
  display: none;
  /* overridden to flex on lg+ in HTML */
}

/* give breathing room between sidebar and products */
@media (min-width: 992px) {
  .filter-panel {
    margin-right: 2rem;
    /* <-- this creates the gap */
    min-width: 260px;
    /* keep a nice fixed width so it doesn't collapse */
  }
}
