/* ============ CarePoint patient PWA ============ */

:root {
  --brand: #0117e6;        /* Hijraa royal blue */
  --brand-dark: #0112b8;
  --brand-deep: #0a0d66;
  --accent: #0ea5e9;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #e2e8f0;
  --danger: #ef4444;
  --radius: 18px;
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, .18);
  --shadow-soft: 0 4px 16px -8px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  color: #fff;
  padding: 26px 22px 74px;
  background:
    radial-gradient(120% 140% at 85% -20%, rgba(14, 165, 233, .55), transparent 55%),
    radial-gradient(120% 120% at -10% 110%, rgba(255, 64, 64, .22), transparent 55%),
    linear-gradient(135deg, #0a0d66 0%, #0117e6 60%, #0112b8 100%);
  border-radius: 0 0 34px 34px;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M56 20h8v36h36v8H64v36h-8V64H20v-8h36z' fill='%23ffffff' fill-opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-top {
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}

.clinic-badge { display: flex; align-items: center; gap: 12px; }

.clinic-logo {
  width: 52px; height: 52px; border-radius: 14px;
  background: #ffffff;
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  overflow: hidden;
}
.clinic-logo img { width: 46px; height: auto; display: block; }

.clinic-name { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.clinic-sub { font-size: 12px; opacity: .8; }

.hero h1 {
  position: relative; z-index: 1;
  margin-top: 26px;
  font-size: 27px; line-height: 1.25; font-weight: 800; letter-spacing: -.3px;
}
.hero p.lead { position: relative; z-index: 1; margin-top: 8px; font-size: 14px; opacity: .85; max-width: 30ch; }

.open-pill {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 16px; padding: 7px 13px;
  border-radius: 100px; font-size: 12.5px; font-weight: 600;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(6px);
}
.open-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, .25); }

/* ---------- content ---------- */

.content { flex: 1; padding: 0 18px 110px; margin-top: -46px; position: relative; z-index: 2; }

.section-title {
  font-size: 16px; font-weight: 700; letter-spacing: -.2px;
  margin: 26px 4px 12px;
  display: flex; align-items: baseline; justify-content: space-between;
}
.section-title small { font-size: 12px; font-weight: 500; color: var(--ink-faint); }

/* quick actions card */
.quick-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

.quick-btn {
  border-radius: 14px;
  padding: 16px 14px;
  text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease;
  border: 1px solid var(--line);
}
.quick-btn:active { transform: scale(.97); }
.quick-btn .qi {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; font-size: 19px;
}
.quick-btn b { font-size: 14px; }
.quick-btn span { font-size: 12px; color: var(--ink-soft); }
.quick-btn.primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #0117e6, #2434e8);
  color: #fff; border: 0;
  box-shadow: 0 12px 24px -10px rgba(1, 23, 230, .45);
}
.quick-btn.primary .qi { background: rgba(255, 255, 255, .18); }
.quick-btn.primary span { color: rgba(255, 255, 255, .8); }
.quick-btn:not(.primary) .qi { background: #eef0ff; }

/* service / doctor cards */
.card-list { display: flex; flex-direction: column; gap: 10px; }

.pick-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  width: 100%;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.pick-card:active { transform: scale(.985); }
.pick-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(1, 23, 230, .14), var(--shadow-soft);
}
.pick-card .emoji {
  width: 46px; height: 46px; flex: none;
  border-radius: 13px; background: #eef0ff;
  display: grid; place-items: center; font-size: 22px;
  overflow: hidden;
}
.pick-card .emoji img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-card:disabled { opacity: .45; cursor: not-allowed; }
.pick-card .avatar {
  width: 46px; height: 46px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  overflow: hidden;
}
.pick-card .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-card .body { flex: 1; min-width: 0; }
.pick-card .body b { display: block; font-size: 14.5px; letter-spacing: -.1px; }
.pick-card .body span { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
/* service card with package details */
.svc-card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.svc-card > .pick-card { border: 0; border-radius: 0; }
.svc-details { padding: 0 16px 14px; }
.svc-pk-title {
  font-size: 12px; font-weight: 700; color: var(--brand-dark);
  padding-top: 12px; border-top: 1px dashed var(--line); margin-bottom: 6px;
}
.svc-pk {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 7px 0;
}
.svc-pk + .svc-pk { border-top: 1px solid var(--line); }
.svc-pk b { display: block; font-size: 13.5px; }
.svc-pk small { display: block; font-size: 11.5px; color: #047857; margin-top: 2px; }
.svc-price {
  flex: none; font-weight: 800; font-size: 13.5px; color: var(--brand-dark);
  background: #eef0ff; border-radius: 100px; padding: 3px 10px;
}
.svc-note { font-size: 12px; color: var(--ink-soft); margin-top: 8px; line-height: 1.45; }
.svc-terms {
  font-size: 12px; color: #b45309; background: #fffbeb;
  border: 1px solid #fde68a; border-radius: 10px;
  padding: 8px 10px; margin-top: 10px; line-height: 1.45;
}
.booking-terms {
  margin-top: 12px; font-size: 12px; line-height: 1.5; color: var(--ink-soft);
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 10px 12px;
}
.booking-terms p + p { margin-top: 4px; }

.pick-card .meta { text-align: right; flex: none; }
.pick-card .meta b { display: block; font-size: 13.5px; color: var(--brand-dark); }
.pick-card .meta span { font-size: 11.5px; color: var(--ink-faint); }
.pick-card .check {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 2px solid var(--line);
  display: grid; place-items: center;
}
.pick-card.selected .check { border-color: var(--brand); background: var(--brand); }
.pick-card.selected .check::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 800; }

/* ---------- wizard chrome ---------- */

.wizard-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 6px;
}
.back-btn {
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--card); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 17px;
  box-shadow: var(--shadow-soft);
}
.wizard-head .wh-text b { display: block; font-size: 16.5px; letter-spacing: -.2px; }
.wizard-head .wh-text span { font-size: 12px; color: var(--ink-faint); }

.progress {
  display: flex; gap: 6px; padding: 12px 18px 4px;
}
.progress i {
  height: 4px; flex: 1; border-radius: 4px;
  background: var(--line);
}
.progress i.on { background: var(--brand); }

/* ---------- monthly booking calendar ---------- */

.pcal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 16px 14px 12px;
}
.pcal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 12px;
}
.pcal-head b { font-size: 15.5px; letter-spacing: -.2px; }
.pcal-head button {
  width: 34px; height: 34px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 16px; color: var(--ink-soft);
  display: grid; place-items: center;
}
.pcal-head button:disabled { opacity: .3; }
.pcal-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; margin-bottom: 4px;
}
.pcal-dow span { font-size: 11px; font-weight: 700; color: var(--ink-faint); }
.pcal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.pcal-day {
  aspect-ratio: 1;
  border-radius: 12px;
  font-size: 14px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; position: relative;
  color: var(--ink);
  transition: all .12s;
}
.pcal-day .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--brand); }
.pcal-day.on { background: #eef0ff; }
.pcal-day.on:active { transform: scale(.92); }
.pcal-day.off { color: #c6cdd9; pointer-events: none; }
.pcal-day.dim { visibility: hidden; }
.pcal-day.today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.pcal-day.sel {
  background: linear-gradient(160deg, #0117e6, #0112b8);
  color: #fff;
  box-shadow: 0 8px 16px -6px rgba(1, 23, 230, .5);
}
.pcal-day.sel .dot { background: #fff; }
.pcal-legend {
  display: flex; gap: 18px; justify-content: center;
  margin-top: 12px; font-size: 12px; color: var(--ink-soft);
}
.pcal-legend i {
  display: inline-block; width: 12px; height: 12px; border-radius: 4px;
  vertical-align: -1px; margin-right: 5px;
}
.pcal-legend .lg-on { background: #eef0ff; box-shadow: inset 0 0 0 1.5px var(--brand); }
.pcal-legend .lg-off { background: #eceef2; }

.picked-date {
  font-size: 14px; font-weight: 700;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 13px; padding: 12px 16px;
  box-shadow: var(--shadow-soft);
}

/* date scroller */
.date-strip {
  display: flex; gap: 9px; overflow-x: auto;
  padding: 4px 2px 10px;
  scrollbar-width: none;
}
.date-strip::-webkit-scrollbar { display: none; }

.date-chip {
  flex: none; width: 62px; padding: 11px 0 10px;
  border-radius: 15px;
  background: var(--card); border: 1.5px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: all .15s;
}
.date-chip small { font-size: 11px; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; }
.date-chip b { font-size: 19px; letter-spacing: -.3px; }
.date-chip span { font-size: 10.5px; color: var(--ink-faint); }
.date-chip.selected {
  background: linear-gradient(160deg, #0117e6, #0112b8);
  border-color: transparent; color: #fff;
  box-shadow: 0 10px 20px -8px rgba(1, 23, 230, .45);
}
.date-chip.selected small, .date-chip.selected span { color: rgba(255, 255, 255, .75); }
.date-chip.closed { opacity: .38; }

/* slot grid */
.slot-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px;
}
.slot-group-label {
  grid-column: 1 / -1;
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  margin: 8px 2px 0;
}
.slot {
  padding: 12px 0; border-radius: 12px; text-align: center;
  font-size: 13.5px; font-weight: 600;
  background: var(--card); border: 1.5px solid var(--line);
  transition: all .12s;
}
.slot.selected {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 8px 16px -6px rgba(1, 23, 230, .4);
}
.slot-empty {
  grid-column: 1 / -1; text-align: center;
  color: var(--ink-faint); font-size: 13.5px;
  padding: 26px 0;
  background: var(--card); border-radius: var(--radius);
  border: 1.5px dashed var(--line);
}

/* form */
.form-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-soft); border: 1px solid var(--line);
  padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 14.5px; background: #fbfdff;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(1, 23, 230, .13);
}
.field textarea { resize: vertical; min-height: 74px; }

/* summary */
.summary-card {
  background: linear-gradient(150deg, #0a0d66, #0112b8 60%, #0117e6);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.summary-row { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
.summary-row .k { opacity: .72; }
.summary-row .v { font-weight: 600; text-align: right; }
.summary-card hr { border: 0; border-top: 1px dashed rgba(255, 255, 255, .28); }

/* CTA */
.cta-bar {
  position: sticky; bottom: 86px; z-index: 5;
  padding: 10px 0 0;
}
.cta {
  width: 100%; padding: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0117e6, #2434e8);
  color: #fff; font-size: 15.5px; font-weight: 700; letter-spacing: .2px;
  box-shadow: 0 14px 28px -10px rgba(1, 23, 230, .5);
  transition: transform .12s, opacity .15s;
}
.cta:active { transform: scale(.98); }
.cta:disabled { opacity: .45; pointer-events: none; }

/* ---------- success ---------- */

.success-wrap { text-align: center; padding-top: 26px; }
.success-ring {
  width: 92px; height: 92px; margin: 0 auto 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #4d5bff, #0117e6);
  display: grid; place-items: center;
  box-shadow: 0 18px 40px -12px rgba(1, 23, 230, .5);
  animation: pop .5s cubic-bezier(.2, 1.6, .4, 1);
}
.success-ring svg { width: 44px; height: 44px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

.success-wrap h2 { font-size: 22px; letter-spacing: -.3px; }
.success-wrap p { color: var(--ink-soft); font-size: 13.5px; margin-top: 6px; }

.ref-chip {
  display: inline-block; margin-top: 14px;
  font-size: 20px; font-weight: 800; letter-spacing: 3px;
  background: #fff; color: var(--brand-deep);
  border: 1.5px dashed var(--brand);
  padding: 10px 22px; border-radius: 14px;
}

/* ---------- appointments list ---------- */

.appt-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  padding: 15px 16px;
  display: flex; gap: 14px; align-items: center;
}
.appt-date {
  flex: none; width: 56px; text-align: center;
  background: #eef0ff; border-radius: 13px; padding: 9px 0;
}
.appt-date b { display: block; font-size: 19px; color: var(--brand-dark); }
.appt-date span { font-size: 10.5px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; }
.appt-body { flex: 1; min-width: 0; }
.appt-body b { font-size: 14px; display: block; }
.appt-body span { font-size: 12.5px; color: var(--ink-soft); display: block; margin-top: 2px; }
.status-pill {
  flex: none; font-size: 11px; font-weight: 700;
  padding: 5px 10px; border-radius: 100px; color: #fff;
}
.appt-cancel {
  font-size: 12px; font-weight: 600; color: var(--danger);
  margin-top: 6px;
}
.empty-state {
  text-align: center; padding: 44px 20px; color: var(--ink-faint);
  background: var(--card); border-radius: var(--radius); border: 1.5px dashed var(--line);
}
.empty-state .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- bottom nav ---------- */

.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; color: var(--ink-faint);
  padding: 6px 0; border-radius: 12px;
  transition: color .15s;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--brand-dark); }
.nav-item.active .nav-ico { background: #dde2ff; }
.nav-ico {
  width: 42px; height: 28px; border-radius: 100px;
  display: grid; place-items: center;
  transition: background .15s;
}

/* views */
.view { display: none; animation: fadeIn .25s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 106px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  padding: 11px 20px; border-radius: 100px;
  font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: all .25s ease;
  z-index: 60; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.muted-note { font-size: 12px; color: var(--ink-faint); text-align: center; margin-top: 14px; }
.admin-link { color: var(--brand-dark); font-weight: 600; text-decoration: none; }
