/* Arabic RTL storefront. System Arabic fonts only: no network dependency. */

:root {
  --primary: #4c6b3f;
  --accent: #c8a24a;
  --surface: #fbf8f2;
  --ink: #1f2421;
  --radius: 16px;
  --muted: #6b7268;
  --line: #e6e1d6;
  --shadow: 0 1px 2px rgba(31, 36, 33, .06), 0 12px 32px rgba(31, 36, 33, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: "Noto Kufi Arabic", "Cairo", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .4em; letter-spacing: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
h2 { font-size: 1.4rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 92%, white);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; }
.brand { display: flex; align-items: center; gap: .6rem; }
.brand-mark {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem;
  border-radius: 12px; background: var(--primary); color: #fff; font-weight: 700; font-size: 1.1rem;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--muted); font-size: .78rem; }
.nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; font-size: .95rem; }
.nav a { padding: .3rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.on { border-bottom-color: var(--primary); }
.cart-link { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; }
.cart-badge {
  display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem;
  border-radius: 999px; background: var(--primary); color: #fff; font-size: .75rem;
}

/* hero */
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent),
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 8%, var(--surface)), var(--surface));
  border-bottom: 1px solid var(--line);
}
.hero-inner { padding: clamp(2.5rem, 7vw, 5rem) 0; max-width: 46rem; }
.eyebrow {
  display: inline-block; margin: 0 0 1rem; padding: .3rem .8rem; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, white); color: var(--primary);
  font-size: .82rem; font-weight: 700;
}
.lede { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--muted); max-width: 34rem; }
.hero-cta { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.6rem; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.3rem; border-radius: calc(var(--radius) - 6px); border: 1px solid var(--primary);
  background: var(--primary); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-lg { padding: .9rem 1.8rem; font-size: 1.05rem; }
.btn-sm { padding: .35rem .8rem; font-size: .85rem; }

/* trust strip */
.trust { background: #fff; border-bottom: 1px solid var(--line); }
.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding: 1.1rem 0; }
.trust-grid div { display: flex; flex-direction: column; }
.trust-grid strong { font-size: .95rem; }
.trust-grid span { color: var(--muted); font-size: .85rem; }

/* sections */
.section { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.narrow { max-width: 42rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.section-head h2 { margin: 0; }

/* product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.card-art {
  display: grid; place-items: center; aspect-ratio: 1 / 1; height: auto; min-height: 9rem;
  background:
    radial-gradient(120% 120% at 80% 10%, color-mix(in srgb, var(--accent) 26%, transparent), transparent),
    color-mix(in srgb, var(--primary) 8%, white);
}
.mono {
  font-size: 3rem; font-weight: 800; line-height: 1;
  color: color-mix(in srgb, var(--primary) 55%, white);
}
.card-body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card-body form { margin-top: auto; }
.card-body h3 { font-size: 1.05rem; margin: 0; }
.badge {
  align-self: flex-start; padding: .15rem .55rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 26%, white); color: color-mix(in srgb, var(--ink) 80%, var(--accent));
  font-size: .75rem; font-weight: 700;
}
.price { font-weight: 800; margin: 0; }
.price.big { font-size: 1.6rem; }
.compare { color: var(--muted); font-weight: 400; font-size: .9em; margin-inline-start: .4rem; }
.inline { margin: 0; }

/* product page */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 1.2rem; }
.crumbs a:hover { color: var(--primary); }
.product-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.product-art {
  display: grid; place-items: center; min-height: 22rem;
  background:
    radial-gradient(120% 120% at 80% 10%, color-mix(in srgb, var(--accent) 26%, transparent), transparent),
    color-mix(in srgb, var(--primary) 8%, white);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.product-art .mono { font-size: 7rem; }
.product-info h1 { margin-top: .5rem; }
.desc { color: color-mix(in srgb, var(--ink) 80%, var(--muted)); }
.stock { font-size: .9rem; font-weight: 700; }
.stock.in { color: #2f6b3f; }
.stock.low { color: #a2621a; }
.stock.out { color: #a02b2b; }
.add-form { display: flex; align-items: end; gap: .8rem; margin: 1rem 0 1.4rem; flex-wrap: wrap; }
.add-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: inherit; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; width: 100%;
}
input[type="number"] { width: 5.5rem; }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; font-size: .92rem; color: var(--muted); }
.facts li::before { content: "✓"; color: var(--primary); font-weight: 700; margin-inline-end: .5rem; }

/* tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .8rem .9rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th { background: color-mix(in srgb, var(--primary) 6%, white); font-size: .85rem; color: var(--muted); }
.table tbody tr:last-child td { border-bottom: 0; }
.t-art { width: 3.4rem; }
.t-art .mono { font-size: 1.2rem; }
.t-total { font-weight: 700; white-space: nowrap; }
.total-row td { font-weight: 800; background: color-mix(in srgb, var(--primary) 5%, white); }
.qty-form { display: flex; gap: .4rem; align-items: center; }

/* cart */
.cart-foot { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; margin-top: 1.4rem; flex-wrap: wrap; }
.totals { min-width: 16rem; display: grid; gap: .4rem; }
.totals .row, .summary .row { display: flex; justify-content: space-between; gap: 1rem; }

/* checkout */
.checkout-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.form { display: grid; gap: .9rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.form label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 600; }
.errors { background: #fdf1f1; border: 1px solid #f0c9c9; color: #8f2020; border-radius: 10px; padding: .7rem .9rem; font-size: .9rem; }
.errors p { margin: 0; }
.cod-box { background: color-mix(in srgb, var(--primary) 7%, white); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.cod-box p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.summary { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; display: grid; gap: .5rem; }
.summary h2 { font-size: 1.05rem; margin-bottom: .3rem; }
.total-line { border-top: 1px solid var(--line); padding-top: .5rem; margin-top: .2rem; }

/* order confirmation */
.success { text-align: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem 1.5rem; margin-bottom: 1.2rem; }
.check { width: 3rem; height: 3rem; margin: 0 auto .8rem; border-radius: 999px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 1.5rem; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; display: grid; gap: .8rem; }
.panel h2 { font-size: 1.05rem; margin: 0; }

/* admin */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stats div { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; display: flex; flex-direction: column; }
.stats strong { font-size: 1.5rem; }
.stats span { color: var(--muted); font-size: .85rem; }
.pill { padding: .2rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #eef0ec; white-space: nowrap; }
.pill-new { background: #fff3d6; color: #7a5a10; }
.pill-confirmed { background: #e3eefb; color: #1f4f86; }
.pill-shipped { background: #e6f1e3; color: #2f6b3f; }
.pill-delivered { background: #dff0e4; color: #1f5b30; }
.pill-canceled { background: #f7e3e3; color: #8f2020; }
.status-form { display: flex; gap: .4rem; align-items: center; }
.status-form select { width: auto; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: #fff; margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; padding: 2rem 0 1rem; font-size: .9rem; }
.footer-grid strong { display: block; margin-bottom: .4rem; }
.footer-grid p { margin: 0 0 .3rem; color: var(--muted); }
.footer-bottom { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0 1.6rem; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }

@media (max-width: 860px) {
  .product-grid, .checkout-grid { grid-template-columns: 1fr; }
  .trust-grid, .stats, .footer-grid { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .nav { gap: .8rem; font-size: .9rem; }
  .product-art { min-height: 14rem; font-size: 6rem; }
}

/* customer photos: scaled to fit the box, never stretched or cropped */
.card-art.has-photo, .product-art.has-photo { display: block; background: #fff; padding: .55rem; }
.card-art.has-photo { height: auto; aspect-ratio: 1 / 1; }
.product-art.has-photo { min-height: 0; aspect-ratio: 4 / 3; }
.card-art.has-photo img.ph,
.product-art.has-photo img.ph {
  width: 100%; height: 100%; object-fit: contain; object-position: center;
  display: block; margin: 0 auto;
}
img.ph { display: block; max-width: 100%; }

/* hero with a customer banner */
.hero-photo-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 2rem; align-items: center; padding: clamp(1.5rem, 4vw, 3rem) 0; }
.hero-copy { max-width: 34rem; }
.hero-img { width: 100%; height: auto; max-height: 24rem; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
@media (max-width: 780px) {
  .hero-photo-grid { grid-template-columns: 1fr; }
  .hero-img { order: -1; max-height: 18rem; }
}

/* admin: products */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.admin-flash { margin: .8rem 0; padding: .7rem 1rem; border-radius: var(--radius); font-weight: 700; }
.admin-flash.ok { background: #dff0e4; color: #1f5b30; }
.admin-flash.bad { background: #f7e3e3; color: #8f2020; }
.admin-add { margin: 1.2rem 0 2rem; }
.admin-add > summary { display: inline-block; cursor: pointer; list-style: none; }
.admin-add > summary::-webkit-details-marker { display: none; }
.admin-form { display: grid; gap: .9rem; margin-top: 1rem; }
.admin-form.grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.admin-form label { display: grid; gap: .35rem; font-weight: 700; font-size: .92rem; }
.admin-form input, .admin-form select, .admin-form textarea {
  font: inherit; padding: .55rem .7rem; border: 1px solid #d8d6cf; border-radius: 10px; background: #fff; width: 100%;
}
.admin-form input[type="file"] { padding: .4rem; background: #faf8f3; }
.admin-form .full { grid-column: 1 / -1; }
.row-actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.admin-table td { vertical-align: middle; }
.admin-thumb { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: #f1efe8; display: grid; place-items: center; }
.admin-thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb-ph { font-weight: 800; color: #8a8a80; }
.admin-edit > summary { display: inline-block; cursor: pointer; list-style: none; }
.admin-edit > summary::-webkit-details-marker { display: none; }
.admin-edit .admin-form { max-width: 560px; background: #fbfaf6; border: 1px solid #ece9e0; border-radius: var(--radius); padding: 1rem; }
.danger-form { margin-top: .6rem; }

/* admin product list (stacked rows so the edit form can use the full width) */
.admin-list { border: 1px solid #ece9e0; border-radius: var(--radius); overflow: hidden; background: #fff; }
.admin-row { display: grid; grid-template-columns: 64px minmax(140px, 1fr) 120px 130px 96px; gap: 1rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid #f0eee7; }
.admin-row:last-child { border-bottom: 0; }
.admin-row-head { background: #faf8f3; font-size: .8rem; font-weight: 700; color: #7d7d72; }
.admin-row-head span { white-space: nowrap; }
.admin-price { font-weight: 700; }
.admin-edit[open] { grid-column: 1 / -1; }
.admin-edit > summary { justify-self: start; }
.admin-edit-body { margin-top: .8rem; padding: 1rem; background: #fbfaf6; border: 1px solid #ece9e0; border-radius: var(--radius); }
.admin-edit .admin-form { margin-top: 0; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); max-width: 100%; }
@media (max-width: 720px) {
  .admin-row { grid-template-columns: 48px 1fr; }
  .admin-row-head { display: none; }
  .admin-price, .admin-row > div:nth-child(4) { grid-column: 2; }
}

/* ---- narrow phones (360-390px): no horizontal scroll, tables stack ---- */
@media (max-width: 640px) {
  .header-inner { gap: .6rem; }
  .nav { gap: .55rem; font-size: .84rem; }

  .table { border: 0; background: transparent; }
  .table thead { display: none; }
  .table tbody tr {
    display: grid;
    gap: .45rem .8rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .85rem .95rem;
    margin-bottom: .8rem;
  }
  .table tbody td { display: block; border: 0; padding: 0; min-width: 0; }

  /* cart rows: art + name, then quantity, then the line total */
  .table:not(.admin-table) tbody tr { grid-template-columns: 2.6rem minmax(0, 1fr); }
  .table:not(.admin-table) .t-art { grid-column: 1; grid-row: 1; width: auto; }
  .table:not(.admin-table) tbody td:nth-child(2) { grid-column: 2; grid-row: 1; }
  .table:not(.admin-table) tbody td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
  .table:not(.admin-table) tbody td.t-total {
    grid-column: 1 / -1; grid-row: 3; text-align: end;
    border-top: 1px dashed var(--line); padding-top: .45rem;
  }
  .qty-form input[type="number"] { width: 4.5rem; }

  /* admin order rows: one value per line instead of six squeezed columns */
  .admin-table tbody tr { grid-template-columns: minmax(0, 1fr); }
  .admin-table tbody td { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .8rem; }
  .admin-table tbody td:first-child { font-weight: 700; }

  .cart-foot { flex-direction: column; align-items: stretch; }
  .cart-foot .btn { width: 100%; }
  .totals { min-width: 0; }
}
