:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --text: #1a1d29;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff4ff;
  --success: #059669;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 25px -5px rgba(16, 24, 40, .12), 0 8px 10px -6px rgba(16, 24, 40, .08);
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1120px;
}

* { 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); 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: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; gap: 20px;
  height: 64px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em;
  color: var(--text);
}
.brand .logo-badge {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center; font-size: .95rem; font-weight: 800;
}
.brand span.dot { color: var(--primary); }
.brand .brand-logo { height: 38px; width: auto; display: block; }

.main-nav { display: flex; gap: 6px; margin-inline-start: auto; align-items: center; flex-wrap: wrap; }
.main-nav a {
  color: var(--text-muted); font-weight: 600; font-size: .93rem;
  padding: 8px 12px; border-radius: 999px; transition: .15s;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a.active { color: var(--primary); background: var(--primary-soft); }

.lang-switch {
  margin-inline-start: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted); font-weight: 700; font-size: .8rem;
}
.lang-switch:hover { border-color: var(--primary); color: var(--primary); }

/* ─── Hero ───────────────────────────────────────────── */
.hero { padding: 56px 0 32px; }
.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.15; margin: 0 0 14px;
  letter-spacing: -.03em; font-weight: 800;
}
.hero p { color: var(--text-muted); font-size: 1.08rem; max-width: 640px; margin: 0 0 24px; }
.hero .accent { background: linear-gradient(120deg, var(--primary), #7c3aed);
  -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ─── Category chips ─────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text); font-weight: 600; box-shadow: var(--shadow);
  transition: .15s;
}
.chip:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--primary); }

/* ─── Category cards ─────────────────────────────────── */
.cat-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.cat-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 24px 16px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-weight: 700; box-shadow: var(--shadow); transition: .18s;
}
.cat-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--primary) 40%, 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: .98rem; }
.cat-icon-sm { font-size: 1.1em; }

/* ─── Sections ───────────────────────────────────────── */
main { padding: 24px 0 64px; }
.section-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; margin: 32px 0 16px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-head .section-title { display: flex; align-items: center; gap: 8px; }
.see-all { font-weight: 700; font-size: .9rem; white-space: nowrap; }
.muted { color: var(--text-muted); }

/* ─── Product grid ───────────────────────────────────── */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); 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: var(--surface-2); display: grid; place-items: center; padding: 18px;
}
.card .thumb img { width: 100%; height: 200px; object-fit: contain; mix-blend-mode: multiply; }
.card .thumb .noimg { color: var(--text-muted); font-size: 2.4rem; opacity: .5; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .brand-tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.card .name { font-weight: 700; color: var(--text); font-size: 1rem; line-height: 1.3; }
.card .price { margin-top: auto; padding-top: 8px; font-weight: 800; color: var(--success); font-size: 1.05rem; }
.card .price small { color: var(--text-muted); font-weight: 600; }

/* ─── 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(--primary); 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(--success); 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: 8px 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);
  padding: 40px 0; color: var(--text-muted); font-size: .92rem;
}
.site-footer .container { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--text-muted); }
.site-footer nav { display: flex; gap: 18px; 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; }
