:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --text: #16202a;
  --text-muted: #6b7684;
  --border: #e7ebef;
  --primary: #0aa89e;          /* primini-style teal */
  --primary-hover: #08897f;
  --primary-dark: #06655d;
  --primary-soft: #e6f7f5;
  --accent: #ff5a5f;           /* discount / promo red */
  --accent-soft: #fff0f0;
  --success: #0aa89e;
  --price: #0f766e;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 28px -8px rgba(16, 24, 40, .16), 0 6px 12px -6px rgba(16, 24, 40, .08);
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1200px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Noto Kufi Arabic", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

html[dir="rtl"] body { font-family: "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif; }

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ─── Header ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-main {
  display: flex; align-items: center; gap: 24px;
  height: 72px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em;
  color: var(--text); flex-shrink: 0;
}
.brand .logo-badge {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; display: grid; place-items: center; font-size: .95rem; font-weight: 800;
}
.brand .brand-logo { height: 36px; width: auto; display: block; }

/* Prominent centered search bar — modern pill */
.header-search {
  flex: 1; max-width: 640px; display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 999px; padding-block: 5px; padding-inline: 16px 6px;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.header-search:hover { border-color: #d4dae0; background: #fff; }
.header-search:focus-within {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px var(--primary-soft), var(--shadow);
}
.header-search__icon {
  display: grid; place-items: center; color: var(--text-muted); flex-shrink: 0;
  transition: color .18s ease;
}
.header-search:focus-within .header-search__icon { color: var(--primary); }
.header-search input {
  flex: 1; border: none; background: transparent; padding: 8px 4px;
  font: inherit; font-size: .95rem; color: var(--text); outline: none; min-width: 0;
}
.header-search input::placeholder { color: var(--text-muted); opacity: .9; }
/* hide native search clear/decoration for a cleaner look */
.header-search input::-webkit-search-decoration,
.header-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.header-search button {
  border: none; background: var(--primary); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 9px 20px; border-radius: 999px; font: inherit; font-weight: 700; font-size: .9rem;
  transition: background .18s ease, transform .12s ease;
}
.header-search button:hover { background: var(--primary-hover); }
.header-search button:active { transform: scale(.97); }
.header-search__btn-icon { display: none; }

.header-right { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; flex-shrink: 0; }
.lang-switch {
  padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--border); color: var(--text-muted); font-weight: 700; font-size: .82rem;
}
.lang-switch:hover { border-color: var(--primary); color: var(--primary); }

/* Category nav bar (second row) */
.cat-bar { border-top: 1px solid var(--border); background: var(--surface); }
.cat-bar .container { display: flex; gap: 4px; align-items: center; overflow-x: auto; }
.cat-bar a {
  color: var(--text-muted); font-weight: 600; font-size: .9rem;
  padding: 12px 14px; white-space: nowrap; border-bottom: 2.5px solid transparent; transition: .15s;
}
.cat-bar a:hover { color: var(--text); }
.cat-bar a.active { color: var(--primary); border-bottom-color: var(--primary); }
.cat-bar a .ico { margin-inline-end: 5px; }

@media (max-width: 760px) {
  .header-main { flex-wrap: wrap; height: auto; padding: 12px 0; gap: 12px; }
  .header-search { order: 3; max-width: none; flex-basis: 100%; }
  .header-search button { padding: 9px 12px; }
  .header-search__btn-text { display: none; }
  .header-search__btn-icon { display: block; }
}

/* ─── Hero ───────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 48px 0 44px; margin-bottom: 8px;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.15; margin: 0 0 14px;
  letter-spacing: -.03em; font-weight: 800;
}
.hero p { color: rgba(255,255,255,.9); font-size: 1.08rem; max-width: 640px; margin: 0 0 24px; }
.hero .hero-search {
  max-width: 560px; display: flex; background: #fff; border-radius: 999px;
  overflow: hidden; box-shadow: var(--shadow-lg);
}
.hero .hero-search input { flex: 1; border: none; padding: 15px 22px; font: inherit; font-size: 1rem; outline: none; min-width: 0; }
.hero .hero-search button { border: none; background: var(--accent); color: #fff; font-weight: 700; padding: 0 28px; cursor: pointer; font-size: .95rem; }
.hero .hero-search button:hover { filter: brightness(.95); }

/* ─── Category cards ─────────────────────────────────── */
.cat-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.cat-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 14px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-weight: 700; transition: .18s;
}
.cat-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); color: var(--primary);
}
.cat-icon {
  display: grid; place-items: center; width: 56px; height: 56px;
  border-radius: 50%; background: var(--primary-soft); font-size: 1.7rem; line-height: 1;
}
.cat-name { font-size: .95rem; }
.cat-icon-sm { font-size: 1.1em; }

/* ─── Sections ───────────────────────────────────────── */
main { padding: 20px 0 64px; }
.section-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; margin: 30px 0 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 34px 0 16px; }
.section-head .section-title { margin: 0; display: flex; align-items: center; gap: 8px; }
.see-all {
  font-weight: 700; font-size: .88rem; white-space: nowrap; color: var(--primary);
  padding: 7px 14px; border: 1.5px solid var(--border); border-radius: 999px; transition: .15s;
}
.see-all:hover { border-color: var(--primary); background: var(--primary-soft); }
.muted { color: var(--text-muted); }

/* ─── Product grid + carousel ────────────────────────── */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
/* Horizontal scrolling row (home category carousels) */
.carousel {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: minmax(210px, 1fr);
  gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 10px; margin: 0 -4px; padding-inline: 4px;
}
.carousel .card { scroll-snap-align: start; }
.carousel::-webkit-scrollbar { height: 8px; }
.carousel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: .18s; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.card .thumb {
  aspect-ratio: 1 / 1; background: #fff; display: grid; place-items: center; padding: 18px;
      border-bottom: 1px solid var(--border);
}
.card .thumb img { width: 100%; height: 190px; object-fit: contain; mix-blend-mode: multiply; }
.card .thumb .noimg { color: var(--text-muted); font-size: 2.4rem; opacity: .5; }
.discount-badge {
  position: absolute; top: 10px; inset-inline-start: 10px; z-index: 2;
  background: var(--accent); color: #fff; font-weight: 800; font-size: .78rem;
  padding: 4px 8px; border-radius: 6px; letter-spacing: .01em;
}
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .brand-tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.card .name { font-weight: 600; color: var(--text); font-size: .95rem; line-height: 1.3; }
.card .price { margin-top: auto; padding-top: 8px; font-weight: 800; color: var(--price); font-size: 1.1rem; }
.card .price .from { display: inline; font-size: .68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.card .price small { color: var(--text-muted); font-weight: 700; font-size: .8rem; }

/* ─── Product detail ─────────────────────────────────── */
.product-hero { display: grid; grid-template-columns: 340px 1fr; gap: 32px; align-items: start; }
@media (max-width: 760px) { .product-hero { grid-template-columns: 1fr; } }
.product-gallery {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  aspect-ratio: 1/1; display: grid; place-items: center; padding: 28px; box-shadow: var(--shadow);
}
.product-gallery img { width: 100%; height: 300px; object-fit: contain; }
.product-info h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); letter-spacing: -.02em; margin: 0 0 8px; }
.price-badge {
  display: inline-flex; align-items: baseline; gap: 6px; margin: 12px 0;
  background: var(--primary-soft); color: var(--price); border-radius: var(--radius-sm);
  padding: 12px 18px; font-size: 1.6rem; font-weight: 800;
}
.price-badge small { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.lead { color: var(--text-muted); font-size: 1.05rem; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin: 24px 0; overflow: hidden;
}
.panel > h2 { font-size: 1.15rem; margin: 0; padding: 18px 20px; border-bottom: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 13px 20px; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
tbody tr:last-child td, tbody tr:last-child td { border-bottom: none; }
.specs-table td:first-child { color: var(--text-muted); font-weight: 600; width: 40%; }
.offer-store { font-weight: 700; }
.offer-price { font-weight: 800; color: var(--price); white-space: nowrap; }
.btn-go {
  display: inline-block; padding: 7px 14px; border-radius: 8px; background: var(--primary);
  color: #fff; font-weight: 700; font-size: .85rem;
}
.btn-go:hover { background: var(--primary-hover); color: #fff; }

.breadcrumb { display: flex; gap: 8px; flex-wrap: wrap; color: var(--text-muted); font-size: .9rem; margin: 16px 0 20px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

/* ─── Footer ─────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border); background: var(--surface-2);
  padding: 48px 0 32px; color: var(--text-muted); font-size: .9rem;
}
.footer-cols {
  display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px;
  padding-bottom: 32px; border-bottom: 1px solid var(--border);
}
@media (max-width: 760px) { .footer-cols { grid-template-columns: 1fr 1fr; gap: 24px; } }
.footer-cols h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text); margin: 0 0 14px; }
.footer-cols nav { display: flex; flex-direction: column; gap: 9px; }
.footer-cols a { color: var(--text-muted); }
.footer-cols a:hover { color: var(--primary); }
.footer-brand .brand-logo { height: 32px; margin-bottom: 12px; }
.footer-brand p { margin: 0; max-width: 260px; line-height: 1.6; }
.footer-bottom { padding-top: 22px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ─── Static content pages (prose) ───────────────────── */
.prose { max-width: 760px; }
.prose h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.02em; margin: 0 0 20px; }
.prose h2 { font-size: 1.2rem; font-weight: 700; margin: 28px 0 10px; }
.prose p { margin: 0 0 14px; color: var(--text); }
.prose ul { margin: 0 0 14px; padding-inline-start: 22px; color: var(--text); }
.prose li { margin: 6px 0; }
.prose a { font-weight: 600; }

/* ─── Empty / notice ─────────────────────────────────── */
.notice {
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 40px; text-align: center; color: var(--text-muted);
}

/* ─── Admin ──────────────────────────────────────────── */
.admin-shell { max-width: 960px; }
.admin-bar {
  display: flex; align-items: center; gap: 16px; margin: 24px 0;
}
.admin-bar h1 { font-size: 1.5rem; margin: 0; margin-inline-end: auto; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 700; font-size: .92rem; transition: .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-danger { color: #dc2626; }
.btn-sm { padding: 5px 12px; font-size: .82rem; border-radius: 8px; }

.form-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px; max-width: 720px;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.field .hint { color: var(--text-muted); font-size: .82rem; font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: .95rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { min-height: 96px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

.login-wrap { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; }

.admin-table { width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.admin-table img.mini { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: var(--surface-2); }

.preview-img { max-width: 120px; max-height: 120px; border-radius: 10px; border: 1px solid var(--border); margin-top: 8px; display: none; }
