/* Chair & Table — نظام التصميم
   الألوان والخطوط مطابقة لملف التصميم المعتمد */
:root {
  --ink: #14100F;
  --brand: #8E1616;
  --brand-dark: #6E1010;
  --sand: #F7F4F1;
  --line: #E5DDD7;
  --line-soft: #F0EAE5;
  --muted: #6B625C;
  --muted-2: #9A918B;
  --white: #fff;
  --green: #2E7D32;
  --max: 1280px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font-family: 'Almarai', 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-weight: 800; text-wrap: pretty; }
input, select, textarea, button { font-family: inherit; }
::selection { background: var(--brand); color: #fff; }

.wrap { max-width: var(--max); margin: 0 auto; padding-inline: 24px; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.kicker { font-size: 12px; font-weight: 800; letter-spacing: .16em; color: var(--brand); }
.section { padding-block: 56px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-head h2 { font-size: 32px; margin-top: 8px; }

/* أزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; font-size: 15px; font-weight: 700; padding: 14px 28px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { color: #fff; opacity: .9; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* حقول */
.field { border: 1px solid var(--line); background: #fff; padding: 12px 14px; font-size: 14px; outline: none; width: 100%; }
.field:focus { border-color: var(--brand); }
label.lbl { font-size: 13px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 7px; }
.error { color: var(--brand); font-size: 13px; margin-top: 6px; }
.alert { background: #F2F7F2; border: 1px solid #CADFCA; color: var(--green); padding: 13px 16px; font-size: 14px; font-weight: 700; margin-bottom: 18px; }

/* الشريط العلوي والهيدر */
.topbar { background: var(--ink); color: #CFC6BF; font-size: 13px; }
.topbar a { color: #CFC6BF; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 9px; }
.header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.header .wrap { display: flex; align-items: center; gap: 24px; padding-block: 14px; }
.logo img { height: 56px; width: auto; mix-blend-mode: multiply; }
.search { flex: 1; min-width: 0; display: flex; border: 1px solid var(--line); background: var(--sand); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px 14px; font-size: 14px; outline: none; }
.search button { background: var(--brand); color: #fff; border: 0; padding: 12px 20px; font-size: 14px; font-weight: 700; cursor: pointer; }
.cart-btn { background: var(--ink); color: #fff; padding: 11px 16px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.cart-btn:hover { color: #fff; }
.cart-count { background: var(--brand); min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; padding-inline: 6px; }

/* القائمة */
.nav { border-top: 1px solid var(--line-soft); background: #fff; }
.nav .wrap { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { padding: 13px 14px; font-size: 14px; font-weight: 700; color: var(--ink); }
.nav a:hover, .nav a.active { color: var(--brand); }
.has-menu { position: relative; }
.menu { position: absolute; top: 100%; inset-inline-start: 0; background: #fff; border: 1px solid var(--line);
  border-top: 2px solid var(--brand); min-width: 260px; padding: 10px; box-shadow: 0 18px 40px rgba(20,16,15,.12);
  z-index: 50; display: none; }
.has-menu:hover .menu { display: block; }
.menu a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; font-weight: 400; }
.menu a:hover { background: var(--sand); }

/* الهيرو */
.hero { background: var(--ink); display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.hero-copy { padding: 82px 56px 72px; display: flex; flex-direction: column; justify-content: center; }
.hero-copy .tag { display: inline-block; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .14em; padding: 7px 14px; }
.hero-copy h1 { font-size: 52px; line-height: 1.15; color: #fff; margin: 22px 0 14px; }
.hero-copy p { font-size: 18px; line-height: 1.8; color: #D9D0CA; max-width: 520px; margin: 0 0 30px; }
.hero-media { position: relative; min-height: 460px; }
.hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-dots { display: flex; gap: 8px; margin-top: 44px; }
.hero-dots button { width: 38px; height: 4px; border: 0; padding: 0; cursor: pointer; background: rgba(255,255,255,.35); }
.hero-dots button.on { background: var(--brand); }

/* المزايا */
.perks { background: #fff; border-bottom: 1px solid var(--line); }
.perks .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding-inline: 24px; }
.perk { padding: 26px 18px; display: flex; align-items: center; gap: 14px; border-inline-end: 1px solid var(--line-soft); }
.perk .ico { width: 40px; height: 40px; flex-shrink: 0; background: var(--sand); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; }

/* الشبكات والكروت */
.grid { display: grid; gap: 16px; }
.grid-cats { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-products { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid-posts { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.card { background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; position: relative; }
.card:hover { border-color: var(--brand); }
.card .thumb { display: block; aspect-ratio: 1/1; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .cat { font-size: 11px; font-weight: 700; color: var(--muted-2); letter-spacing: .08em; }
.card .name { font-size: 15px; font-weight: 800; color: var(--ink); line-height: 1.5; }
.card .price { font-size: 18px; font-weight: 800; color: var(--brand); }
.card .old { font-size: 13px; color: var(--muted-2); text-decoration: line-through; }
.card .actions { display: flex; gap: 8px; }
.badge-sale { position: absolute; top: 10px; inset-inline-start: 10px; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 800; padding: 4px 9px; z-index: 2; }

.cat-tile { background: #fff; border: 1px solid var(--line); display: block; }
.cat-tile:hover { border-color: var(--brand); }
.cat-tile img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.cat-tile .body { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; }

/* بانر الشركات */
.b2b { background: var(--ink); color: #fff; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: center; }
.b2b .copy { padding: 52px 44px; }
.b2b h3 { font-size: 30px; line-height: 1.3; margin: 12px 0 14px; }
.b2b p { font-size: 16px; line-height: 1.8; color: #D9D0CA; margin: 0 0 26px; }
.b2b img { width: 100%; height: 100%; min-height: 280px; object-fit: cover; }

/* صفحة القسم */
.catalog { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .catalog { grid-template-columns: 1fr; } }
.panel { background: #fff; border: 1px solid var(--line); padding: 20px; }
.filter-title { font-size: 13px; font-weight: 800; color: var(--muted); margin: 22px 0 10px; }
.filter-link { font-size: 14px; padding: 7px 10px; display: flex; justify-content: space-between; gap: 8px; color: var(--ink); }
.filter-link.on { color: var(--brand); background: var(--sand); }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; padding: 7px 12px; cursor: pointer; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.toolbar { background: #fff; border: 1px solid var(--line); padding: 12px 16px; display: flex;
  align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }

/* صفحة المنتج */
.product { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 36px; align-items: start; }
.gallery-main { background: #fff; border: 1px solid var(--line); aspect-ratio: 1/1; overflow: hidden; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.thumbs button { border: 1px solid var(--line); background: #fff; padding: 0; cursor: pointer; aspect-ratio: 1/1; overflow: hidden; }
.thumbs button.on { border-color: var(--brand); }
.qty { display: flex; align-items: center; border: 1px solid var(--line); background: #fff; }
.qty button { width: 44px; height: 48px; border: 0; background: transparent; font-size: 18px; cursor: pointer; }
.qty input { width: 52px; text-align: center; font-size: 16px; font-weight: 800; border: 0; outline: none; }
.specs { border: 1px solid var(--line); background: #fff; }
.specs div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }

/* السلة والتشيك أوت */
.cart-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .cart-layout { grid-template-columns: 1fr; } }
.cart-row { display: flex; gap: 16px; padding: 16px; border-bottom: 1px solid var(--line-soft); align-items: center; }
.cart-row img { width: 88px; height: 88px; object-fit: cover; border: 1px solid var(--line); }
.sum-row { display: flex; justify-content: space-between; font-size: 14px; padding: 8px 0; color: var(--muted); }
.sum-row b { color: var(--ink); }
.sum-total { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 14px; display: flex;
  justify-content: space-between; font-size: 19px; font-weight: 800; }
.pay-option { display: flex; align-items: center; gap: 14px; text-align: start; border: 1px solid var(--line);
  background: #fff; padding: 14px 16px; cursor: pointer; width: 100%; }
.pay-option.on { border-color: var(--brand); background: #FBF6F5; }
.pay-option .dot { width: 18px; height: 18px; border-radius: 50%; border: 5px solid #D8D0CA; flex-shrink: 0; }
.pay-option.on .dot { border-color: var(--brand); }

/* تتبع الطلب */
.timeline-step { display: flex; gap: 16px; align-items: flex-start; }
.timeline-step .rail { display: flex; flex-direction: column; align-items: center; align-self: stretch; }
.timeline-step .dot { width: 14px; height: 14px; background: #DCD4CE; }
.timeline-step .line { width: 2px; flex: 1; background: var(--line-soft); min-height: 34px; }
.timeline-step.done .dot { background: var(--brand); }
.timeline-step.done .line { background: var(--brand); }

/* الفوتر */
.footer { background: var(--ink); color: #CFC6BF; }
.footer a { color: #CFC6BF; }
.footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 36px; padding-block: 56px 28px; }
.footer h4 { color: #fff; font-size: 15px; font-weight: 800; margin: 0 0 14px; }
.footer .bottom { border-top: 1px solid #2A2321; }
.footer .bottom .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 18px; font-size: 13px; }

/* واتساب عائم ومودالات */
.fab { position: fixed; inset-block-end: 24px; inset-inline-end: 24px; width: 56px; height: 56px; border-radius: 50%;
  background: #25D366; color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 26px; z-index: 70; box-shadow: 0 10px 24px rgba(20,16,15,.25); }
.fab:hover { color: #fff; }
.modal-bg { position: fixed; inset: 0; background: rgba(20,16,15,.6); z-index: 80; display: flex;
  align-items: center; justify-content: center; padding: 24px; }
.modal { background: #fff; max-width: 760px; width: 100%; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
  .hero-copy { padding: 48px 24px; }
  .hero-copy h1 { font-size: 34px; }
  .section-head h2 { font-size: 24px; }
  .header .wrap { flex-wrap: wrap; }
  .search { order: 3; width: 100%; flex-basis: 100%; }
}

/* ================= MOBILE LAYER ================= */
.menu-btn { display: none; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 20px; line-height: 1;
  cursor: pointer; flex-shrink: 0; }
.filters-btn { display: none; }

@media (max-width: 860px) {
  .wrap { padding-inline: 16px; }
  .section { padding-block: 34px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
  .section-head h2 { font-size: 22px; }

  .topbar { font-size: 12px; }
  .topbar .wrap { flex-wrap: nowrap; overflow-x: auto; gap: 14px; padding-block: 7px; scrollbar-width: none; }
  .topbar .wrap::-webkit-scrollbar { display: none; }
  .topbar .row { flex-wrap: nowrap; white-space: nowrap; }

  .header .wrap { flex-wrap: wrap; gap: 10px; padding-block: 10px; }
  .menu-btn { display: inline-flex; }
  .logo { margin-inline-end: auto; }
  .logo img { height: 40px; }
  .header .row { gap: 8px; flex-wrap: nowrap; }
  .search { order: 3; width: 100%; flex-basis: 100%; }
  .search input { padding: 10px 12px; }
  .search button { padding: 10px 16px; }
  .cart-btn { padding: 10px 12px; }

  .nav { display: none; position: absolute; top: 100%; inset-inline: 0; background: #fff;
    border-top: 1px solid var(--line); box-shadow: 0 18px 40px rgba(20,16,15,.16);
    max-height: 72vh; overflow-y: auto; }
  .nav.open { display: block; }
  .nav .wrap { display: block; padding: 4px 16px 14px; }
  .nav a { display: block; padding: 13px 2px; border-bottom: 1px solid var(--line-soft); }
  .has-menu > a { padding-inline-end: 48px; }
  .sub-toggle { position: absolute; top: 3px; inset-inline-end: 0; width: 44px; height: 44px; border: 0;
    background: transparent; font-size: 20px; font-weight: 700; color: var(--muted); cursor: pointer; }
  .menu { position: static; display: none; border: 0; box-shadow: none; min-width: 0;
    padding: 0 0 6px; background: var(--sand); }
  .has-menu:hover .menu { display: none; }
  .has-menu.open .menu { display: block; }
  .menu a { padding: 11px 14px; }

  .hero-copy { padding: 36px 16px 30px; }
  .hero-copy h1 { font-size: 30px; }
  .hero-copy p { font-size: 15px; line-height: 1.75; margin-bottom: 22px; }
  .hero-media { min-height: 260px; }
  .hero-dots { margin-top: 26px; }

  .perks .wrap { padding-inline: 16px; }
  .perk { border-inline-end: 0; border-bottom: 1px solid var(--line-soft); padding: 16px 2px; }

  .grid { gap: 10px; }
  .grid-products, .grid-small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cats, .grid-posts { grid-template-columns: 1fr; }
  .card .body { padding: 10px 12px 12px; gap: 6px; }
  .card .name { font-size: 14px; line-height: 1.45; }
  .card .price { font-size: 15px; }
  .card .actions .btn { padding: 9px 10px; font-size: 12px; }
  .cat-tile img { aspect-ratio: 16/10; }

  .b2b .copy { padding: 32px 16px; }
  .b2b h3 { font-size: 22px; }
  .b2b p { font-size: 15px; }
  .b2b img { min-height: 200px; }

  .filters-btn { display: block; margin-bottom: 12px; }
  .catalog > .is-filters { display: none; }
  .catalog > .is-filters.open { display: block; }
  .toolbar { padding: 10px 12px; gap: 10px; }

  .product { gap: 22px; }
  .qty button { width: 40px; height: 44px; }
  .specs div { padding: 11px 14px; font-size: 13px; }

  .cart-row { padding: 12px 0; gap: 12px; }
  .cart-row img { width: 64px; height: 64px; }
  .sum-total { font-size: 17px; }

  .footer .cols { grid-template-columns: 1fr; gap: 26px; padding-block: 34px 20px; }
  .fab { width: 52px; height: 52px; font-size: 23px; inset-block-end: 16px; inset-inline-end: 16px; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; overflow-y: auto; }
}

@media (max-width: 420px) {
  .hero-copy h1 { font-size: 26px; }
  .btn { padding: 12px 18px; font-size: 14px; }
  .card .actions { flex-wrap: wrap; }
}

@media (max-width: 620px) {
  .cart-row { flex-wrap: wrap; row-gap: 10px; align-items: center; }
  .cart-row > :nth-child(2) { flex: 1 1 calc(100% - 76px); min-width: 0; }
  .cart-row > :nth-child(4) { margin-inline-start: auto; }
}

@media (max-width: 620px) {
  .cart-row > :nth-child(2) { flex: 1 1 calc(100% - 76px) !important; }
}

@media (max-width: 860px) {
  .modal-bg::before { content: '\2715'; position: fixed; top: 10px; inset-inline-end: 14px;
    width: 42px; height: 42px; border-radius: 50%; background: rgba(20,16,15,.65); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 20px; z-index: 2; }
  .modal { max-height: 88vh; }
}

.sub-toggle { display: none; }
@media (max-width: 860px) {
  .sub-toggle { display: block; }
}

/* nav: one line on desktop */
@media (min-width: 861px) {
  .nav .wrap { flex-wrap: nowrap; justify-content: space-between; gap: 0; }
  .nav a { padding: 13px 6px; font-size: 13.5px; white-space: nowrap; }
}
