/* Moda Store: mobile first. Nothing wider than 390px is fixed outside a media query. */
:root { --ink: #1d1d1f; --muted: #6b6b70; --line: #e4e4e7; --bg: #fff; --soft: #f6f5f3; --accent: #8a1c4a; --accent-ink: #fff; --warn: #b3261e; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Naskh Arabic", Tahoma, Arial, sans-serif; }
[hidden] { display: none !important; }
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
h1 { font-size: 1.4rem; margin: 1rem 0 .5rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }

.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 1.25rem; text-decoration: none; color: var(--accent); }
.top nav { display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; font-size: .95rem; }
.top nav a { text-decoration: none; }
.count { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 1em; background: var(--accent); color: var(--accent-ink); text-align: center; font-size: .8rem; }
main { padding: 0 1rem 2rem; }
footer { padding: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; text-align: center; }

.chips { display: flex; gap: .5rem; overflow-x: auto; padding: .75rem 0; }
.chips a { white-space: nowrap; padding: .35rem .8rem; border: 1px solid var(--line); border-radius: 2rem; text-decoration: none; background: var(--soft); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.card { display: flex; flex-direction: column; gap: .25rem; text-decoration: none; }
.card img { aspect-ratio: 3 / 4; object-fit: cover; background: var(--soft); border-radius: .5rem; }
.card-name { font-size: .95rem; }
.card-price { font-weight: 600; }
.card-price del { color: var(--muted); font-weight: 400; margin-inline-start: .25rem; }
.card-sold, .soldout, .warn { color: var(--warn); font-weight: 600; }
.pager { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; }

.product { display: grid; gap: 1rem; }
.gallery img#main-photo { border-radius: .5rem; background: var(--soft); }
.thumbs { display: flex; gap: .5rem; overflow-x: auto; padding-top: .5rem; }
.thumb { padding: 0; border: 2px solid transparent; background: none; border-radius: .4rem; cursor: pointer; flex: 0 0 auto; }
.thumb img { width: 64px; height: 80px; object-fit: cover; border-radius: .3rem; }
.thumb.on { border-color: var(--accent); }
.price { font-size: 1.3rem; font-weight: 700; }
.price del { color: var(--muted); font-weight: 400; font-size: 1rem; }
.opt-group { margin: .9rem 0; }
.opts { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.opt { min-height: 44px; min-width: 44px; padding: .4rem .9rem; border: 1px solid var(--line); background: var(--bg); border-radius: .5rem; font: inherit; cursor: pointer; color: var(--ink); }
.opt.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
input, select, textarea { font: inherit; width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--bg); color: var(--ink); }
input[type=number] { width: 5.5rem; }
.btn { display: inline-block; min-height: 46px; padding: .7rem 1.4rem; border: 0; border-radius: .6rem; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: .3rem 0; color: var(--warn); font: inherit; cursor: pointer; text-decoration: underline; }
.msg { min-height: 1.5em; color: var(--accent); }
.empty { color: var(--muted); padding: 1.5rem 0; }

.form { display: grid; gap: .4rem; margin: 1rem 0; }
.form label { font-weight: 600; margin-top: .5rem; }
.alert { border: 1px solid var(--warn); background: #fdecea; color: var(--warn); padding: .75rem 1rem; border-radius: .5rem; margin: .75rem 0; }
.lines { list-style: none; padding: 0; margin: 0; }
.line { display: grid; grid-template-columns: 64px 1fr; gap: .6rem .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); align-items: start; }
.line img { width: 64px; height: 80px; object-fit: cover; border-radius: .3rem; }
.line.bad { background: #fff8f7; }
.line-info { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.line-info small { color: var(--muted); }
.line-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.summary, .summary-lines { margin: 1rem 0; }
dl { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; margin: .75rem 0; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 600; }
.closed, .placed { text-align: center; padding: 2rem 0; }
.orderno { font-size: 1.6rem; letter-spacing: .05em; }

@media (min-width: 700px) {
  main { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem 3rem; }
  .top { padding: .9rem max(1.5rem, calc((100% - 1100px) / 2)); }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
  .product { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
  .form, .summary, #cart-lines { max-width: 640px; }
  .line { grid-template-columns: 80px 1fr auto; }
  .line img { width: 80px; height: 100px; }
  .line-actions { grid-column: auto; flex-direction: column; align-items: flex-end; }
}

/* Header search */
.search { display: flex; gap: .3rem; flex: 1 1 14rem; max-width: 22rem; }
.search input { padding: .4rem .6rem; }
.search button { padding: .4rem .8rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--soft); font: inherit; cursor: pointer; color: var(--ink); }

/* Filters on the search and category pages */
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .8rem; margin: 1rem 0; align-items: end; }
.filters label { display: grid; gap: .2rem; font-weight: 600; font-size: .9rem; }
.filters .btn { grid-column: 1 / -1; }
.pager { display: flex; gap: 1rem; justify-content: center; padding: 1rem 0; }

/* Discount code box */
.code-box { display: flex; gap: .5rem; }
.code-box input { flex: 1; }
.ok { color: #1b6e3a; font-weight: 600; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.check input { width: auto; }
.address { border-bottom: 1px solid var(--line); padding: .5rem 0 1rem; }

/* Banners: a stack without JavaScript; slider.js makes it a scroll-snap row */
.slider { display: grid; gap: .75rem; margin: 0 0 1.25rem; }
.slider .slide img { display: block; width: 100%; height: auto; border-radius: .6rem; background: var(--soft); }
.slider.on { display: flex; gap: 0; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-bottom: .25rem; }
.slider.on::-webkit-scrollbar { display: none; }
.slider.on .slide { flex: 0 0 100%; scroll-snap-align: start; }
.slider-arrow { min-width: 44px; min-height: 36px; border: 1px solid var(--line); border-radius: .5rem; background: var(--soft); font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--ink); margin-bottom: 1.25rem; }

@media (min-width: 700px) {
  .filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .filters .btn { grid-column: auto; }
}
