/* LISTING LAYOUT */
.listing-layout{display:grid;grid-template-columns:270px 1fr;gap:0;min-height:80vh;}

/* SIDEBAR */
.sidebar{border-right:1px solid var(--border);padding:24px 20px;background:var(--white);position:sticky;top:140px;height:fit-content;max-height:calc(100vh - 150px);overflow-y:auto;}
.sidebar::-webkit-scrollbar{width:4px;}
.sidebar::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px;}
.filter-header{font-size:16px;font-weight:700;color:var(--text-dark);margin-bottom:20px;padding-bottom:14px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;}
.filter-header a{font-size:12px;color:var(--accent);font-weight:500;cursor:pointer;}
.filter-group{border-bottom:1px solid var(--border);padding:16px 0;}
.filter-group-title{display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-size:14px;font-weight:500;color:var(--text-dark);user-select:none;}
.filter-group-title i{font-size:12px;color:var(--text-light);transition:transform .25s;}
.filter-group.open .filter-group-title i{transform:rotate(45deg);}
.filter-options{max-height:0;overflow:hidden;transition:max-height .3s ease;}
.filter-group.open .filter-options{max-height:500px;}
.filter-option{display:flex;align-items:center;gap:10px;padding:8px 0;cursor:pointer;font-size:13.5px;color:var(--text-mid);}
.filter-option:hover{color:var(--accent);}
.filter-option input[type=checkbox]{accent-color:var(--accent);width:15px;height:15px;cursor:pointer;}

/* PRODUCT AREA */
.product-area{padding:20px 24px;}
.product-area-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;flex-wrap:wrap;gap:12px;}
.product-area-title{font-family:var(--font-heading);font-size:20px;font-weight:600;color:var(--text-dark);}
.product-count{font-size:13px;color:var(--text-light);margin-left:8px;}
.sort-wrap{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--text-mid);}
.sort-wrap select{padding:8px 32px 8px 12px;border:1.5px solid var(--border);border-radius:6px;font-family:var(--font-body);font-size:13px;color:var(--text-dark);background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;appearance:none;outline:none;cursor:pointer;}
.sort-wrap select:focus{border-color:var(--accent);}

/* PRODUCT GRID */
.product-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;}
.product-card{background:var(--white);border:1px solid var(--border);border-radius:8px;overflow:hidden;cursor:pointer;transition:box-shadow .25s,transform .25s;position:relative;}
.product-card:hover{box-shadow:0 8px 28px rgba(0,0,0,.09);transform:translateY(-3px);}
.product-card-img{position:relative;overflow:hidden;}
.product-card-img img{width:100%;height:260px;object-fit:cover;transition:transform .4s;}
.product-card:hover .product-card-img img{transform:scale(1.04);}
.badge{position:absolute;top:12px;left:12px;background:#fff;border:1px solid var(--border);padding:5px 10px;font-size:11px;font-weight:700;color:var(--text-dark);border-radius:4px;z-index:1;}
.badge-off{position:absolute;top:12px;right:12px;background:#e74c3c;color:#fff;padding:5px 10px;font-size:11px;font-weight:700;border-radius:4px;z-index:1;}
.wishlist-btn{position:absolute;top:10px;right:10px;width:34px;height:34px;background:rgba(255,255,255,.92);border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:15px;color:var(--text-light);cursor:pointer;z-index:2;border:1px solid var(--border);transition:color .2s,background .2s;}
.wishlist-btn:hover{color:#e74c3c;background:#fff;}
.wishlist-btn.wished{color:#e74c3c;}
.product-info{padding:14px;}
.product-name{font-size:14px;font-weight:500;color:var(--text-dark);margin-bottom:8px;line-height:1.4;}
.product-price{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.price-current{font-size:16px;font-weight:700;color:var(--text-dark);}
.price-original{font-size:13px;color:var(--text-light);text-decoration:line-through;}
.price-saved{font-size:12px;color:#27ae60;font-weight:600;}
.coupon-badge{margin-top:8px;display:inline-block;background:var(--accent-light);color:var(--accent);font-size:11px;font-weight:600;padding:3px 8px;border-radius:3px;border:1px dashed var(--accent);}

/* PAGINATION */
.pagination{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:32px;padding:24px 0;}
.page-btn{width:38px;height:38px;border:1.5px solid var(--border);border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:13px;cursor:pointer;transition:all .2s;color:var(--text-mid);}
.page-btn:hover,.page-btn.active{background:var(--accent);border-color:var(--accent);color:#fff;}
.page-btn.active{font-weight:600;}


/* ══════════════════════════════════════
   BREAKPOINTS — DESKTOP / TABLET
══════════════════════════════════════ */
@media(max-width:1100px){
  .product-grid{grid-template-columns:repeat(2,1fr);}
  .listing-layout{grid-template-columns:220px 1fr;}
}

@media(max-width:900px){
  /* Remove the sidebar from normal flow — it becomes a fixed drawer */
  .listing-layout{grid-template-columns:1fr;}
  .sidebar{display:none;} /* hidden until JS adds .active */

  .footer-top{grid-template-columns:1fr 1fr;}
  .breadcrumb{padding:12px 16px;}
  .product-area{padding:16px;}

  /* Extra bottom padding so last product isn't hidden behind the fixed bar */
  body{padding-bottom:60px;}
}

@media(max-width:600px){
  .product-grid{grid-template-columns:repeat(2,1fr);}
  .product-card-img img{height:180px;}
  .footer-top{grid-template-columns:1fr;padding:28px 20px;gap:20px;}
  .footer-bottom{flex-direction:column;gap:10px;padding:16px 20px;text-align:center;}
}


/* ══════════════════════════════════════
   SUBSCRIBE WRAP
══════════════════════════════════════ */
.subscribe-wrap{display:flex;border:1.5px solid var(--border);border-radius:6px;overflow:hidden;}
.subscribe-wrap input{flex:1;padding:10px 14px;border:none;outline:none;font-family:var(--font-body);font-size:13px;color:var(--text-dark);background:var(--off-white);min-width:0;}
.subscribe-wrap button{padding:10px 16px;border:none;background:var(--text-dark);color:var(--white);font-family:var(--font-body);font-size:13px;font-weight:600;cursor:pointer;transition:background 0.2s;white-space:nowrap;}
.subscribe-wrap button:hover{background:var(--accent);}

@media(max-width:480px){
  .subscribe-wrap{flex-direction:column;}
  .subscribe-wrap input{width:100%;border-bottom:1px solid var(--border);}
  .subscribe-wrap button{width:100%;border-radius:0;}
}


/* ══════════════════════════════════════
   MOBILE SORT & FILTER BAR (bottom)
══════════════════════════════════════ */
.mobile-filter-bar{
  display: none;
}

@media(max-width:900px){
  .mobile-filter-bar{
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    z-index: 9000;           /* below sidebar (99999) and overlay (99998) */
    border-top: 1px solid var(--border);
  }

  .mob-btn{
    flex: 1;
    text-align: center;
    padding: 14px 0;
    font-size: 13px;
    font-weight: 600;
    border-right: 1px solid var(--border);
    cursor: pointer;
  }

  .mob-btn:last-child{ border-right: none; }
  .mob-btn i{ margin-right: 6px; }
}


/* ══════════════════════════════════════
   DARK OVERLAY (behind sidebar drawer)
══════════════════════════════════════ */
.sidebar-overlay{
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.55);
  z-index: 99998;             /* just below sidebar */
}
.sidebar-overlay.active{ display: block; }


/* ══════════════════════════════════════
   SIDEBAR — MOBILE DRAWER
   Overrides the display:none above when
   .active is toggled by JS
══════════════════════════════════════ */
@media(max-width:900px){
  .sidebar{
    /* drawer: hidden off-screen left */
    display: block !important;  /* override the display:none set above */
    position: fixed !important;
    top: 0 !important;
    left: -105% !important;     /* extra 5% hides the box-shadow */
    width: 82% !important;
    max-width: 320px !important;
    height: 100% !important;
    min-height: 100vh !important;
    background: #ffffff !important;
    z-index: 99999 !important;  /* above overlay (99998) and bar (9000) */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 16px 110px 16px !important; /* bottom gap for Apply/Clear bar */
    box-shadow: 4px 0 32px rgba(0,0,0,0.22) !important;
    transition: left 0.3s cubic-bezier(.4,0,.2,1) !important;
    transform: none !important;
  }

  .sidebar.active{
    left: 0 !important;
  }
}


/* ══════════════════════════════════════
   SIDEBAR TOP BAR (title + close ✕)
   Only visible on mobile
══════════════════════════════════════ */
.sidebar-topbar{
  display: none;
}

@media(max-width:900px){
  .sidebar-topbar{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
    /* sticks to top while user scrolls through filters */
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
  }

  .sidebar-topbar-title{
    font-size: 17px;
    font-weight: 700;
    color: #222;
    letter-spacing: 0.3px;
  }

  .sidebar-close-btn{
    background: none;
    border: none;
    font-size: 20px;
    color: #555;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    line-height: 1;
    transition: background 0.15s;
  }

  .sidebar-close-btn:hover{
    background: #f5f5f5;
    color: #222;
  }
}


/* ══════════════════════════════════════
   MOBILE FILTER FOOTER (Apply / Clear)
   Slides in/out with the sidebar drawer
══════════════════════════════════════ */
.mob-filter-footer{
  /* Always rendered, hidden off-screen left */
  display: flex;
  position: fixed;
  bottom: 0;
  left: -105%;
  width: 82%;
  max-width: 320px;
  z-index: 100000;            /* above everything */
  background: #ffffff;
  border-top: 2px solid #eee;
  gap: 10px;
  padding: 12px 16px;
  box-sizing: border-box;
  transition: left 0.3s cubic-bezier(.4,0,.2,1);
  transform: none !important;
}

/* Slides in when sidebar opens */
.mob-filter-footer.sidebar-open{
  left: 0 !important;
}

/* Hide on desktop */
@media(min-width:901px){
  .mob-filter-footer{ display: none !important; }
}

/* Button styles */
.mob-apply-btn{
  flex: 2;
  background: #c8a96e;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: background 0.2s;
}
.mob-apply-btn:hover{ background: #b8935a; }

.mob-clear-btn{
  flex: 1;
  background: #f5f5f5;
  color: #444;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px 0;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.mob-clear-btn:hover{ background: #e8e8e8; }


/* ══════════════════════════════════════
   MOBILE SORT BOTTOM SHEET
══════════════════════════════════════ */
.mob-sheet-overlay{
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99998;
}
.mob-sheet-overlay.active{ display: block; }

.mob-sheet{
  position: fixed;
  bottom: -100%;
  left: 0; right: 0;
  background: #fff;
  border-radius: 18px 18px 0 0;
  z-index: 99999;
  padding: 0 0 40px;
  transition: bottom 0.32s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.13);
}
.mob-sheet.active{ bottom: 0; }

.mob-sheet-handle{
  width: 40px; height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 12px auto 0;
}
.mob-sheet-title{
  font-size: 15px;
  font-weight: 700;
  color: #222;
  padding: 16px 20px 10px;
  border-bottom: 1px solid #f0f0f0;
  letter-spacing: 0.3px;
}
.mob-sort-options{ padding: 6px 0; }

.mob-sort-option{
  display: flex;
  align-items: center;
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid #f8f8f8;
  transition: background 0.15s;
}
.mob-sort-option:active{ background: #fafafa; }
.mob-sort-option input[type="radio"]{ display: none; }
.mob-sort-option span{ flex: 1; font-size: 14px; color: #333; }
.mob-sort-tick{ font-size: 13px; color: #c8a96e; opacity: 0; transition: opacity 0.15s; }
.mob-sort-option input:checked ~ span{ font-weight: 600; color: #c8a96e; }
.mob-sort-option input:checked ~ .mob-sort-tick{ opacity: 1; }

/* Active button highlight */
.mob-btn.active-filter{ color: #c8a96e; font-weight: 700; }


/* ══════════════════════════════════════
   COLOR SWATCHES ON CARD HOVER
══════════════════════════════════════ */
.card-swatches{
  display: none;
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  gap: 5px;
  background: rgba(255,255,255,0.9);
  padding: 4px 8px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.product-card-img:hover .card-swatches{ display: flex; }

.swatch{
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  display: inline-block;
  transition: transform 0.15s;
}
.swatch:hover{ transform: scale(1.2); border-color: #333; }
.color-dot.selected{ border-color: #333 !important; }