/* ============================================================
   Fix My Appointment — Dashboard shell & widgets (dashboard.css)
   Used by all six role dashboards.
   ============================================================ */

.dash-layout { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - var(--nav-height)); }

/* ---------- Sidebar (Component: Sidebar_Dashboard) ---------- */
.dash-sidebar {
  background: var(--ink-900); color: #B9CFCC; padding: 24px 14px;
  position: sticky; top: var(--nav-height); height: calc(100vh - var(--nav-height)); overflow-y: auto;
}
.dash-role-chip {
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; background: rgba(255,255,255,0.1); color: #fff;
  padding: 6px 12px; border-radius: 999px; display: inline-block; margin: 0 10px 18px;
}
.dash-nav { list-style: none; margin: 0; padding: 0; }
.dash-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
  color: #B9CFCC; font-size: 0.92rem; font-weight: 500; margin-bottom: 3px;
}
.dash-nav a:hover { background: rgba(255,255,255,0.07); color: #fff; text-decoration: none; }
.dash-nav a.active { background: var(--teal-600); color: #fff; }
.dash-nav .nav-icon { width: 20px; text-align: center; opacity: 0.85; }
.dash-nav-label {
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: #6E8A87;
  padding: 18px 14px 8px; font-weight: 700;
}

/* ---------- Main area ---------- */
.dash-main { padding: 32px 34px; background: var(--bg); min-width: 0; }
.dash-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 28px; }
.dash-header h1 { font-size: 1.6rem; margin: 0; }
.dash-header .muted { font-size: 0.9rem; }

/* ---------- Stat cards (Component: Card_DashboardStat) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--teal-600); border-radius: 4px 0 0 4px;
}
.stat-card.accent::before { background: var(--saffron-500); }
.stat-card.green::before { background: var(--green-600); }
.stat-card.red::before { background: var(--red-600); }
.stat-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; color: var(--ink-900); line-height: 1.1; }
.stat-label { font-size: 0.82rem; color: var(--ink-400); font-weight: 600; margin-top: 4px; }

/* ---------- Panels ---------- */
.dash-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 26px; margin-bottom: 24px;
}
.dash-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.dash-panel-head h2 { font-size: 1.15rem; margin: 0; }

/* Appointment card (Component: Card_Appointment) */
.appt-card {
  display: flex; gap: 16px; align-items: center; padding: 15px 18px;
  border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; background: var(--surface);
}
.appt-time {
  flex: none; text-align: center; background: var(--teal-050); border-radius: 10px; padding: 10px 14px;
  font-family: var(--font-display); font-weight: 700; color: var(--teal-700); font-size: 0.9rem; min-width: 86px;
}
.appt-body { flex: 1; min-width: 0; }
.appt-body b { color: var(--ink-900); }
.appt-body small { color: var(--ink-400); display: block; }

/* Status pills for appointment statuses */
.status-Pending { background: var(--amber-100); color: var(--amber-600); }
.status-Confirmed { background: var(--teal-100); color: var(--teal-700); }
.status-CheckedIn, .status-InConsultation { background: #E3E8FB; color: #3C50B4; }
.status-Completed { background: var(--green-100); color: var(--green-600); }
.status-Cancelled, .status-NoShow { background: var(--red-100); color: var(--red-600); }
.status-Rescheduled { background: #F2E8FB; color: #7B3CB4; }

/* Search filter bar (Component: Filter_DoctorFinder) */
.filter-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; margin-bottom: 24px;
}

/* Dashboard sections toggle */
.dash-section { display: none; }
.dash-section.active { display: block; animation: panelIn 0.2s ease; }

/* Impersonation banner (Super Admin "Act as role") */
.impersonation-banner {
  background: var(--saffron-500); color: #fff; text-align: center; padding: 9px 16px;
  font-size: 0.88rem; font-weight: 600;
}
.impersonation-banner button { background: #fff; color: var(--saffron-600); border: none; border-radius: 6px; padding: 4px 12px; margin-left: 10px; cursor: pointer; font-weight: 700; }

@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar {
    position: static; height: auto; display: flex; overflow-x: auto; padding: 10px;
    gap: 4px; align-items: center;
  }
  .dash-role-chip { margin: 0 8px 0 4px; white-space: nowrap; }
  .dash-nav { display: flex; gap: 4px; }
  .dash-nav a { white-space: nowrap; padding: 9px 12px; margin: 0; }
  .dash-nav-label { display: none; }
  .dash-main { padding: 20px 16px; }
}

/* ---------- Pricing cards (Dash_Pricing) + usage meter (Dash_Billing) ----------
   Uses the same design tokens as the rest of the dashboard (--teal-*, --border,
   --surface) so plans don't look like a bolted-on marketing page. */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }
.pricing-card {
  position: relative; border: 1.5px solid var(--border); border-radius: 14px;
  padding: 22px 20px; background: var(--surface); display: flex; flex-direction: column;
}
.pricing-card-current { border-color: var(--teal-600); box-shadow: 0 0 0 3px var(--teal-050); }
.pricing-badge {
  position: absolute; top: -11px; left: 20px; background: var(--teal-600); color: #fff;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.pricing-card h3 { font-family: var(--font-display); font-size: 1.15rem; margin: 0 0 6px; }
.pricing-price { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; color: var(--teal-700); margin-bottom: 4px; }
.pricing-features { list-style: none; padding: 0; margin: 14px 0 18px; flex: 1; }
.pricing-features li {
  position: relative; padding-left: 22px; margin-bottom: 8px; font-size: 0.9rem; color: var(--ink-700, #2A4744);
}
.pricing-features li::before {
  content: "✓"; position: absolute; left: 0; top: 0; color: var(--teal-600); font-weight: 800;
}
.usage-bar { height: 10px; border-radius: 999px; background: var(--teal-050, #EAF6F4); overflow: hidden; }
.usage-bar-fill { height: 100%; background: var(--teal-600); border-radius: 999px; transition: width 0.3s ease; }
.usage-bar-fill.usage-bar-warn { background: var(--saffron-500, #F08A24); }
@media (max-width: 860px) { .pricing-grid { grid-template-columns: 1fr; } }

/* ============================================================
   SUBSCRIPTION COUPONS
   Clinic-facing coupon field on Pricing, plus the Super Admin
   coupon table. Every colour here is an existing token from
   style.css — no new variables are invented, because a made-up
   var() name silently renders as no style at all.
   ============================================================ */

/* --- Clinic: the coupon field above the plan cards --- */
.coupon-box {
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
  max-width: 520px;
}
/* .coupon-row (input + button flex row) is reused from forms.css — the
   registration wizard's coupon field already defines exactly this shape. */
.coupon-box .coupon-row { margin-top: 8px; }
.coupon-featured { margin-top: 8px; color: var(--teal-700); }
.coupon-box-applied {
  border: 1px solid var(--green-600); border-style: solid;
  background: var(--green-100); color: var(--ink-900);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  max-width: 100%;
}
.coupon-tick {
  display: inline-grid; place-items: center; width: 20px; height: 20px;
  border-radius: 999px; background: var(--green-600); color: #fff;
  font-size: 0.75rem; font-weight: 800; margin-right: 6px; vertical-align: -3px;
}
.coupon-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em; font-weight: 700;
}
.coupon-note { border-left: 3px solid var(--green-600); }

/* --- Clinic: discounted pricing cards --- */
.pricing-card-discounted { border-color: var(--green-600); }
/* The old price sits in its own tight row rather than reusing .pricing-price,
   whose 1.8rem type left a large empty band above the real (discounted)
   figure — the number that actually matters was the one that looked
   secondary. */
.pricing-was-row { line-height: 1.25; margin-bottom: 2px; }
.pricing-was {
  text-decoration: line-through; color: var(--ink-600);
  font-size: 1.05rem; font-weight: 600; opacity: 0.75;
}
.pricing-price.pricing-now { color: var(--green-600); margin-bottom: 2px; }
.pricing-save {
  font-size: 0.82rem; font-weight: 600; color: var(--green-600);
  background: var(--green-100); border-radius: 999px;
  padding: 3px 10px; display: inline-block; margin-bottom: 6px;
}

/* --- Super Admin: create form + coupon table --- */
.coupon-create { max-width: 720px; }
.coupon-table td { vertical-align: middle; }
/* A switched-off, expired or exhausted coupon still has to be readable —
   dimmed, not hidden, since "where did my code go?" is worse than a faded row. */
.coupon-row-off { opacity: 0.55; }
.coupon-dead { color: var(--red-600); font-weight: 600; }
.btn-link-danger {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--red-600); font: inherit; font-size: 0.88rem;
  text-decoration: underline; text-underline-offset: 2px;
}
.btn-link-danger:hover { opacity: 0.75; }
.btn-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--teal-700); font: inherit; font-size: 0.88rem;
  text-decoration: underline; text-underline-offset: 2px;
}
.btn-link:hover { opacity: 0.75; }
.btn-link:disabled { opacity: 0.5; cursor: default; text-decoration: none; }

/* Toggle switch. Named fma-switch rather than .switch to stay clear of any
   framework/browser default, and built on a real checkbox so it remains
   keyboard-focusable and screen-reader-correct. */
.fma-switch { display: inline-block; position: relative; width: 42px; height: 24px; cursor: pointer; }
.fma-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.fma-switch span {
  position: absolute; inset: 0; border-radius: 999px;
  background: #C9D6D4; transition: background 0.18s ease; pointer-events: none;
}
.fma-switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform 0.18s ease; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.fma-switch input:checked + span { background: var(--green-600); }
.fma-switch input:checked + span::after { transform: translateX(18px); }
.fma-switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--teal-100); }
.fma-switch input:disabled + span { opacity: 0.5; }

/* Narrow screens: the applied-coupon banner is a two-column flex row on
   desktop, which squeezes the Remove button against wrapping text on a
   phone. Stack it instead. */
@media (max-width: 560px) {
  .coupon-box-applied { flex-direction: column; align-items: stretch; gap: 10px; }
  .coupon-box-applied .btn { width: 100%; }
}
