/* Pharmacy portal shared styles. Tajawal Arabic + Inter Latin. RTL by default. */

:root {
  --brand: #0b63c2;
  --brand-dark: #094f9c;
  --accent: #ffd54d;
  --bg: #f4f8ff;
  --surface: #ffffff;
  --border: #e2e8f0;
  --muted: #66768a;
  --text: #1f2937;
  --danger: #d63031;
  --warn: #f59e0b;
  --ok: #10b981;
  --shadow-sm: 0 4px 12px rgba(15,57,105,.06);
  --shadow: 0 12px 28px rgba(15,57,105,.08);
  --shadow-lg: 0 24px 48px rgba(15,57,105,.12);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Tajawal', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: radial-gradient(1200px 600px at 90% -10%, #e9f3ff, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

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

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.88));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.topbar-inner { display: flex; align-items: center; gap: 18px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.1rem; color: var(--brand);
}
.brand-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 900; font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
}
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  padding: 8px 14px;
  border-radius: 10px;
  color: #475569;
  font-weight: 600;
  font-size: .95rem;
}
.topbar nav a:hover { background: #eaf2ff; color: var(--brand-dark); }
.topbar nav a.active { background: var(--brand); color: #fff; }

/* Hero */
.hero {
  background: linear-gradient(145deg, #fff, #eef6ff);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  margin: 24px 0;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  inset: auto -80px -90px auto;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent), transparent 70%);
  opacity: .35;
  /* fm296: decorative layer must never intercept taps. In portrait
     the .add-pill button wraps below the title and physically sits
     under this 280×280 circle (anchored bottom-end of the hero, near
     where the wrapped button lands in RTL). Without pointer-events:
     none the tap hits this pseudo-element instead of the button —
     which is exactly the user-reported "button visible but does
     nothing in portrait, works in landscape" symptom. */
  pointer-events: none;
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.add-pill { position: relative; z-index: 2; touch-action: manipulation; }
.hero h1 { margin: 0 0 8px; color: var(--brand-dark); font-size: 1.8rem; }
.hero p { margin: 0; color: var(--muted); font-size: 1.05rem; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card-hover { transition: transform .15s, box-shadow .2s; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; border-radius: 12px;
  padding: 10px 18px;
  font-weight: 700; font-family: inherit; font-size: .95rem;
  cursor: pointer;
  transition: transform .06s, filter .15s, background .2s;
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(90deg, var(--accent), #ffe082);
  color: var(--brand-dark);
  border: 1px solid #ffe082;
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-brand {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
}
.btn-brand:hover { filter: brightness(1.08); }
.btn-outline {
  background: #fff; color: var(--brand-dark);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--brand); background: #f6fbff; }
.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

/* Inputs */
label { display: block; font-weight: 700; font-size: .9rem; margin: 12px 0 6px; color: #334155; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11,99,194,.12);
}
textarea { min-height: 100px; resize: vertical; }

/* Grids */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Product card */
.product {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s, box-shadow .2s;
}
.product:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.product-img {
  width: 100%; aspect-ratio: 1/1;
  background: #f8fafc;
  display: grid; place-items: center;
}
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-body { padding: 14px; }
.product-name { font-weight: 700; font-size: .95rem; margin: 0 0 6px; min-height: 2.4em; line-height: 1.2; }
.product-short { font-size: .82rem; color: var(--muted); margin: 0 0 10px; min-height: 2.2em; }
.product-price { font-size: 1.15rem; font-weight: 800; color: var(--brand-dark); }
.product-price small { font-size: .7em; font-weight: 600; color: var(--muted); margin-inline-start: 4px; }
.product-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: .75rem; font-weight: 700;
}
.badge-rx { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.badge-otc { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }
.badge-low { background: #fff7ed; color: var(--warn); border: 1px solid #fed7aa; }
.badge-info { background: #eff6ff; color: var(--brand); border: 1px solid #bfdbfe; }

/* Severity pills (for clinical findings) */
.sev { display: inline-block; padding: 3px 10px; border-radius: 99px; font-weight: 800; font-size: .8rem; }
.sev-fatal { background: #7f1d1d; color: #fff; }
.sev-critical { background: #b91c1c; color: #fff; }
.sev-major { background: var(--warn); color: #fff; }
.sev-minor { background: #fde68a; color: #78350f; }
.sev-info { background: #e0f2fe; color: #075985; }

/* Table */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: right; }
th { background: #f1f5ff; color: var(--brand-dark); font-weight: 800; font-size: .85rem; }
tr:last-child td { border-bottom: none; }

/* Notification */
.notice {
  padding: 14px 18px; border-radius: 12px;
  border: 1px solid;
  font-weight: 600;
  margin: 12px 0;
}
.notice-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.notice-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.notice-warn { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.notice-err { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }

/* Drawer (cart) */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: none; z-index: 100;
}
.drawer-backdrop.open { display: block; }
.drawer {
  position: fixed; top: 0; bottom: 0;
  inset-inline-end: 0;
  width: 380px; max-width: 95vw;
  background: #fff; box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 101; display: flex; flex-direction: column;
}
[dir="rtl"] .drawer { transform: translateX(-100%); }
.drawer.open { transform: translateX(0); }
.drawer header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer .body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.drawer .foot { padding: 14px 18px; border-top: 1px solid var(--border); background: #fafbff; }

/* Stepper */
.steps { display: flex; gap: 10px; flex-wrap: wrap; }
.step {
  flex: 1; min-width: 140px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fafbff;
  font-size: .85rem; color: var(--muted);
}
.step.done { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.step.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Cart line */
.cart-line { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.cart-line img { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; background: #f1f5f9; }
.cart-line .info { flex: 1; }
.cart-line .qty-ctl { display: flex; align-items: center; gap: 6px; }
.cart-line .qty-ctl button { width: 26px; height: 26px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; font-weight: 700; }

/* Helpers */
.hide { display: none !important; }
.right { margin-inline-start: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.bold { font-weight: 700; }
.pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 99px; background: #f1f5ff; color: var(--brand-dark); font-weight: 700; font-size: .85rem; }
.spacer { height: 24px; }
hr.soft { border: none; height: 1px; background: var(--border); margin: 16px 0; }

@media (max-width: 700px) {
  .hero { padding: 20px; }
  .hero h1 { font-size: 1.4rem; }
  .grid-3 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
