@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;500;600;700&family=Noto+Sans+Arabic:wght@300;400;500;700&display=swap');

/* ── Design tokens (Flat · Pharmacy Green + Trust Blue) ── */
:root {
  --primary: #15803D;
  --primary-strong: #14532D;
  --primary-soft: #DCFCE7;
  --secondary: #22C55E;
  --accent: #0369A1;
  --accent-soft: #E0F2FE;
  --bg: #F0FDF4;
  --surface: #FFFFFF;
  --surface-2: #F7FBF8;
  --muted: #E8F0F1;
  --border: #BBF7D0;
  --border-soft: #E2EFE6;
  --text: #14532D;
  --text-body: #26402F;
  --text-muted: #5B7A68;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --warning: #B45309;
  --warning-soft: #FEF3C7;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-full: 999px;
  --shadow-1: 0 1px 2px rgba(20, 83, 45, .06);
  --shadow-2: 0 8px 24px rgba(20, 83, 45, .10);
  --f-head: 'Noto Naskh Arabic', serif;
  --f-body: 'Noto Sans Arabic', system-ui, sans-serif;
  --maxw: 1180px;
  --t: 180ms ease;
}
[data-theme="dark"] {
  --primary: #22C55E;
  --primary-strong: #DCFCE7;
  --primary-soft: #14321F;
  --accent: #38BDF8;
  --accent-soft: #0B2A3A;
  --bg: #071410;
  --surface: #0C1F18;
  --surface-2: #0F271E;
  --muted: #163026;
  --border: #1E4634;
  --border-soft: #16342A;
  --text: #E7F6EC;
  --text-body: #CBE6D6;
  --text-muted: #8FB3A1;
  --danger-soft: #3A1414;
  --warning-soft: #3A2A0B;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, .5);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text-body);
  line-height: 1.75;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--f-head); color: var(--text); line-height: 1.35; font-weight: 700; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Layout ── */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.section { padding: 3.5rem 0; }
.section-head { margin-bottom: 1.75rem; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.section-head p { color: var(--text-muted); max-width: 62ch; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 700;
  color: var(--primary); background: var(--primary-soft); padding: .25rem .7rem;
  border-radius: var(--r-full); margin-bottom: .65rem; letter-spacing: .02em;
}
.grid { display: grid; gap: 1rem; }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.g-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.row { display: flex; align-items: center; gap: .6rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .75rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.15rem; border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--primary); color: #fff; font-weight: 700; font-size: .92rem; cursor: pointer;
  transition: background var(--t), transform var(--t), box-shadow var(--t), color var(--t), border-color var(--t);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--primary-strong); color: #fff; transform: translateY(-1px); }
[data-theme="dark"] .btn:hover:not(:disabled) { color: #071410; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary); }
.btn-accent { background: var(--accent); }
.btn-accent:hover:not(:disabled) { background: #075985; }
.btn-danger { background: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #B91C1C; }
.btn-ghost { background: transparent; color: var(--text-body); border-color: var(--border-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--muted); color: var(--text); }
.btn-sm { padding: .38rem .7rem; font-size: .82rem; border-radius: var(--r-sm); }
.btn-icon { padding: .5rem; width: 38px; height: 38px; }
.btn-block { width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Surfaces ── */
.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r); padding: 1.25rem; transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.card-hover:hover { border-color: var(--border); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.panel { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); padding: 1.5rem; }
.divider { border: none; border-top: 1px solid var(--border-soft); margin: 1.5rem 0; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; padding: .2rem .6rem; border-radius: var(--r-full); background: var(--muted); color: var(--text-muted); }
.badge-green { background: var(--primary-soft); color: var(--primary); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }

/* ── Forms ── */
label { display: flex; flex-direction: column; gap: .35rem; font-size: .84rem; font-weight: 600; color: var(--text); }
input, select, textarea {
  width: 100%; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-body); transition: border-color var(--t), box-shadow var(--t);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21, 128, 61, .15); }
input.invalid, select.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.field-error { color: var(--danger); font-size: .78rem; font-weight: 600; }
.hint { color: var(--text-muted); font-size: .78rem; }
.form-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check { flex-direction: row; align-items: center; gap: .5rem; font-size: .88rem; }
.check input { width: auto; }

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 40; background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}
.navbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 68px; }
.brand { display: flex; align-items: center; gap: .6rem; cursor: pointer; }
.brand-mark {
  width: 42px; height: 42px; border-radius: var(--r-sm); background: var(--primary); color: #fff;
  display: grid; place-items: center; font-family: var(--f-head); font-weight: 700; font-size: 1.05rem; overflow: hidden; flex: none;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-text strong { font-family: var(--f-head); font-size: 1.12rem; color: var(--text); display: block; line-height: 1.2; }
.brand-text span { font-size: .74rem; color: var(--text-muted); }
.nav-links { display: flex; align-items: center; gap: .25rem; }
.nav-link {
  padding: .45rem .8rem; border-radius: var(--r-sm); font-size: .92rem; font-weight: 600;
  color: var(--text-body); cursor: pointer; transition: background var(--t), color var(--t);
}
.nav-link:hover { background: var(--primary-soft); color: var(--primary); }
.nav-link.active { background: var(--primary); color: #fff; }
.nav-actions { display: flex; align-items: center; gap: .5rem; }
.cart-btn { position: relative; }
.cart-count {
  position: absolute; top: -6px; inset-inline-start: -6px; min-width: 20px; height: 20px;
  border-radius: var(--r-full); background: var(--accent); color: #fff; font-size: .7rem;
  font-weight: 700; display: grid; place-items: center; padding: 0 5px;
}
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .nav-links { display: none; position: absolute; top: 68px; inset-inline: 0; background: var(--surface);
    flex-direction: column; align-items: stretch; padding: .75rem; border-bottom: 1px solid var(--border-soft); gap: .2rem; }
  .nav-links.open { display: flex; }
  .menu-toggle { display: inline-flex; }
}

/* ── Hero ── */
.hero { padding: 3rem 0 2.5rem; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 2rem; align-items: center; }
.hero h1 { font-size: clamp(1.8rem, 4.2vw, 2.85rem); letter-spacing: -.01em; margin-bottom: .85rem; }
.hero p.lead { font-size: 1.06rem; color: var(--text-muted); margin-bottom: 1.4rem; max-width: 56ch; }
.hero-cta { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.hero-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; padding-top: 1.25rem; border-top: 1px solid var(--border-soft); }
.hero-stat strong { font-family: var(--f-head); font-size: 1.5rem; color: var(--primary); display: block; }
.hero-stat span { font-size: .8rem; color: var(--text-muted); }
.hero-art { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .hero-art { order: -1; } }

/* ── Search & filters ── */
.searchbar { display: flex; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-full); padding: .35rem; align-items: center; }
.searchbar input { border: none; background: transparent; padding: .55rem .9rem; }
.searchbar input:focus { box-shadow: none; }
.searchbar .icon-btn { color: var(--text-muted); padding: .5rem .7rem; }
.chips { display: flex; gap: .45rem; flex-wrap: wrap; margin: 1rem 0; }
.chip {
  padding: .38rem .85rem; border-radius: var(--r-full); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-body); font-size: .84rem; font-weight: 600; cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.chip:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.toolbar select { width: auto; }

/* ── Product card ── */
.p-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; position: relative; }
.p-media { aspect-ratio: 4 / 3; background: var(--primary-soft); display: grid; place-items: center; overflow: hidden; }
.p-media img { width: 100%; height: 100%; object-fit: cover; }
.p-media .p-ph { color: var(--primary); }
.p-body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.p-cat { font-size: .74rem; color: var(--accent); font-weight: 700; }
.p-name { font-family: var(--f-head); font-size: 1.05rem; color: var(--text); line-height: 1.4; }
.p-desc { font-size: .82rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.p-price { font-family: var(--f-head); font-weight: 700; font-size: 1.15rem; color: var(--primary); }
.p-price small { font-size: .7rem; color: var(--text-muted); font-weight: 500; }
.stock-tag { position: absolute; inset-block-start: .6rem; inset-inline-start: .6rem; }
.p-out .p-media { filter: grayscale(.7); opacity: .75; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.qty button { background: var(--surface); border: none; padding: .3rem .55rem; cursor: pointer; color: var(--text); display: grid; place-items: center; }
.qty button:hover { background: var(--primary-soft); }
.qty span { min-width: 30px; text-align: center; font-weight: 700; font-size: .9rem; }

/* ── Drawer / modal ── */
.overlay { position: fixed; inset: 0; background: rgba(12, 31, 24, .48); z-index: 60; display: flex; animation: fade .18s ease; }
.overlay.end { justify-content: flex-start; }
.overlay.center { align-items: center; justify-content: center; padding: 1rem; }
.drawer { background: var(--surface); width: min(430px, 100%); height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-2); animation: slideIn .22s ease; }
.drawer-head, .drawer-foot { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-soft); }
.drawer-foot { border-bottom: none; border-top: 1px solid var(--border-soft); margin-top: auto; }
.drawer-body { padding: 1rem 1.25rem; overflow-y: auto; flex: 1; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: min(560px, 100%); max-height: 88dvh; overflow-y: auto; padding: 1.5rem; box-shadow: var(--shadow-2); animation: pop .2s ease; }
.cart-line { display: flex; gap: .75rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--border-soft); }
.cart-line:last-child { border-bottom: none; }
.cart-thumb { width: 48px; height: 48px; border-radius: var(--r-sm); background: var(--primary-soft); display: grid; place-items: center; overflow: hidden; flex: none; }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
@keyframes slideIn { from { transform: translateX(-24px); opacity: .4 } to { transform: none; opacity: 1 } }
@keyframes pop { from { transform: scale(.96); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

/* ── Table ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--r); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
thead th { background: var(--surface-2); text-align: right; font-size: .8rem; color: var(--text-muted); font-weight: 700; padding: .7rem .9rem; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
tbody td { padding: .7rem .9rem; border-bottom: 1px solid var(--border-soft); font-size: .88rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.t-actions { display: flex; gap: .35rem; justify-content: flex-end; }
.thumb-xs { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--primary-soft); object-fit: cover; display: grid; place-items: center; color: var(--primary); }

/* ── Admin ── */
.admin-shell { display: grid; grid-template-columns: 250px 1fr; gap: 1.5rem; align-items: start; }
.admin-nav { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); padding: .75rem; position: sticky; top: 84px; }
.admin-nav button {
  display: flex; align-items: center; gap: .6rem; width: 100%; padding: .65rem .8rem; border: none;
  background: transparent; color: var(--text-body); font-weight: 600; border-radius: var(--r-sm); cursor: pointer;
  text-align: right; transition: background var(--t), color var(--t); font-size: .92rem;
}
.admin-nav button:hover { background: var(--muted); }
.admin-nav button.active { background: var(--primary); color: #fff; }
.stat-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r); padding: 1.1rem; }
.stat-card .stat-ico { width: 38px; height: 38px; border-radius: var(--r-sm); background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: .6rem; }
.stat-card strong { font-family: var(--f-head); font-size: 1.6rem; color: var(--text); display: block; line-height: 1.2; }
.stat-card span { font-size: .8rem; color: var(--text-muted); }
@media (max-width: 860px) { .admin-shell { grid-template-columns: 1fr; } .admin-nav { position: static; display: flex; overflow-x: auto; gap: .3rem; } .admin-nav button { white-space: nowrap; width: auto; } }

/* ── Toast / empty / skeleton ── */
.toast-wrap { position: fixed; inset-block-end: 1.25rem; inset-inline-start: 1.25rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-2);
  font-size: .88rem; font-weight: 600; animation: pop .2s ease; max-width: 340px;
}
.toast.success { border-color: var(--secondary); color: var(--primary); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.info { border-color: var(--accent); color: var(--accent); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty svg { color: var(--border); margin-bottom: .75rem; }
.skeleton { background: linear-gradient(90deg, var(--muted) 25%, var(--surface-2) 50%, var(--muted) 75%); background-size: 200%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }
.fade-up { animation: fadeUp .45s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ── Feature / steps / info ── */
.f-card { display: flex; flex-direction: column; gap: .5rem; }
.f-ico { width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.f-card h3 { font-size: 1.05rem; }
.f-card p { font-size: .88rem; color: var(--text-muted); }
.steps { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); counter-reset: s; }
.step { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r); padding: 1.15rem; position: relative; }
.step::before {
  counter-increment: s; content: counter(s); position: absolute; inset-block-start: -.7rem; inset-inline-start: 1rem;
  width: 28px; height: 28px; border-radius: var(--r-full); background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .82rem;
}
.step h4 { margin-top: .5rem; font-size: 1rem; }
.step p { font-size: .85rem; color: var(--text-muted); }
.info-line { display: flex; align-items: flex-start; gap: .6rem; font-size: .92rem; }
.info-line svg { color: var(--primary); flex: none; margin-top: .25rem; }
.bar { height: 6px; border-radius: var(--r-full); background: var(--muted); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--secondary); }
.bar.low > i { background: var(--warning); }
.bar.out > i { background: var(--danger); }
.drop {
  border: 1.5px dashed var(--border); border-radius: var(--r); background: var(--surface-2);
  padding: 1rem; text-align: center; cursor: pointer; transition: border-color var(--t), background var(--t);
}
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.img-preview { width: 88px; height: 88px; border-radius: var(--r-sm); object-fit: cover; border: 1px solid var(--border); }
.order-card { border: 1px solid var(--border-soft); border-radius: var(--r); background: var(--surface); padding: 1rem; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ── Footer ── */
.footer { background: var(--surface); border-top: 1px solid var(--border-soft); padding: 2.5rem 0 1.5rem; margin-top: 2rem; }
.footer-grid { display: grid; gap: 1.75rem; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; }
.footer h4 { font-size: .95rem; margin-bottom: .6rem; }
.footer a, .footer li { font-size: .87rem; color: var(--text-muted); list-style: none; }
.footer a:hover { color: var(--primary); }
.footer-bottom { margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid var(--border-soft); font-size: .8rem; color: var(--text-muted); }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } .section { padding: 2.5rem 0; } }
