/* =====================================================================
   ZAYUSH HEALTHCARE SERVICES — Theme
   Medical green + white healthcare theme, rounded cards, light glassmorphism,
   senior-citizen-friendly sizing, dark mode ready.
   ===================================================================== */

:root {
  --z-primary: #16a34a;         /* medical green */
  --z-primary-dark: #15803d;    /* primary hover */
  --z-primary-soft: #dcfce7;    /* primary light */
  --z-accent: #22c55e;          /* bright green accent */
  --z-success: #22c55e;
  --z-warning: #f2a916;
  --z-danger: #e0524d;
  --z-bg: #f8fffa;              /* muted green-white background */
  --z-surface: #ffffff;
  --z-surface-glass: rgba(255, 255, 255, 0.72);
  --z-text: #1f2937;           /* text primary */
  --z-text-muted: #6b7280;     /* text secondary */
  --z-border: #bbf7d0;         /* border green */
  --z-shadow: 0 6px 24px rgba(22, 163, 74, 0.10);
  --z-radius: 1rem;
  --z-radius-lg: 1.5rem;
}

[data-theme="dark"] {
  --z-primary: #4ade80;        /* bright green on dark */
  --z-primary-dark: #86efac;
  --z-primary-soft: #0f2e1a;
  --z-accent: #34d399;
  --z-bg: #0c1a12;             /* dark, subtly green background */
  --z-surface: #13251a;
  --z-surface-glass: rgba(19, 37, 26, 0.80);
  --z-text: #e6f2ea;
  --z-text-muted: #9db8a8;
  --z-border: #1f3a2a;
  --z-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--z-bg);
  color: var(--z-text);
  font-size: 1.02rem;         /* slightly larger for senior-friendly reading */
  min-height: 100vh;
}

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

/* ---------- Cards ---------- */
.z-card {
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius);
  box-shadow: var(--z-shadow);
}
.z-card .card-body { padding: 1.25rem; }

.z-glass {
  background: var(--z-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius-lg);
  box-shadow: var(--z-shadow);
}

/* ---------- Buttons: large, rounded, easy to tap ---------- */
.btn { border-radius: 0.85rem; padding: 0.65rem 1.35rem; font-weight: 700; }
.btn-lg { padding: 0.9rem 1.75rem; font-size: 1.12rem; }
.btn-primary {
  background: var(--z-primary);
  border-color: var(--z-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--z-primary-dark);
  border-color: var(--z-primary-dark);
}
.btn-outline-primary { color: var(--z-primary); border-color: var(--z-primary); }
.btn-outline-primary:hover { background: var(--z-primary); border-color: var(--z-primary); }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: 0.75rem;
  border: 1.5px solid var(--z-border);
  padding: 0.7rem 0.95rem;
  background: var(--z-surface);
  color: var(--z-text);
  font-size: 1rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--z-primary);
  box-shadow: 0 0 0 0.2rem rgba(22, 163, 74, 0.15);
  background: var(--z-surface);
  color: var(--z-text);
}
.form-label { font-weight: 700; margin-bottom: 0.35rem; }
.form-text { color: var(--z-text-muted); }

/* ---------- Public navbar ---------- */
.z-navbar {
  background: var(--z-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--z-border);
}
.z-navbar .navbar-brand { font-weight: 800; color: var(--z-primary); font-size: 1.3rem; }
.z-navbar .nav-link { color: var(--z-text); font-weight: 600; }
.z-navbar .nav-link.active, .z-navbar .nav-link:hover { color: var(--z-primary); }

/* ---------- Hero ---------- */
.z-hero {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(34, 197, 94, 0.18), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(22, 163, 74, 0.16), transparent 55%),
    linear-gradient(160deg, var(--z-primary-soft), var(--z-bg) 70%);
  border-radius: 0 0 var(--z-radius-lg) var(--z-radius-lg);
  padding: 4.5rem 0 3.5rem;
}
.z-hero h1 { font-weight: 800; letter-spacing: -0.5px; }
.z-hero .lead { color: var(--z-text-muted); font-size: 1.18rem; }

/* ---------- Service cards ---------- */
.z-service-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  height: 100%;
  cursor: pointer;
}
.z-service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 34px rgba(22, 163, 74, 0.18);
}
.z-service-icon {
  width: 58px; height: 58px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 1rem;
  background: var(--z-primary-soft);
  color: var(--z-primary);
  font-size: 1.65rem;
}

/* ---------- Stat tiles ---------- */
.z-stat {
  border-radius: var(--z-radius);
  padding: 1.15rem 1.3rem;
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  box-shadow: var(--z-shadow);
  height: 100%;
}
.z-stat .z-stat-value { font-size: 1.7rem; font-weight: 800; color: var(--z-primary); }
.z-stat .z-stat-label { color: var(--z-text-muted); font-weight: 600; font-size: 0.92rem; }

/* ---------- App shell (dashboards) ---------- */
.z-sidebar {
  width: 250px;
  min-height: 100vh;
  background: var(--z-surface);
  border-right: 1px solid var(--z-border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1040;
  padding: 1.25rem 0.9rem;
  overflow-y: auto;
  transition: transform 0.25s ease;
}
.z-sidebar .z-brand { font-weight: 800; color: var(--z-primary); font-size: 1.2rem; padding: 0 0.65rem; }
.z-sidebar .nav-link {
  color: var(--z-text);
  font-weight: 600;
  border-radius: 0.75rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.2rem;
  display: flex; align-items: center; gap: 0.7rem;
}
.z-sidebar .nav-link i { font-size: 1.15rem; width: 1.4rem; text-align: center; }
.z-sidebar .nav-link:hover { background: var(--z-primary-soft); color: var(--z-primary); }
.z-sidebar .nav-link.active { background: var(--z-primary); color: #fff; }

.z-main { margin-left: 250px; padding: 1.5rem; min-height: 100vh; }

.z-topbar {
  background: var(--z-surface-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius);
  padding: 0.7rem 1.1rem;
  margin-bottom: 1.4rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  /* backdrop-filter creates a stacking context; without an explicit z-index the
     profile dropdown paints BELOW later page elements (alerts, glass cards). */
  position: relative;
  z-index: 1020;
}

@media (max-width: 991.98px) {
  .z-sidebar { transform: translateX(-105%); }
  .z-sidebar.show { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,0.35); }
  .z-main { margin-left: 0; padding: 1rem 0.9rem 5.5rem; }
}

.z-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10, 25, 40, 0.45);
  z-index: 1035;
}
.z-backdrop.show { display: block; }

/* ---------- Bottom navigation (patients, mobile) ---------- */
.z-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1030;
  display: flex;
  background: var(--z-surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--z-border);
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom));
}
.z-bottom-nav a {
  flex: 1;
  text-align: center;
  color: var(--z-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0;
}
.z-bottom-nav a i { display: block; font-size: 1.35rem; margin-bottom: 0.1rem; }
.z-bottom-nav a.active { color: var(--z-primary); }
@media (min-width: 992px) { .z-bottom-nav { display: none; } }

/* ---------- Tables ---------- */
.z-table-wrap {
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius);
  box-shadow: var(--z-shadow);
  overflow-x: auto;
}
.z-table-wrap table { margin-bottom: 0; }
.table { color: var(--z-text); }
.table > :not(caption) > * > * { background: transparent; color: inherit; border-color: var(--z-border); padding: 0.85rem 1rem; }
.table thead th {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--z-text-muted); background: var(--z-primary-soft);
}
.table-hover tbody tr:hover > * { background: var(--z-primary-soft); }

/* ---------- Badges / timeline ---------- */
.badge { font-weight: 700; padding: 0.45em 0.8em; }

.z-timeline { list-style: none; padding-left: 0; margin: 0; }
.z-timeline li { position: relative; padding: 0 0 1.1rem 1.75rem; }
.z-timeline li::before {
  content: ""; position: absolute; left: 0.42rem; top: 0.45rem; bottom: -0.3rem;
  width: 2px; background: var(--z-border);
}
.z-timeline li:last-child::before { display: none; }
.z-timeline li::after {
  content: ""; position: absolute; left: 0; top: 0.32rem;
  width: 0.95rem; height: 0.95rem; border-radius: 50%;
  background: var(--z-primary); border: 3px solid var(--z-primary-soft);
}

/* ---------- Misc ---------- */
.z-section-title { font-weight: 800; letter-spacing: -0.3px; }
.text-muted, .form-text { color: var(--z-text-muted) !important; }
.page-link { color: var(--z-primary); border-color: var(--z-border); background: var(--z-surface); }
.page-item.active .page-link { background: var(--z-primary); border-color: var(--z-primary); }
.dropdown-menu { background: var(--z-surface); border-color: var(--z-border); box-shadow: var(--z-shadow); }
.dropdown-item { color: var(--z-text); }
.dropdown-item:hover { background: var(--z-primary-soft); color: var(--z-primary); }
.modal-content { background: var(--z-surface); color: var(--z-text); border-radius: var(--z-radius); border-color: var(--z-border); }
.alert { border-radius: var(--z-radius); }
.z-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--z-primary-soft); color: var(--z-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800;
  overflow: hidden;
}
.z-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
footer.z-footer {
  background: var(--z-surface);
  border-top: 1px solid var(--z-border);
  margin-top: 4rem;
  padding: 2.5rem 0 1.5rem;
  color: var(--z-text-muted);
}
footer.z-footer h6 { color: var(--z-text); font-weight: 800; }

.z-otp-input { letter-spacing: 0.6em; text-align: center; font-size: 1.3rem; font-weight: 800; }

/* =====================================================================
   Hardening & polish — additive safety net (no design-token changes)
   ===================================================================== */

/* Media never overflows its container */
img, svg, video { max-width: 100%; height: auto; }

/* Long unbroken strings (emails, booking codes, URLs) wrap instead of
   forcing horizontal scroll or bleeding out of cards. */
body { overflow-wrap: break-word; }

/* Keyboard-only focus ring — clear, consistent, accessible.
   Uses :focus-visible so mouse clicks don't show the ring. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.page-link:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible {
  outline: 3px solid var(--z-primary);
  outline-offset: 2px;
  box-shadow: none;
}

/* Tactile press feedback on primary tap targets */
.btn { transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.btn:active { transform: translateY(1px); }

/* Card hover lift for interactive stat/service tiles that link somewhere */
a .z-stat, a .z-card { transition: transform 0.16s ease, box-shadow 0.16s ease; }
a:hover .z-stat { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(22, 163, 74, 0.16); }

/* Tables: keep rows vertically centred. The .z-table-wrap already provides
   horizontal scroll for wide tables, so no forced min-width (which would add
   unwanted scroll to naturally narrow tables). */
.table > :not(caption) > * > * { vertical-align: middle; }

/* Bootstrap subtle badges (bg-*-subtle) — guarantee readable weight */
.badge.bg-primary-subtle { background: var(--z-primary-soft) !important; color: var(--z-primary) !important; }

/* Avatar/topbar buttons keep an accessible min tap size on mobile */
.z-topbar .btn-link { min-width: 40px; min-height: 40px; }

/* ---------- Profile photo widget ---------- */
.z-photo { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.z-photo-preview {
  flex-shrink: 0;
  width: 92px; height: 92px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--z-border);
  background: var(--z-primary-soft);
  display: inline-flex; align-items: center; justify-content: center;
}
.z-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.z-photo-initial { font-size: 2rem; font-weight: 800; color: var(--z-primary); }
.z-photo-controls { flex: 1 1 220px; min-width: 200px; }
.z-photo-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Camera capture overlay ---------- */
.z-cam-overlay {
  display: none;
  position: fixed; inset: 0;
  z-index: 2050;
  background: rgba(0, 0, 0, 0.85);
  align-items: center; justify-content: center;
  padding: 1rem;
}
.z-cam-overlay.show { display: flex; }
.z-cam-box { width: 100%; max-width: 480px; text-align: center; }
.z-cam-video {
  width: 100%;
  max-height: 70vh;
  border-radius: var(--z-radius);
  background: #000;
  transform: scaleX(-1); /* mirror preview for a natural selfie feel */
}
.z-cam-bar {
  display: flex; align-items: center; justify-content: center; gap: 1.5rem;
  margin-top: 1rem;
}
.z-cam-shutter {
  width: 64px; height: 64px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}

/* ---------- Prescription scanner ---------- */
.z-scan {
  border: 1.5px dashed var(--z-border);
  border-radius: var(--z-radius);
  padding: 0.85rem;
  background: var(--z-surface);
}
.z-scan-pages { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.z-scan-page {
  position: relative;
  width: 104px; height: 132px;
  border-radius: 0.6rem;
  overflow: hidden;
  border: 1px solid var(--z-border);
  background: var(--z-bg);
}
.z-scan-page img { width: 100%; height: 100%; object-fit: cover; }
.z-scan-page__no {
  position: absolute; top: 4px; left: 4px;
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 0.7rem; font-weight: 700;
  border-radius: 999px; padding: 0.05rem 0.45rem;
}
.z-scan-page__bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  background: rgba(0,0,0,0.62);
  padding: 0.2rem 0;
}
.z-scan-page__bar button {
  border: 0; background: transparent; color: #fff;
  font-size: 0.85rem; line-height: 1; padding: 0.2rem 0.35rem; cursor: pointer;
}
.z-scan-page__bar button:hover { color: #4ade80; }

.z-cam-video--doc { transform: none; } /* documents: no mirror */
.z-pdf-box { width: 100%; max-width: 720px; }
.z-pdf-frame {
  width: 100%; height: 72vh;
  border: 0; border-radius: var(--z-radius);
  background: #fff;
}

/* ---------- Assignment picker cards ---------- */
.z-assign-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.85rem;
  border: 1.5px solid var(--z-border);
  border-radius: var(--z-radius);
  background: var(--z-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.z-assign-card:hover { border-color: var(--z-primary); box-shadow: var(--z-shadow); }
.z-assign-card--sel { border-color: var(--z-primary); box-shadow: 0 0 0 0.18rem rgba(22, 163, 74, 0.18); }
.z-assign-card--best { border-color: var(--z-primary); }
.z-assign-card--off { opacity: 0.62; cursor: not-allowed; }
.z-assign-card--off:hover { border-color: var(--z-border); box-shadow: none; }
.z-assign-radio { flex-shrink: 0; margin-top: 0.25rem; }
.z-assign-avatar {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--z-primary-soft); color: var(--z-primary);
  font-weight: 800; font-size: 1.15rem;
}
.z-assign-avatar img { width: 100%; height: 100%; object-fit: cover; }
.z-assign-body { flex: 1 1 auto; min-width: 0; }

/* ---------- Floating WhatsApp contact button ---------- */
.z-whatsapp-fab {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 1025;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 56px;
  padding: 0 1.05rem;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
  overflow: hidden;
}
.z-whatsapp-fab:hover,
.z-whatsapp-fab:focus-visible {
  color: #fff;
  background: #1ebe5b;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 30px rgba(37, 211, 102, 0.55);
}
.z-whatsapp-fab i { font-size: 1.75rem; line-height: 1; }
.z-whatsapp-fab__label {
  max-width: 0;
  opacity: 0;
  white-space: nowrap;
  transition: max-width 0.25s ease, opacity 0.2s ease;
}
.z-whatsapp-fab:hover .z-whatsapp-fab__label,
.z-whatsapp-fab:focus-visible .z-whatsapp-fab__label {
  max-width: 160px;
  opacity: 1;
}
/* Gentle attention pulse (respects reduced-motion via the block below) */
.z-whatsapp-fab::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
  animation: z-wa-pulse 2.4s ease-out infinite;
}
@keyframes z-wa-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
  70%  { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}
/* Raise above the mobile bottom-nav when one is present (patient/professional) */
@media (max-width: 991.98px) {
  .z-bottom-nav ~ .z-whatsapp-fab { bottom: calc(4.9rem + env(safe-area-inset-bottom)); }
  .z-whatsapp-fab { height: 52px; }
  .z-whatsapp-fab i { font-size: 1.6rem; }
}
@media print { .z-whatsapp-fab { display: none !important; } }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .z-sidebar, .z-topbar, .z-bottom-nav, .btn, .no-print { display: none !important; }
  .z-main { margin: 0; padding: 0; }
  body { background: #fff; }
}
