/* ==========================================================================
   pages.css - page-specific blocks
   ========================================================================== */

.section { margin-block: 40px; }

/* ==========================================================================
   HOME
   ========================================================================== */

/* --- hero slider ----------------------------------------------------------- */

.hero { position: relative; margin-block: 20px 28px; }

.hero__viewport {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.hero__track {
  display: flex;
  /* RTL flex puts slide 0 on the right, so a positive translateX advances */
  transition: transform .5s var(--ease);
  will-change: transform;
}

.hero__slide { flex: 0 0 100%; min-width: 0; }
.hero__slide img {
  width: 100%;
  aspect-ratio: 800 / 360;
  object-fit: cover;
  display: block;
}

.hero__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .88);
  border-radius: 50%;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 20px;
  opacity: 0;
  transition: opacity .2s var(--ease), background .2s var(--ease);
}
.hero:hover .hero__arrow,
.hero__arrow:focus-visible { opacity: 1; }
.hero__arrow:hover { background: #fff; }
.hero__arrow--prev { inset-inline-end: 12px; }
.hero__arrow--next { inset-inline-start: 12px; }
.hero__arrow--prev::before { content: "›"; }
.hero__arrow--next::before { content: "‹"; }

.hero__dots {
  position: absolute;
  bottom: 14px;
  inset-inline: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.hero__dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .6);
  border: 1px solid rgba(30, 42, 46, .18);
  transition: background .18s var(--ease), width .18s var(--ease);
}
.hero__dot.is-active { background: var(--teal); width: 26px; border-radius: var(--radius-pill); }

/* --- trust strip ----------------------------------------------------------- */

.trust { background: var(--surface); border-block: 1px solid var(--border); }

.trust__inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-block: 18px;
}

.trust__item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14.5px;
  font-weight: 600;
}
.trust__item + .trust__item { border-inline-start: 1px solid var(--border); }

.trust__icon { display: grid; place-items: center; color: var(--teal); }
.trust__icon svg {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

/* --- category tiles -------------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--gap);
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  transition: box-shadow .18s var(--ease), transform .18s var(--ease),
              border-color .18s var(--ease);
}
.tile:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  border-color: var(--teal-light);
  color: var(--ink);
}

/* `display:block` + overflow, not grid: a grid item will not shrink below its
   intrinsic size, which lets a tall photo stretch one tile past its siblings. */
.tile__media {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 8px;
  overflow: hidden;
}
.tile__media img { width: 100%; height: 100%; object-fit: contain; }

.tile__name { font-size: 13.5px; font-weight: 600; line-height: 1.4; }

/* --- promo banners --------------------------------------------------------- */

.promo { margin-block: 40px; }
.promo__link { display: block; }
.promo__link img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}

/* --- three-column rails ---------------------------------------------------- */

.rails {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.rail__title-head {
  margin: 0 0 6px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--teal);
  font-size: 17px;
  font-weight: 700;
}

/* ==========================================================================
   CATEGORY / SEARCH LISTING
   ========================================================================== */

.listing {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-block: 24px 40px;
}

/* --- sidebar --------------------------------------------------------------- */

.sidebar { position: sticky; top: calc(var(--header-h) + 12px); }

.filter-block {
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.filter-block__title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.cat-tree__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.cat-tree__link:hover { background: var(--surface); color: var(--teal-dark); }
.cat-tree__link.is-current {
  background: #E6F6F7;
  color: var(--teal-dark);
  font-weight: 700;
}
.cat-tree__count { color: var(--muted); font-size: 12px; }
.cat-tree__sub { padding-inline-start: 12px; }

.price-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.price-range input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
  -moz-appearance: textfield;
}
.price-range input::-webkit-outer-spin-button,
.price-range input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-range input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(22, 163, 171, .14);
}
.price-range__sep { color: var(--muted); }

.filter-block .checkbox + .checkbox { margin-top: 9px; }

.brand-list { max-height: 220px; overflow-y: auto; }

.filter-reset {
  width: 100%;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  padding: 6px;
}
.filter-reset:hover { color: var(--price); }

/* --- toolbar --------------------------------------------------------------- */

.listing__head { margin-bottom: 18px; }

.listing__title { font-size: 24px; margin-bottom: 4px; }
.listing__count { color: var(--muted); font-size: 14px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.toolbar__result { font-size: 13.5px; color: var(--muted); margin-inline-end: auto; }

.toolbar .select { width: auto; min-width: 190px; font-size: 13.5px; padding-block: 8px; }

.view-toggle { display: flex; gap: 4px; }
.view-toggle__btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
}
.view-toggle__btn:hover { color: var(--teal-dark); border-color: var(--teal-light); }
.view-toggle__btn.is-active { background: var(--teal); border-color: var(--teal); color: #fff; }
.view-toggle__btn svg { width: 16px; height: 16px; fill: currentColor; }

.filters-open {
  display: none;
  align-items: center;
  gap: 6px;
}

/* --- list view ------------------------------------------------------------- */

.grid--list { grid-template-columns: 1fr; }

.grid--list .card { flex-direction: row; align-items: stretch; }
.grid--list .card__media {
  flex: 0 0 190px;
  aspect-ratio: auto;
  width: 190px;
}
.grid--list .card__body { justify-content: center; gap: 10px; }
.grid--list .card__title { font-size: 16px; -webkit-line-clamp: 2; line-clamp: 2; }
.grid--list .card__cta { align-self: flex-start; width: auto; padding-inline: 26px; }

/* --- infinite scroll sentinel ---------------------------------------------- */

.scroll-sentinel { height: 1px; }

.loading-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
}
.loading-more__spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   PRODUCT PAGE
   ========================================================================== */

.product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  margin-block: 20px 40px;
  align-items: start;
}

/* --- gallery --------------------------------------------------------------- */

.gallery__main {
  position: relative;
  aspect-ratio: 1 / 1;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: zoom-in;
}

.gallery__badge {
  position: absolute;
  top: 14px; left: 14px;
  padding: 6px 12px;
  background: var(--price);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  direction: ltr;
}

.gallery__thumbs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.gallery__thumb {
  width: 76px; height: 76px;
  padding: 6px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s var(--ease);
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: contain; }
.gallery__thumb:hover { border-color: var(--teal-light); }
.gallery__thumb.is-active { border-color: var(--teal); }

/* --- lightbox -------------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 4vmin;
  background: rgba(15, 24, 27, .92);
}
.lightbox img {
  max-width: 100%;
  max-height: 92vh;
  object-fit: contain;
}
.lightbox__close,
.lightbox__nav {
  position: absolute;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  transition: background .15s var(--ease);
}
.lightbox__close:hover,
.lightbox__nav:hover { background: rgba(255, 255, 255, .3); color: #fff; }
.lightbox__close { top: 18px; inset-inline-start: 18px; }
.lightbox__nav--prev { top: 50%; inset-inline-end: 18px; transform: translateY(-50%); }
.lightbox__nav--next { top: 50%; inset-inline-start: 18px; transform: translateY(-50%); }

.lightbox__counter {
  position: absolute;
  bottom: 20px;
  inset-inline: 0;
  text-align: center;
  color: #C9D6DA;
  font-size: 14px;
}

/* --- details --------------------------------------------------------------- */

.product__title { font-size: 26px; line-height: 1.4; margin-bottom: 10px; }

.product__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: 13.5px;
  color: var(--muted);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.product__prices {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.product__price { font-size: 30px; font-weight: 800; color: var(--price); }
.product__old { font-size: 18px; color: var(--muted); text-decoration: line-through; }
.product__save { font-size: 13.5px; color: var(--teal-dark); font-weight: 700; margin-bottom: 16px; }

.stock {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 20px;
}
.stock::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.stock--in { background: #E7F7EE; color: #1B8A4B; }
.stock--out { background: #FDECEA; color: #C9351F; }

.product__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.product__actions .btn { flex: 1 1 190px; }

.product__short {
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 16px;
}

.product__cats { font-size: 13.5px; color: var(--muted); }
.product__cats a { color: var(--teal-dark); }
.product__cats a:hover { text-decoration: underline; }

/* --- tabs ------------------------------------------------------------------ */

.tabs { margin-block: 40px; }

.tabs__list {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
}

.tabs__tab {
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.tabs__tab:hover { color: var(--ink); }
.tabs__tab[aria-selected="true"] { color: var(--teal-dark); border-bottom-color: var(--teal); }

.tabs__panel { padding-top: 22px; font-size: 14.5px; line-height: 1.9; }
.tabs__panel[hidden] { display: none; }

.spec-table { width: 100%; border-collapse: collapse; }
.spec-table th, .spec-table td {
  padding: 11px 14px;
  border: 1px solid var(--border);
  text-align: start;
  font-size: 14px;
}
.spec-table th { background: var(--surface); font-weight: 700; width: 34%; }

/* ==========================================================================
   CART
   ========================================================================== */

.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 28px;
  align-items: start;
  margin-block: 24px 40px;
}

.cart-table { width: 100%; border-collapse: collapse; }

.cart-table th {
  padding: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 700;
  text-align: start;
}
.cart-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cart-item { display: flex; align-items: center; gap: 12px; }
.cart-item__img {
  flex: 0 0 72px;
  width: 72px; height: 72px;
  padding: 5px;
  background: var(--surface);
  border-radius: 6px;
}
.cart-item__img img { width: 100%; height: 100%; object-fit: contain; }
.cart-item__name { font-size: 14px; line-height: 1.5; }
.cart-item__name:hover { color: var(--teal); }
.cart-item__out { display: block; margin-top: 4px; font-size: 12px; color: var(--price); font-weight: 700; }

.cart-remove {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
}
.cart-remove:hover { background: #FDECEA; color: var(--price); }

.summary {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.summary__title { font-size: 17px; margin-bottom: 16px; }
.summary__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-block: 9px;
  font-size: 14px;
}
.summary__row--total {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 17px;
  font-weight: 700;
}
.summary__row--total .num { color: var(--price); }
.summary .btn { margin-top: 16px; }
.summary__note { margin-top: 12px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ==========================================================================
   CHECKOUT
   ========================================================================== */

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 28px;
  align-items: start;
  margin-block: 24px 40px;
}

.form-card {
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.form-card__title { font-size: 19px; margin-bottom: 20px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pay-method {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #E6F6F7;
  border: 1px solid var(--teal-light);
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
}
.pay-method__badge {
  padding: 4px 10px;
  background: var(--teal);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 12px;
}

.mini-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-block: 9px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.mini-item:last-of-type { border-bottom: 0; }
.mini-item__img {
  flex: 0 0 44px;
  width: 44px; height: 44px;
  padding: 3px;
  background: var(--surface);
  border-radius: 4px;
}
.mini-item__img img { width: 100%; height: 100%; object-fit: contain; }
.mini-item__name {
  flex: 1 1 auto;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.mini-item__qty { color: var(--muted); white-space: nowrap; }

/* --- order success --------------------------------------------------------- */

.success {
  max-width: 640px;
  margin: 48px auto;
  padding: 40px 28px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.success__icon {
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  background: #E7F7EE;
  color: #1B8A4B;
  border-radius: 50%;
  font-size: 36px;
}
.success__title { font-size: 24px; margin-bottom: 10px; }
.success__order {
  display: inline-block;
  margin-block: 14px 20px;
  padding: 10px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 700;
  direction: ltr;
}
.success__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ==========================================================================
   MODAL  (product image lightbox)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(30, 42, 46, .55);
  overflow-y: auto;
}
.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.modal__title { margin: 0; font-size: 19px; }
.modal__close {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}
.modal__close:hover { background: var(--surface); color: var(--ink); }
.modal__foot {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
