/* ==========================================================================
   Marketplace stylesheet
   Written with logical properties (inline-start/end) so the same file works
   for the Arabic RTL layout and the English LTR one with no overrides.
   ========================================================================== */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --line: #e6e8ef;
  --ink: #16192a;
  --ink-soft: #6b7186;
  --brand: #4b39d8;
  --brand-dark: #3a2bb0;
  --brand-soft: #eeebff;
  --ok: #12855c;
  --ok-soft: #e3f7ee;
  --warn: #a86a00;
  --warn-soft: #fdf1dc;
  --bad: #c02a37;
  --bad-soft: #fde8ea;
  --info: #1663a8;
  --info-soft: #e4f0fb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 24, 48, .06), 0 8px 24px rgba(20, 24, 48, .05);
  --font: 'Cairo', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html[dir="ltr"] { --font: 'Inter', 'Cairo', system-ui, sans-serif; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .6rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
img { max-width: 100%; display: block; }
code { background: var(--brand-soft); padding: .1em .4em; border-radius: 5px; font-size: .9em; }
s { opacity: .65; }

.container { max-width: 1200px; margin-inline: auto; padding-inline: 20px; }
.page { padding-block: 26px 60px; }
.muted { color: var(--ink-soft); }
.small { font-size: .82rem; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------------------ header */
.site-header {
  background: var(--surface);
  border-block-end: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  flex-wrap: wrap;
  padding-block: 8px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; align-items: center; line-height: 0; }
.brand-mark svg { display: block; filter: drop-shadow(0 2px 5px rgba(84, 66, 214, .35)); }
.brand-name { font-size: 1.05rem; }

.search { display: flex; flex: 1; min-width: 220px; max-width: 520px; }
.search input {
  flex: 1;
  border: 1px solid var(--line);
  border-start-start-radius: var(--radius-sm);
  border-end-start-radius: var(--radius-sm);
  border-inline-end: 0;
  padding: 9px 14px;
  font: inherit;
  background: var(--bg);
}
.search button {
  border: 0;
  background: var(--brand);
  color: #fff;
  padding-inline: 18px;
  border-start-end-radius: var(--radius-sm);
  border-end-end-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
}
.search input:focus { outline: 2px solid var(--brand); outline-offset: -2px; }

.main-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.main-nav > a { color: var(--ink); font-size: .95rem; }
.main-nav > a.active { color: var(--brand); font-weight: 600; }
.cart-link { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.badge-count {
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  font-size: .72rem;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding-inline: 5px;
}
.lang-switch { font-size: .85rem; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; color: var(--ink-soft); }

.menu { position: relative; }
.menu-btn { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.menu-list {
  position: absolute;
  inset-block-start: calc(100% + 6px);
  inset-inline-end: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 190px;
  padding: 6px;
  display: none;
  z-index: 50;
}
.menu.open .menu-list { display: block; }
.menu-list a, .menu-list button {
  display: block;
  width: 100%;
  text-align: start;
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--ink);
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.menu-list a:hover, .menu-list button:hover { background: var(--bg); text-decoration: none; }

/* ------------------------------------------------------------------ shared */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-block-end: 18px;
}
.section { margin-block: 34px; }
.section-title { margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-block-end: 14px; gap: 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-block-end: 18px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.empty { color: var(--ink-soft); padding: 26px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-state { text-align: center; padding: 50px 20px; }
.empty-state.big { padding: 80px 20px; }
.block-link { display: block; text-align: center; margin-block-start: 10px; }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--brand);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn:disabled { background: #c7c9d6; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: .85rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #9c1f2b; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 1rem; padding: 4px; border-radius: 6px; }
.icon-btn:hover { background: var(--bad-soft); }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }
.link-btn.danger { color: var(--bad); }

/* forms */
label { display: block; margin-block-end: 12px; font-size: .9rem; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="date"], input[type="datetime-local"], input[type="file"],
select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font: inherit;
  font-weight: 400;
  background: var(--surface);
  color: var(--ink);
  margin-block-start: 5px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
input:disabled { background: var(--bg); color: var(--ink-soft); }
textarea { resize: vertical; }
input.tiny { width: 84px; display: inline-block; margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: auto; margin: 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-block-end: 14px; }
legend { padding-inline: 6px; font-weight: 700; font-size: .9rem; }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-block-end: 16px;
}
.toolbar input, .toolbar select { width: auto; min-width: 140px; margin: 0; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select, .inline-form input { margin: 0; width: auto; }
.inline-details summary { cursor: pointer; font-size: .82rem; color: var(--ink-soft); }
.inline-details form { margin-block-start: 6px; display: flex; gap: 6px; flex-wrap: wrap; max-width: 240px; }
.inline-details form p { margin: 0 0 4px; flex-basis: 100%; }
.inline-details form input[type="text"] { flex: 1; min-width: 110px; }
.inline-details input { margin: 0; }

/* flash + notices */
.flash-stack { margin-block-end: 16px; display: grid; gap: 8px; }
.flash {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 16px; border-radius: var(--radius-sm); font-weight: 600;
}
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.flash-close { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: inherit; }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); margin-block-end: 16px; }
.notice-success { background: var(--ok-soft); color: var(--ok); }
.notice-error { background: var(--bad-soft); color: var(--bad); }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice.big { padding: 22px; text-align: center; }
.error-text { color: var(--bad); font-size: .85rem; }

/* badges */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--bg); color: var(--ink-soft); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 11px 14px; text-align: start; border-block-end: 1px solid var(--line); vertical-align: middle; }
.table th { background: var(--bg); font-size: .8rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .02em; }
.table tbody tr:last-child td { border-block-end: 0; }
.table.compact th, .table.compact td { padding: 7px 10px; }
.table .actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.thumb-cell img { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; }

/* pagination */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-block: 22px; flex-wrap: wrap; }
.pagination a {
  min-width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink);
}
.pagination a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination a:hover { text-decoration: none; border-color: var(--brand); }

/* ------------------------------------------------------------------- shop */
.hero {
  background: linear-gradient(120deg, var(--brand) 0%, #7a5cf0 100%);
  color: #fff;
  border-radius: 22px;
  padding: 54px 34px;
  margin-block-start: 8px;
}
.hero h1 { font-size: 2.2rem; margin-block-end: .3rem; }
.hero p { margin: 0 0 22px; opacity: .92; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn { background: #fff; color: var(--brand); }
.hero .btn:hover { background: #f0edff; color: var(--brand); }
.hero .btn-ghost { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.5); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.24); color: #fff; }

.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 16px; color: var(--ink); display: inline-flex; gap: 7px; align-items: center;
}
.chip:hover { border-color: var(--brand); text-decoration: none; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; }
.product-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .16s ease, transform .16s ease;
}
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.product-thumb {
  position: relative; aspect-ratio: 1 / 1; background: linear-gradient(145deg, #ece9fb, #f7f6fd);
  display: grid; place-items: center; overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback { font-size: 2.4rem; }
.thumb-fallback.big { font-size: 5rem; }
.tag {
  position: absolute; inset-block-start: 9px; inset-inline-start: 9px;
  background: var(--bad); color: #fff; font-size: .74rem; font-weight: 700;
  padding: 2px 9px; border-radius: 999px;
}
.tag-out { background: #45495e; inset-inline-start: auto; inset-inline-end: 9px; }
.product-body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.product-name { color: var(--ink); font-weight: 600; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.product-store { font-size: .8rem; }
.product-price { display: flex; align-items: baseline; gap: 8px; margin-block-start: auto; padding-block-start: 6px; }
.product-price strong { font-size: 1.08rem; color: var(--brand); letter-spacing: -.01em; }
.product-price s { font-size: .82rem; }
.add-to-cart { margin-block-start: 8px; }

.stars { white-space: nowrap; font-size: .85rem; }
.stars .on { color: #e6a700; }
.stars .off { color: #d3d6e0; }

.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.store-card {
  display: flex; gap: 12px; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: var(--ink);
}
.store-card:hover { border-color: var(--brand); text-decoration: none; }
.store-logo {
  width: 52px; height: 52px; border-radius: 12px; background: var(--brand-soft);
  display: grid; place-items: center; font-size: 1.5rem; overflow: hidden; flex: none;
}
.store-logo img { width: 100%; height: 100%; object-fit: cover; }
.store-logo.big { width: 80px; height: 80px; font-size: 2rem; }
.store-head { display: flex; gap: 16px; align-items: center; margin-block-end: 16px; }
.store-banner { display: flex; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-block-end: 18px; }

/* listing */
.listing { display: grid; grid-template-columns: 250px 1fr; gap: 22px; align-items: start; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 80px; }
.filter-block { margin-block-end: 16px; }
.filter-label { display: block; font-weight: 700; font-size: .85rem; margin-block-end: 4px; }
.cat-list, .cat-sub { list-style: none; padding: 0; margin: 0; }
.cat-list > li { margin-block-end: 5px; }
.cat-sub { padding-inline-start: 14px; }
.cat-list a { color: var(--ink); font-size: .9rem; }
.cat-list a.active { color: var(--brand); font-weight: 700; }
.listing-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-block-end: 14px; flex-wrap: wrap; }
.breadcrumb { font-size: .85rem; margin-block-end: 14px; }

/* product detail */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.gallery-main {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 8px; margin-block-start: 10px; flex-wrap: wrap; }
.gallery-thumb { width: 66px; height: 66px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); cursor: pointer; padding: 0; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-meta { display: flex; align-items: center; gap: 8px; }
.price-box { display: flex; align-items: baseline; gap: 12px; margin-block: 14px; }
.price-now { font-size: 1.9rem; font-weight: 700; color: var(--brand); }
.buy-form { display: flex; gap: 10px; align-items: center; margin-block: 18px; }
.buy-form input { width: 90px; margin: 0; }
.prose { border-block-start: 1px solid var(--line); padding-block-start: 14px; }

.rating-bars { display: grid; gap: 5px; max-width: 340px; margin-block-end: 18px; }
.rating-bar { display: grid; grid-template-columns: 40px 1fr 34px; gap: 8px; align-items: center; font-size: .82rem; }
.rating-bar .bar { background: var(--bg); border-radius: 999px; height: 8px; overflow: hidden; }
.rating-bar .bar span { display: block; height: 100%; background: #e6a700; }

.review-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.review, .review-admin { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.review-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-block-end: 6px; }
.review-reply { background: var(--bg); border-radius: var(--radius-sm); padding: 8px 12px; margin-block-start: 8px; font-size: .9rem; }
.review-form { max-width: 480px; }
.reply-form { display: flex; gap: 8px; margin-block-start: 8px; }
.reply-form input { margin: 0; }
.inline-review { margin-block-start: 8px; }
.inline-review summary { cursor: pointer; color: var(--brand); font-size: .88rem; }

/* cart + checkout */
.cart-layout, .checkout-layout { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; align-items: start; }
.cart-items { display: grid; gap: 12px; }
.cart-row {
  display: grid; grid-template-columns: 76px 1fr auto auto auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.cart-row.is-dead { opacity: .6; }
.cart-thumb { width: 76px; height: 76px; border-radius: 10px; background: var(--bg); display: grid; place-items: center; overflow: hidden; font-size: 1.6rem; }
.cart-thumb.small { width: 54px; height: 54px; font-size: 1.2rem; }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-name { font-weight: 600; color: var(--ink); }
.cart-qty { display: flex; gap: 6px; align-items: center; }
.cart-qty input { width: 74px; margin: 0; }
.cart-line-total { font-weight: 700; white-space: nowrap; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding-block: 6px; border-block-end: 1px dashed var(--line); }
.sum-row.total { border-block-end: 0; font-size: 1.1rem; padding-block-start: 12px; }
.sum-row.ok strong { color: var(--ok); }
.coupon-form { display: flex; gap: 8px; margin-block: 12px; }
.coupon-form input { margin: 0; }
.coupon-applied { display: flex; justify-content: space-between; align-items: center; background: var(--ok-soft); color: var(--ok); border-radius: var(--radius-sm); padding: 8px 12px; margin-block: 12px; font-weight: 600; }
.mini-items { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; font-size: .88rem; }
.mini-items li { display: flex; justify-content: space-between; gap: 10px; }
.mini-name { color: var(--ink-soft); }
.address-choices { display: grid; gap: 8px; margin-block-end: 14px; }
.address-choice, .pay-choice {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 14px; cursor: pointer; font-weight: 400;
}
.address-choice input, .pay-choice input { width: auto; margin: 4px 0 0; }
.address-choice:has(input:checked), .pay-choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.address-card { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pay-box { background: var(--brand-soft); border-radius: var(--radius-sm); padding: 14px; margin-block: 12px; }
.pay-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-block-end: 6px; }
.pay-target { font-weight: 700; letter-spacing: .04em; font-family: 'Inter', monospace; direction: ltr; unicode-bidi: isolate; }
.pay-target.big, .pay-line .big { font-size: 1.15rem; }
.pay-choice .block { display: block; }
.transfer-form { margin-block-start: 12px; }
.transfer-form summary { cursor: pointer; font-weight: 700; color: var(--brand); margin-block-end: 8px; }
.receipt-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

.sum-row.bad-row strong { color: var(--bad); }
.settle-form { margin: 0; }
.settle-lines { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.order-line { display: flex; gap: 12px; align-items: flex-start; padding-block: 12px; border-block-end: 1px solid var(--line); }
.order-line:last-child { border-block-end: 0; }
.line-total { font-weight: 700; white-space: nowrap; }

/* auth */
.auth-card { max-width: 440px; margin-inline: auto; margin-block-start: 30px; }
.auth-card.wide { max-width: 620px; }
.role-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-block-end: 16px; }
.role-option { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center; cursor: pointer; font-weight: 600; margin: 0; }
.role-option input { display: none; }
.role-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* --------------------------------------------------------------- panels */
.panel-shell { display: grid; grid-template-columns: 235px 1fr; gap: 22px; max-width: 1400px; margin-inline: auto; padding: 22px 20px 60px; align-items: start; }
.panel-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; top: 80px; }
.panel-title { font-weight: 700; font-size: .82rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin: 10px 6px 6px; display: flex; flex-direction: column; }
.panel-side nav { display: grid; gap: 2px; }
.panel-side nav a { padding: 8px 11px; border-radius: 9px; color: var(--ink); font-size: .92rem; }
.panel-side nav a:hover { background: var(--bg); text-decoration: none; }
.panel-side nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.panel-main { min-width: 0; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-block-end: 18px; }
.stat { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 15px; }
.stat-label { font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-value.ok { color: var(--ok); }
.stat-value.bad { color: var(--bad); }

.alert-row { display: flex; gap: 12px; flex-wrap: wrap; margin-block-end: 18px; }
.alert-card { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 16px; font-weight: 600; }
.alert-card:hover { text-decoration: none; filter: brightness(.97); }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-block-start: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.bar-fill { width: 100%; background: linear-gradient(180deg, #7a5cf0, var(--brand)); border-radius: 7px 7px 0 0; min-height: 4px; }
.bar-label { font-size: .72rem; color: var(--ink-soft); }

.image-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-block-end: 14px; }
.image-item { width: 120px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.image-item.primary { border-color: var(--brand); }
.image-item img { width: 100%; height: 100px; object-fit: cover; }
.image-actions { display: flex; justify-content: space-between; gap: 6px; padding: 6px; font-size: .78rem; }
.preview-strip:empty { display: none; }
.preview-strip .image-item { border-style: dashed; }
.preview-strip .image-actions { justify-content: center; color: var(--ink-soft); }

.account-layout { display: grid; grid-template-columns: 210px 1fr; gap: 20px; align-items: start; }
.account-nav { display: grid; gap: 2px; padding: 10px; position: sticky; top: 80px; }
.account-nav a { padding: 8px 12px; border-radius: 9px; color: var(--ink); }
.account-nav a.active, .account-nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.account-main { min-width: 0; }

/* ------------------------------------------------------------------ footer */
.site-footer { background: var(--surface); border-block-start: 1px solid var(--line); margin-block-start: 40px; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-block: 26px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .two-col, .cart-layout, .checkout-layout, .product-detail { grid-template-columns: 1fr; }
  .listing, .panel-shell, .account-layout { grid-template-columns: 1fr; }
  .filters, .panel-side, .account-nav { position: static; }
  .panel-side nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
}
@media (max-width: 640px) {
  .row-2, .row-3, .role-switch { grid-template-columns: 1fr; }
  .cart-row { grid-template-columns: 64px 1fr; grid-template-areas: none; }
  .hero { padding: 34px 22px; }
  .hero h1 { font-size: 1.6rem; }
  .header-inner { gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
}


/* ==========================================================================
   About & contact pages
   ========================================================================== */

.about-hero { margin-block-end: 8px; }
.two-col.even { grid-template-columns: 1fr 1fr; }

/* Numbered "how it works" list with a real numeral badge. */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding-inline-start: 38px;
  padding-block: 8px;
  border-block-end: 1px dashed var(--line);
}
.steps li:last-child { border-block-end: 0; }
.steps li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: .82rem;
  display: grid;
  place-items: center;
}

.value-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.value-card { margin: 0; }
.value-card h3 { margin-block: 8px 6px; }
.value-icon { font-size: 1.9rem; display: block; }

.cta-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, var(--brand) 0%, #7a5cf0 100%);
  color: #fff;
  border-radius: 22px;
  padding: 30px 34px;
  margin-block: 34px 10px;
}
.cta-band h2 { margin: 0 0 .3rem; }
.cta-band p { margin: 0; opacity: .92; }
.cta-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cta-band .btn { background: #fff; color: var(--brand); }
.cta-band .btn:hover { background: #f0edff; color: var(--brand); }
.cta-band .btn-ghost { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .5); }
.cta-band .btn-ghost:hover { background: rgba(255, 255, 255, .24); color: #fff; }

.contact-line { display: flex; gap: 12px; align-items: flex-start; padding-block: 10px; border-block-end: 1px dashed var(--line); }
.contact-line:last-of-type { border-block-end: 0; }
.contact-icon { font-size: 1.15rem; width: 26px; text-align: center; flex: none; }
.social-row { display: flex; gap: 8px; margin-block-start: 12px; }

.faq { border-block-end: 1px dashed var(--line); padding-block: 10px; }
.faq:last-child { border-block-end: 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; }

/* Contact inbox */
.message-card { border-inline-start: 4px solid transparent; }
.message-card.is-new { border-inline-start-color: var(--brand); background: #fcfcff; }
.message-body { white-space: pre-wrap; margin-block: 10px; }

@media (max-width: 980px) {
  .two-col.even { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Motion & polish
   Every animation here is decorative: the page is fully usable with motion
   off, and the whole block is disabled under prefers-reduced-motion at the
   bottom of this file.
   ========================================================================== */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes popIn {
  0%   { transform: scale(.6); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes growUp {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}
@keyframes driftA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(24px, -18px) scale(1.12); }
}
@keyframes driftB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-30px, 20px) scale(.9); }
}
@keyframes shine {
  from { transform: translateX(-120%); }
  to   { transform: translateX(220%); }
}
@keyframes softPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* ------------------------------------------------------------ page entry */
.page > *, .panel-main > * { animation: fadeUp .45s ease both; }
.site-header { animation: slideDown .4s ease both; }

/* Grid children come in one after the other, capped so a 60-product page
   does not spend three seconds animating. */
.product-grid > *:nth-child(1)  { animation-delay: .02s; }
.product-grid > *:nth-child(2)  { animation-delay: .05s; }
.product-grid > *:nth-child(3)  { animation-delay: .08s; }
.product-grid > *:nth-child(4)  { animation-delay: .11s; }
.product-grid > *:nth-child(5)  { animation-delay: .14s; }
.product-grid > *:nth-child(6)  { animation-delay: .17s; }
.stat-row > *:nth-child(1) { animation-delay: .04s; }
.stat-row > *:nth-child(2) { animation-delay: .09s; }
.stat-row > *:nth-child(3) { animation-delay: .14s; }
.stat-row > *:nth-child(4) { animation-delay: .19s; }
.stat-row > *:nth-child(5) { animation-delay: .24s; }
.stat-row > *:nth-child(6) { animation-delay: .29s; }

/* Anything further down the page waits until it is scrolled into view.
   The hidden state is applied only when JS is running, so with scripts off
   every card is simply visible. */
.js .reveal { opacity: 0; transform: translateY(18px); }
.js .reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .5s ease, transform .5s cubic-bezier(.2, .7, .3, 1);
}

/* ------------------------------------------------------------------ hero */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, #4b39d8 0%, #7a5cf0 45%, #9b6ef3 100%);
  background-size: 180% 180%;
  animation: fadeUp .5s ease both, heroShift 18s ease-in-out infinite;
}
@keyframes heroShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
/* Two soft blobs drifting behind the text. */
.hero::before, .hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.hero::before {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,.17) 0%, rgba(255,255,255,0) 70%);
  inset-block-start: -80px; inset-inline-start: -60px;
  animation: driftA 22s ease-in-out infinite;
}
.hero::after {
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,.13) 0%, rgba(255,255,255,0) 70%);
  inset-block-end: -90px; inset-inline-end: 8%;
  animation: driftB 26s ease-in-out infinite;
}
.hero-text { position: relative; z-index: 1; }
.hero h1 { animation: fadeUp .55s .05s ease both; }
.hero p { animation: fadeUp .55s .14s ease both; }
.hero-actions { animation: fadeUp .55s .22s ease both; }

/* --------------------------------------------------------- product cards */
.product-card { transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease; }
.product-card:hover { transform: translateY(-4px); border-color: #d7d2ff; }
.product-thumb img { transition: transform .45s cubic-bezier(.2, .7, .3, 1); }
.product-card:hover .product-thumb img { transform: scale(1.07); }
.product-card:hover .product-name { color: var(--brand); }
.product-name { transition: color .2s ease; }
.tag-sale { animation: popIn .4s .2s ease both; }

/* A light sweep across the button on hover - just enough to feel alive. */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28), transparent);
  transform: translateX(-120%);
  pointer-events: none;
}
.btn:hover::after { animation: shine .7s ease; }
.btn:active { transform: translateY(1px); }
.btn-ghost::after { display: none; }

/* Feedback while an "add to cart" form is submitting. */
.btn.is-busy { pointer-events: none; opacity: .75; }
.btn.is-done { background: var(--ok); }

/* ------------------------------------------------------------- chrome */
.site-header { transition: box-shadow .25s ease; }
.site-header.is-stuck { box-shadow: 0 6px 20px rgba(20, 24, 48, .08); }

.badge-count { transition: transform .2s ease; }
.badge-count.is-bumped { animation: popIn .45s ease; }

.flash { animation: slideDown .35s ease both; }
.chip { transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.chip:hover { transform: translateY(-2px); }
.store-card { transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.store-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

/* A tinted accent per category chip so the row is not eight grey pills. */
.chips .chip:nth-child(8n+1) { background: #eef0ff; }
.chips .chip:nth-child(8n+2) { background: #eafaf3; }
.chips .chip:nth-child(8n+3) { background: #fff3e6; }
.chips .chip:nth-child(8n+4) { background: #fdecef; }
.chips .chip:nth-child(8n+5) { background: #eaf4ff; }
.chips .chip:nth-child(8n+6) { background: #f6ecff; }
.chips .chip:nth-child(8n+7) { background: #eafbf8; }
.chips .chip:nth-child(8n+8) { background: #fff7e0; }

/* Accent bar before every section heading. */
.section-title { position: relative; padding-inline-start: 12px; }
.section-title::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  inset-block: .18em .18em;
  width: 4px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--brand), #9b6ef3);
}

/* Table rows lift very slightly on hover so long lists stay readable. */
.table tbody tr { transition: background .15s ease; }
.table tbody tr:hover { background: #fafbff; }

/* ------------------------------------------------------------ dashboards */
.bar-fill {
  transform-origin: bottom;
  animation: growUp .7s cubic-bezier(.2, .8, .3, 1) both;
}
.bars .bar-col:nth-child(1) .bar-fill { animation-delay: .05s; }
.bars .bar-col:nth-child(2) .bar-fill { animation-delay: .11s; }
.bars .bar-col:nth-child(3) .bar-fill { animation-delay: .17s; }
.bars .bar-col:nth-child(4) .bar-fill { animation-delay: .23s; }
.bars .bar-col:nth-child(5) .bar-fill { animation-delay: .29s; }
.bars .bar-col:nth-child(6) .bar-fill { animation-delay: .35s; }
.bars .bar-col:nth-child(7) .bar-fill { animation-delay: .41s; }
.bar-col { transition: opacity .2s ease; }
.bars:hover .bar-col { opacity: .55; }
.bars .bar-col:hover { opacity: 1; }

.stat { transition: transform .2s ease, box-shadow .2s ease; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.alert-card { animation: softPulse 2.4s ease-in-out 3; }
.alert-card:hover { animation-play-state: paused; }

/* ------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}



/* ---------- Phase 1: homepage + filters + product page additions ---------- */
.announce-bar {
  background: linear-gradient(90deg, var(--primary, #1a56db), #0e9f6e);
  color: #fff; text-align: center; font-size: .85rem; font-weight: 600;
  padding: .45rem 1rem; border-radius: 8px; margin-bottom: 1rem;
  display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap;
}
.announce-sep { opacity: .7; }
.flash-deals .section-title { color: #c81e1e; }
.flash-deals .product-card { border: 1px solid #fca5a5; }

.variant-chips { display: flex; gap: .45rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.variant-chips .chip-active {
  border: 2px solid var(--primary, #1a56db); font-weight: 700; padding: .3rem .8rem;
  border-radius: 999px; font-size: .85rem; cursor: default;
}
.variant-chips a.chip { text-decoration: none; }

.specs-card { margin-top: 1rem; padding: 1rem 1.25rem; }
.specs-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.specs-table td { padding: .45rem .25rem; border-bottom: 1px solid rgba(0,0,0,.07); }
.specs-table tr td:first-child { color: var(--muted, #6b7280); width: 35%; }

.delivery-card { margin-top: 1rem; padding: .9rem 1.25rem; display: grid; gap: .5rem; }
.delivery-row { display: flex; gap: .55rem; align-items: center; font-size: .9rem; }

.filter-chips { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0 1rem; }
.filter-chips .chip { display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; }
.chip-x { font-size: .75rem; opacity: .7; }
.chip-clear { background: #fee2e2; color: #b91c1c; font-weight: 600; }

.brand-list a.active { font-weight: 700; color: var(--primary, #1a56db); }

/* quick add-to-cart overlay on product cards */
.product-card { position: relative; }
.quick-add {
  position: absolute; inset-inline-end: .5rem; bottom: 4.2rem; z-index: 2;
  opacity: 0; transition: opacity .15s; padding: .4rem .7rem; font-size: .8rem;
}
.product-card:hover .quick-add { opacity: 1; }

/* search suggestions */
.search-wrap { position: relative; }
.search-suggest {
  position: absolute; top: 100%; inset-inline: 0; z-index: 50;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; margin-top: .3rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); overflow: hidden; display: none;
}
.search-suggest.open { display: block; }
.search-suggest a { display: flex; gap: .6rem; align-items: center; padding: .55rem .8rem; text-decoration: none; color: inherit; }
.search-suggest a:hover { background: #f3f4f6; }
.search-suggest img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.search-suggest .s-name { font-size: .88rem; }
.search-suggest .s-price { margin-inline-start: auto; font-size: .8rem; color: var(--muted, #6b7280); }
