:root {
  --header-height: 90px;
}

/* RESET */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* BODY */
body {
  font-family: system-ui, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  padding-top: var(--header-height);
  overflow-x: hidden;
}

/* HEADER */
#header {
  height: var(--header-height);
  background: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 22px;
  position: fixed;
  top: 0;
  width: 100%;
  border-bottom: 1px solid #e5e7eb;
  z-index: 9999;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

#HIcon { width: 48px; }
#HH1 { font-size: 1.5rem; }

/* ACTIONS */
#hamburger {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f1f5f9;
  font-size: 1.4rem;
  cursor: pointer;
}

/* SIDE NAV */
#nav {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh;
  background: white;
  padding: 90px 20px;
  transition: right .3s ease;
  z-index: 10000;
  box-shadow: -20px 0 40px rgba(0,0,0,.2);
}

#nav.active { right: 0; }

#navClose {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

#nav ul { list-style: none; }
#nav li { margin-bottom: 18px; }
#nav a {
  text-decoration: none;
  font-size: 1.1rem;
  color: #0f172a;
  font-weight: 600;
}

/* STORE */
.store-section {
  max-width: 1100px;
  margin: 60px auto;
  padding: 30px;
  background: #dbe8f5;
  border-radius: 20px;
}

/* FILTER */
.category-filter {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* GRID */
#shopgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 900px) {
  #shopgrid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  #shopgrid { grid-template-columns: 1fr; }
}

/* PRODUCT */
.productbox {
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}

/* CART */
#cart-icon {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #2563eb;
  color: white;
  padding: 12px 16px;
  border-radius: 999px;
  z-index: 2000;
  cursor: pointer;
}

/* BASKET */
#basket-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100%;
  background: white;
  transition: right .3s ease;
  z-index: 3000;
}

#basket-panel.open { right: 0; }

/* FOOTER */
#footer {
  text-align: center;
  padding: 40px 20px;
  margin-top: 60px;
}

/* SIDE ADS */
#asideleft,
#asideright {
  position: fixed;
  top: var(--header-height);
  width: 160px;
  height: calc(100vh - var(--header-height));
}

#asideleft { left: 10px; }
#asideright { right: 10px; }

@media (max-width: 1200px) {
  #asideleft,
  #asideright { display: none; }
}

/* ANIMATION */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: .6s ease;
}
.reveal.active {
  opacity: 1;
  transform: none;
}
/* =====================================================
   🔒 PRODUCT CARD LAYOUT FIX (SAFE OVERRIDES)
   ===================================================== */

/* Lock grid behavior */
#shopgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

/* Card structure — DO NOT REORDER */
.productbox {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  background: #ffffff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

/* Image consistency */
.productbox img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 10px;
  margin-bottom: 12px;
}

/* Title */
.productbox h3 {
  font-size: 1rem;
  margin: 8px 0 4px;
  color: #0f172a;
}

/* Price */
.productbox > div {
  font-weight: 700;
  margin-bottom: 6px;
}

/* Description */
.productbox p {
  font-size: 0.9rem;
  color: #475569;
  flex-grow: 1;
  margin-bottom: 10px;
}

/* Stock */
.productbox .stock {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 10px;
}

/* Button row — LOCK POSITION */
.productbox > div:last-child {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* Buttons — RESTORED STYLE */
.productbox .btn {
  flex: 1;
  padding: 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  transition: background .15s ease, transform .08s ease;
}

.productbox .btn.view {
  background: #2563eb;
  color: #fff;
}

.productbox .btn.add {
  background: #16a34a;
  color: #fff;
}

.productbox .btn:hover {
  transform: translateY(-1px);
}

.productbox .btn:disabled {
  background: #cbd5f5;
  color: #64748b;
  cursor: not-allowed;
}

/* =====================================================
   RESPONSIVE — KEEP ORDER
   ===================================================== */

@media (max-width: 900px) {
  #shopgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  #shopgrid {
    grid-template-columns: 1fr;
  }
}
/* =====================================================
   FIX AD OVERLAP — SAFE DESKTOP LAYOUT
   ===================================================== */

/* Only show side ads when there's room */
@media (min-width: 1300px) {
  body {
    padding-left: 200px;   /* 160px ad + spacing */
    padding-right: 200px;
  }

  .store-section {
    margin-left: auto;
    margin-right: auto;
  }
}

/* Hide ads on smaller screens */
@media (max-width: 1299px) {
  #asideleft,
  #asideright {
    display: none;
  }

  body {
    padding-left: 0;
    padding-right: 0;
  }
}
/* =====================================================
   FIX BASKET UNDER HEADER
   ===================================================== */

#basket-panel {
  top: 90px; /* header height */
  height: calc(100vh - 90px);
  z-index: 2000;
}

/* Mobile — full height still OK */
@media (max-width: 700px) {
  #basket-panel {
    top: 0;
    height: 100vh;
  }
}
/* =====================================================
   BASKET – STRUCTURAL FIX (NO LOGIC CHANGES)
   ===================================================== */

/* Basket panel base */
#basket-panel {
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Items container */
#basket-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* -------------------------------------
   Basket item row
------------------------------------- */
.basket-item {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
  align-items: center;
}

/* Product image */
.basket-item img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 8px;
}

/* Info column */
.basket-item .info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.basket-item .info h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
}

.basket-item .info .price {
  font-weight: 700;
  color: #2563eb;
}

/* Actions */
.basket-item .actions {
  display: flex;
}

.basket-item .actions button {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

/* -------------------------------------
   PAYMENT EMBED — FIXED
------------------------------------- */

/* Force embed to full row below item */
.basket-item .payment-embed {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding: 10px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
}

/* Prevent embed from overflowing */
.basket-item .payment-embed iframe,
.basket-item .payment-embed embed,
.basket-item .payment-embed object {
  max-width: 100%;
  width: 100%;
  border: none;
}

/* =====================================
   BASKET FOOTER + BUTTONS
   ===================================== */

#basket-footer {
  padding: 14px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

#basket-footer h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

/* Action buttons row */
.basket-actions {
  display: flex;
  gap: 10px;
}

#clear-cart-btn {
  flex: 1;
  background: #e5e7eb;
  color: #0f172a;
  border: none;
  padding: 10px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

#buy-all-btn {
  flex: 1;
  background: #16a34a;
  color: #ffffff;
  border: none;
  padding: 10px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

/* My orders button */
#my-orders-btn {
  width: 100%;
  margin-top: 10px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 10px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

/* =====================================
   MOBILE SAFETY
   ===================================== */
@media (max-width: 700px) {
  .basket-item {
    grid-template-columns: 60px 1fr;
  }

  .basket-item .actions {
    grid-column: 1 / -1;
    margin-top: 6px;
  }
}
