/* =====================================================================
   Al-Ashtar Pharmacy — Design system
   Palette: deep apothecary teal + warm gold accent on a calm mint-grey
   surface. One Arabic type family (IBM Plex Sans Arabic) at varied
   weights carries both display and body text.
   ===================================================================== */

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

:root{
  --teal-900:#0A423E;
  --teal-800:#0E5C56;
  --teal-700:#136B63;
  --teal-100:#E4F1EE;
  --gold-600:#B8873A;
  --gold-100:#F6ECD9;

  --bg:#F5F7F6;
  --surface:#FFFFFF;
  --ink:#16231F;
  --muted:#5C6E69;
  --border:#E3E9E6;

  --amber:#B7791F;
  --amber-bg:#FCF1DC;
  --blue:#2A5DB0;
  --blue-bg:#E5EDFA;
  --purple:#6C4CB0;
  --purple-bg:#EFE7FA;
  --red:#C13A3A;
  --red-bg:#FBE7E7;
  --green:#1F8A4C;
  --green-bg:#E4F5EA;
  --gray:#6B7573;
  --gray-bg:#EEF1F0;

  --radius-lg:18px;
  --radius-md:12px;
  --radius-sm:8px;
  --shadow-card:0 1px 2px rgba(16,32,28,.05), 0 8px 24px -12px rgba(16,32,28,.12);
}

*,*::before,*::after{ box-sizing:border-box; }

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

body{
  margin:0;
  font-family:'IBM Plex Sans Arabic', 'Tahoma', sans-serif;
  background:var(--bg);
  color:var(--ink);
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}

a{ color:inherit; text-decoration:none; }
img{ max-width:100%; display:block; }
button{ font-family:inherit; }

h1,h2,h3,h4{ margin:0 0 6px; font-weight:700; letter-spacing:-.01em; }

.container{ max-width:1180px; margin:0 auto; padding:0 20px; }

/* ---------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------ */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:1px solid transparent; border-radius:var(--radius-sm);
  padding:11px 20px; font-size:15px; font-weight:600; cursor:pointer;
  transition:transform .12s ease, box-shadow .12s ease, background .15s ease;
  line-height:1.2;
}
.btn:active{ transform:translateY(1px); }
.btn:disabled{ opacity:.55; cursor:not-allowed; transform:none; }

.btn-primary{ background:var(--teal-800); color:#fff; }
.btn-primary:hover:not(:disabled){ background:var(--teal-900); }

.btn-gold{ background:var(--gold-600); color:#fff; }
.btn-gold:hover:not(:disabled){ background:#a3762f; }

.btn-outline{ background:#fff; border-color:var(--border); color:var(--ink); }
.btn-outline:hover:not(:disabled){ border-color:var(--teal-700); color:var(--teal-800); }

.btn-danger{ background:#fff; border-color:var(--red); color:var(--red); }
.btn-danger:hover:not(:disabled){ background:var(--red-bg); }

.btn-ghost{ background:transparent; color:var(--muted); }
.btn-ghost:hover:not(:disabled){ background:var(--gray-bg); }

.btn-sm{ padding:7px 14px; font-size:13px; }
.btn-block{ width:100%; }

/* ---------------------------------------------------------------------
   Form controls
   ------------------------------------------------------------------ */
label{ display:block; font-size:14px; font-weight:600; margin-bottom:6px; color:var(--ink); }
.required::after{ content:' *'; color:var(--red); }

.field{ margin-bottom:18px; }
.field-hint{ font-size:12.5px; color:var(--muted); margin-top:5px; }
.field-error{ font-size:12.5px; color:var(--red); margin-top:5px; display:none; }
.field.has-error .field-error{ display:block; }
.field.has-error input, .field.has-error select, .field.has-error textarea{ border-color:var(--red); }

input[type=text], input[type=tel], input[type=date], input[type=number],
input[type=password], select, textarea{
  width:100%; padding:12px 14px; font-size:15.5px; font-family:inherit;
  border:1.5px solid var(--border); border-radius:var(--radius-sm);
  background:#fff; color:var(--ink); transition:border-color .15s ease, box-shadow .15s ease;
}
textarea{ resize:vertical; min-height:88px; }
input:focus, select:focus, textarea:focus{
  outline:none; border-color:var(--teal-700); box-shadow:0 0 0 3px var(--teal-100);
}
input::placeholder, textarea::placeholder{ color:#9AA6A2; }

.radio-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; }
.radio-card{
  border:1.5px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px;
  display:flex; align-items:center; gap:10px; cursor:pointer; font-size:14.5px; font-weight:500;
  transition:border-color .15s ease, background .15s ease;
}
.radio-card input{ width:auto; accent-color:var(--teal-800); }
.radio-card:has(input:checked){ border-color:var(--teal-800); background:var(--teal-100); }

/* ---------------------------------------------------------------------
   Badges
   ------------------------------------------------------------------ */
.badge{
  display:inline-flex; align-items:center; padding:4px 11px; border-radius:999px;
  font-size:12.5px; font-weight:600; white-space:nowrap;
}
.badge-amber{ background:var(--amber-bg); color:var(--amber); }
.badge-blue{ background:var(--blue-bg); color:var(--blue); }
.badge-purple{ background:var(--purple-bg); color:var(--purple); }
.badge-red{ background:var(--red-bg); color:var(--red); }
.badge-green{ background:var(--green-bg); color:var(--green); }
.badge-gray{ background:var(--gray-bg); color:var(--gray); }

/* ---------------------------------------------------------------------
   Cards
   ------------------------------------------------------------------ */
.card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-card); }
.card-pad{ padding:24px; }

/* =====================================================================
   PUBLIC BOOKING PAGE
   ===================================================================== */
.public-page{ min-height:100vh; }

.public-hero{
  background:linear-gradient(160deg, var(--teal-900), var(--teal-700) 65%, var(--teal-700));
  color:#fff; padding:38px 0 70px;
  position:relative; overflow:hidden;
}
.public-hero::after{
  content:''; position:absolute; inset:auto -10% -60% -10%; height:220px;
  background:radial-gradient(closest-side, rgba(184,135,58,.35), transparent 70%);
}
.hero-inner{ position:relative; z-index:1; text-align:center; }
.hero-badge{
  display:inline-flex; align-items:center; gap:8px; background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.25); padding:6px 14px; border-radius:999px;
  font-size:13px; margin-bottom:18px;
}
.hero-inner h1{ font-size:26px; margin-bottom:8px; }
.hero-inner p.lead{ font-size:15.5px; color:rgba(255,255,255,.85); max-width:520px; margin:0 auto; }

.public-body{ margin-top:-42px; padding-bottom:60px; position:relative; z-index:2; }

.welcome-card{ padding:22px 24px; margin-bottom:18px; }
.welcome-card p{ color:var(--muted); margin:0; font-size:14.5px; }

.schedule-grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:16px; }
@media (max-width:520px){ .schedule-grid{ grid-template-columns:1fr; } }
.schedule-item{
  border:1.5px dashed var(--border); border-radius:var(--radius-md); padding:14px 16px;
  background:var(--teal-100);
}
.schedule-item .day{ font-weight:700; color:var(--teal-900); font-size:14.5px; margin-bottom:3px; }
.schedule-item .hours{ font-size:13.5px; color:var(--teal-800); }

.section-title{ font-size:17px; margin:26px 0 14px; display:flex; align-items:center; gap:8px; }
.section-title .num{
  width:26px; height:26px; border-radius:50%; background:var(--teal-800); color:#fff;
  display:inline-flex; align-items:center; justify-content:center; font-size:13px; font-weight:700;
}

.form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
@media (max-width:600px){ .form-grid{ grid-template-columns:1fr; } }

.slots-wrap{ display:flex; flex-wrap:wrap; gap:8px; margin-top:4px; }
.slot-btn{
  border:1.5px solid var(--border); background:#fff; border-radius:999px; padding:9px 16px;
  font-size:14px; font-weight:600; cursor:pointer; color:var(--ink);
}
.slot-btn.selected{ background:var(--teal-800); border-color:var(--teal-800); color:#fff; }
.slot-btn:disabled{ opacity:.4; cursor:not-allowed; text-decoration:line-through; }
.slots-empty{ font-size:14px; color:var(--muted); padding:8px 0; }

.success-screen{ text-align:center; padding:10px 6px; }
.success-icon{
  width:64px; height:64px; border-radius:50%; background:var(--green-bg); color:var(--green);
  display:flex; align-items:center; justify-content:center; margin:0 auto 16px; font-size:30px;
}
.success-screen h2{ font-size:20px; }
.booking-summary{ text-align:right; background:var(--bg); border-radius:var(--radius-md); padding:16px 18px; margin:20px 0; }
.booking-summary .row{ display:flex; justify-content:space-between; padding:7px 0; border-bottom:1px solid var(--border); font-size:14.5px; }
.booking-summary .row:last-child{ border-bottom:none; }
.booking-summary .row .k{ color:var(--muted); }
.booking-summary .row .v{ font-weight:600; }
.booking-number{
  font-family:'IBM Plex Sans Arabic'; font-size:22px; font-weight:700; color:var(--teal-800);
  background:var(--teal-100); border-radius:var(--radius-sm); padding:10px 18px; display:inline-block; margin:6px 0 2px;
  letter-spacing:.03em; direction:ltr;
}

/* =====================================================================
   ADMIN LAYOUT
   ===================================================================== */
.admin-shell{ display:flex; min-height:100vh; }

.sidebar{
  width:250px; background:var(--teal-900); color:#EAF3F1; flex-shrink:0;
  display:flex; flex-direction:column; position:sticky; top:0; height:100vh;
}
.sidebar-brand{ padding:22px 20px; border-bottom:1px solid rgba(255,255,255,.1); }
.sidebar-brand strong{ display:block; font-size:16.5px; }
.sidebar-brand span{ font-size:12px; color:rgba(255,255,255,.55); }

.sidebar-nav{ padding:14px 10px; overflow-y:auto; flex:1; }
.sidebar-nav a{
  display:flex; align-items:center; gap:10px; padding:11px 14px; border-radius:var(--radius-sm);
  font-size:14.5px; color:rgba(255,255,255,.78); margin-bottom:2px; font-weight:500;
}
.sidebar-nav a:hover{ background:rgba(255,255,255,.08); color:#fff; }
.sidebar-nav a.active{ background:var(--gold-600); color:#fff; }
.sidebar-nav .icon{ width:19px; text-align:center; flex-shrink:0; }

.sidebar-user{ padding:16px 18px; border-top:1px solid rgba(255,255,255,.1); font-size:13px; }
.sidebar-user .name{ font-weight:600; color:#fff; margin-bottom:2px; }
.sidebar-user .role{ color:rgba(255,255,255,.55); margin-bottom:10px; }

.admin-main{ flex:1; min-width:0; }
.admin-topbar{
  background:#fff; border-bottom:1px solid var(--border); padding:14px 24px;
  display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:10;
}
.admin-topbar h1{ font-size:19px; margin:0; }
.hamburger{ display:none; background:none; border:none; font-size:22px; cursor:pointer; color:var(--ink); }

.admin-content{ padding:24px; max-width:1280px; }

@media (max-width:920px){
  .sidebar{ position:fixed; right:0; top:0; z-index:50; transform:translateX(100%); transition:transform .2s ease; box-shadow:-8px 0 30px rgba(0,0,0,.25); }
  .sidebar.open{ transform:translateX(0); }
  .hamburger{ display:block; }
  .admin-content{ padding:16px; }
  .sidebar-overlay{ display:none; position:fixed; inset:0; background:rgba(10,20,18,.4); z-index:40; }
  .sidebar-overlay.open{ display:block; }
}

/* Stat cards */
.stats-grid{ display:grid; grid-template-columns:repeat(5,1fr); gap:14px; margin-bottom:26px; }
@media (max-width:1100px){ .stats-grid{ grid-template-columns:repeat(3,1fr); } }
@media (max-width:640px){ .stats-grid{ grid-template-columns:repeat(2,1fr); } }
.stat-card{ padding:18px; }
.stat-card .stat-num{ font-size:26px; font-weight:700; color:var(--teal-900); }
.stat-card .stat-label{ font-size:13px; color:var(--muted); margin-top:4px; }

/* Tables */
.table-wrap{ overflow-x:auto; border-radius:var(--radius-lg); border:1px solid var(--border); background:#fff; }
table{ width:100%; border-collapse:collapse; min-width:640px; }
th{ text-align:right; font-size:12.5px; color:var(--muted); font-weight:600; padding:13px 16px; background:var(--bg); border-bottom:1px solid var(--border); white-space:nowrap; }
td{ padding:13px 16px; font-size:14px; border-bottom:1px solid var(--border); vertical-align:middle; }
tr:last-child td{ border-bottom:none; }
tbody tr:hover{ background:#FBFCFB; }

/* List / detail row cards (mobile-friendly alternative to tables) */
.list-card{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 18px; border-bottom:1px solid var(--border); }
.list-card:last-child{ border-bottom:none; }
.list-card .meta{ font-size:13px; color:var(--muted); margin-top:3px; }

/* Filters bar */
.filters-bar{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:18px; }
.filter-chip{
  border:1.5px solid var(--border); background:#fff; border-radius:999px; padding:8px 16px;
  font-size:13.5px; font-weight:600; color:var(--muted); cursor:pointer;
}
.filter-chip.active{ background:var(--teal-800); border-color:var(--teal-800); color:#fff; }

.search-box{ position:relative; max-width:340px; }
.search-box input{ padding-right:38px; }
.search-box .icon{ position:absolute; right:12px; top:50%; transform:translateY(-50%); color:var(--muted); }

/* Empty state */
.empty-state{ text-align:center; padding:52px 20px; color:var(--muted); }
.empty-state .icon{ font-size:38px; margin-bottom:10px; }
.empty-state h3{ color:var(--ink); font-size:16px; }
.empty-state p{ font-size:13.5px; margin:0; }

/* Alerts / flash */
.alert{ border-radius:var(--radius-md); padding:13px 16px; font-size:14px; margin-bottom:16px; display:flex; gap:10px; align-items:flex-start; }
.alert-success{ background:var(--green-bg); color:#155c34; }
.alert-error{ background:var(--red-bg); color:#8a2a2a; }
.alert-info{ background:var(--blue-bg); color:#1e3f7a; }

/* Login page */
.login-page{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--teal-900); padding:20px; }
.login-card{ width:100%; max-width:400px; padding:32px 28px; }
.login-logo{ text-align:center; margin-bottom:22px; }
.login-logo .mark{ width:52px; height:52px; border-radius:14px; background:var(--teal-800); color:#fff; display:flex; align-items:center; justify-content:center; margin:0 auto 12px; font-size:24px; }

/* Modals */
.modal-overlay{ position:fixed; inset:0; background:rgba(10,20,18,.45); display:none; align-items:center; justify-content:center; z-index:100; padding:16px; }
.modal-overlay.open{ display:flex; }
.modal{ background:#fff; border-radius:var(--radius-lg); width:100%; max-width:520px; max-height:90vh; overflow-y:auto; padding:24px; }
.modal.modal-lg{ max-width:760px; }
.modal-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.modal-close{ background:none; border:none; font-size:20px; cursor:pointer; color:var(--muted); }
.modal-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:20px; }

/* Meeting items table (dynamic rows) */
.items-table{ width:100%; border-collapse:separate; border-spacing:0 8px; }
.items-table th{ font-size:12px; padding:0 8px 4px; background:none; border:none; }
.items-table td{ padding:6px 8px; border:none; background:var(--bg); }
.items-table tr td:first-child{ border-radius:var(--radius-sm) 0 0 var(--radius-sm); }
.items-table tr td:last-child{ border-radius:0 var(--radius-sm) var(--radius-sm) 0; }
.items-table input{ padding:9px 10px; font-size:14px; }
.remove-item-btn{ background:none; border:none; color:var(--red); cursor:pointer; font-size:16px; padding:4px; }

.tabs{ display:flex; gap:6px; border-bottom:1px solid var(--border); margin-bottom:18px; }
.tab{ padding:10px 4px; font-size:14.5px; font-weight:600; color:var(--muted); border-bottom:2px solid transparent; cursor:pointer; margin-left:18px; }
.tab.active{ color:var(--teal-800); border-color:var(--teal-800); }

.timeline{ position:relative; padding-right:22px; }
.timeline::before{ content:''; position:absolute; right:6px; top:4px; bottom:4px; width:2px; background:var(--border); }
.timeline-item{ position:relative; padding-bottom:20px; }
.timeline-item::before{ content:''; position:absolute; right:-22px; top:4px; width:11px; height:11px; border-radius:50%; background:var(--teal-800); border:2px solid #fff; box-shadow:0 0 0 2px var(--teal-800); }
.timeline-item .t-time{ font-size:12px; color:var(--muted); }
.timeline-item .t-text{ font-size:14px; margin-top:2px; }

.info-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:14px 24px; }
@media (max-width:560px){ .info-grid{ grid-template-columns:1fr; } }
.info-grid .item .k{ font-size:12.5px; color:var(--muted); margin-bottom:3px; }
.info-grid .item .v{ font-size:14.5px; font-weight:600; }

.spinner{ width:16px; height:16px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation:spin .7s linear infinite; display:inline-block; }
@keyframes spin{ to{ transform:rotate(360deg); } }

.qr-box{ text-align:center; padding:30px; }
.qr-box #qrcode{ display:inline-block; padding:16px; background:#fff; border:1px solid var(--border); border-radius:var(--radius-md); }

/* ---------------------------------------------------------------------
   Toast notifications
   ------------------------------------------------------------------ */
.toast-stack{
  position:fixed; bottom:22px; left:50%; transform:translateX(-50%); z-index:200;
  display:flex; flex-direction:column; gap:10px; align-items:center; width:100%; max-width:420px; padding:0 16px;
  pointer-events:none;
}
.toast{
  pointer-events:auto; width:100%; background:#1B2A26; color:#fff; border-radius:var(--radius-md);
  padding:13px 16px; font-size:14px; display:flex; align-items:center; gap:10px; box-shadow:0 10px 30px -8px rgba(0,0,0,.35);
  opacity:0; transform:translateY(10px); transition:opacity .2s ease, transform .2s ease;
}
.toast.show{ opacity:1; transform:translateY(0); }
.toast-success{ background:#14532D; }
.toast-error{ background:#7A2222; }
.toast-info{ background:#1B2A26; }
.toast .icon{ font-size:16px; flex-shrink:0; }
.toast .msg{ flex:1; line-height:1.5; }

/* Button loading state */
.btn .spinner{ margin-left:4px; }
