/* ============================================================
   BrightSmile Admin — staff dashboard (slate / indigo)
   ============================================================ */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --sidebar-1: #0b1220;
  --sidebar-2: #111a2e;
  --ink: #0f172a;
  --slate: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-2: #eef2f7;

  --indigo: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-50: #eef2ff;

  /* status */
  --st-req: #d97706;      --st-req-bg: #fffbeb;   --st-req-line: #f59e0b;
  --st-conf: #059669;     --st-conf-bg: #ecfdf5;  --st-conf-line: #10b981;
  --st-comp: #2563eb;     --st-comp-bg: #eff6ff;  --st-comp-line: #3b82f6;
  --st-canc: #e11d48;     --st-canc-bg: #fff1f2;  --st-canc-line: #f43f5e;
  --st-no: #64748b;       --st-no-bg: #f1f5f9;    --st-no-line: #94a3b8;

  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --shadow: 0 10px 28px -14px rgba(15,23,42,.25);
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --gutter: 60px;
  --pph: 58px; /* px per hour */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--slate);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
h1, h2, h3, h4 { color: var(--ink); margin: 0; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
/* FocusOnNavigate programmatically focuses the page heading — hide that ring. */
[tabindex="-1"]:focus { outline: none; }

/* ---------- Dashboard shell ---------- */
.page { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: none; align-self: stretch;
  background: linear-gradient(180deg, var(--sidebar-1), var(--sidebar-2));
  color: #cbd5e1; position: sticky; top: 0; height: 100vh;
}
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 24px 28px 48px; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 14px 28px;
}
.topbar h1 { font-size: 1.35rem; }
.topbar__spacer { margin-left: auto; }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--indigo); --f: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; font-size: .92rem; line-height: 1;
  padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--b); color: var(--f); cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  box-shadow: 0 6px 16px -8px rgba(79,70,229,.6);
}
.btn:hover { transform: translateY(-1px); background: var(--indigo-600); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--ghost { --b: var(--surface); --f: var(--ink); border-color: var(--line); box-shadow: none; }
.btn--ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn--sm { padding: 7px 12px; font-size: .85rem; box-shadow: none; }
.btn--icon { padding: 8px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label { font-weight: 600; color: var(--ink); font-size: .88rem; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 12px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,.16); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }

/* ---------- Status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.chip.requested { color: var(--st-req); background: var(--st-req-bg); }
.chip.confirmed { color: var(--st-conf); background: var(--st-conf-bg); }
.chip.completed { color: var(--st-comp); background: var(--st-comp-bg); }
.chip.cancelled { color: var(--st-canc); background: var(--st-canc-bg); }
.chip.noshow    { color: var(--st-no);  background: var(--st-no-bg); }

/* ============================================================
   Calendar (time-grid)
   ============================================================ */
.cal { --gutter: 60px; }
.cal__toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.cal__nav { display: inline-flex; align-items: center; gap: 4px; }
.cal__range { font-weight: 700; color: var(--ink); font-size: 1.05rem; min-width: 200px; }
.seg { display: inline-flex; background: #eef2f7; border-radius: var(--r-sm); padding: 3px; }
.seg a { padding: 6px 14px; border-radius: 6px; font-weight: 600; font-size: .85rem; color: var(--muted); }
.seg a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.cal__filter { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.cal__filter select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; font: inherit; font-weight: 600; color: var(--ink); }

.calgrid { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.calgrid__scroll { overflow-x: auto; }
.calgrid__head { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.calgrid__gutter-head { width: var(--gutter); flex: none; }
.calgrid__colhead { flex: 1 0 120px; text-align: center; padding: 10px 8px; border-left: 1px solid var(--line-2); }
.calgrid__colhead .d { font-weight: 700; color: var(--ink); font-size: .9rem; }
.calgrid__colhead .s { font-size: .78rem; color: var(--muted); }
.calgrid__colhead.today .d { color: var(--indigo-600); }
.calgrid__colhead.today { background: var(--indigo-50); }

.calgrid__body { display: flex; }
.calgrid__gutter { width: var(--gutter); flex: none; }
.calgrid__hour { height: var(--pph); font-size: .72rem; color: var(--faint); text-align: right; padding: 2px 8px 0 0; box-sizing: border-box; }
.calgrid__col {
  flex: 1 0 120px; position: relative; border-left: 1px solid var(--line-2);
  background-image: linear-gradient(var(--line-2) 1px, transparent 1px);
  background-size: 100% var(--pph);
}
.calgrid__col.today { background-color: #fafbff; }

/* open-hours band */
.openband { position: absolute; left: 0; right: 0; background: rgba(99,102,241,.05); border-top: 1px dashed rgba(99,102,241,.18); border-bottom: 1px dashed rgba(99,102,241,.18); }

/* appointment block */
.appt {
  position: absolute; border-radius: 7px; padding: 4px 8px; overflow: hidden;
  border-left: 3px solid var(--line); box-shadow: var(--shadow-sm);
  font-size: .78rem; line-height: 1.2; cursor: default;
}
.appt__row { display: flex; align-items: baseline; gap: 6px; overflow: hidden; }
.appt .t { font-weight: 700; font-size: .72rem; opacity: .85; flex: none; }
.appt .n { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .x { position: absolute; top: 3px; right: 4px; opacity: 0; transition: opacity .15s; }
.appt:hover .x { opacity: .8; }
.appt .x button { background: none; border: 0; cursor: pointer; color: var(--st-canc); font-size: .85rem; line-height: 1; padding: 0; }
.appt.requested { background: var(--st-req-bg); border-left-color: var(--st-req-line); }
.appt.requested .t { color: var(--st-req); }
.appt.confirmed { background: var(--st-conf-bg); border-left-color: var(--st-conf-line); }
.appt.confirmed .t { color: var(--st-conf); }
.appt.completed { background: var(--st-comp-bg); border-left-color: var(--st-comp-line); }
.appt.completed .t { color: var(--st-comp); }
.appt.cancelled { background: var(--st-canc-bg); border-left-color: var(--st-canc-line); }
.appt.cancelled .n { text-decoration: line-through; color: var(--muted); }
.appt.noshow { background: var(--st-no-bg); border-left-color: var(--st-no-line); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ---------- Auth (login) ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(800px 400px at 20% -10%, rgba(99,102,241,.18), transparent 60%),
    linear-gradient(180deg, #0b1220, #111a2e);
}
.auth__card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 34px 32px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
.auth__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth__logo { display: inline-flex; filter: drop-shadow(0 4px 10px rgba(99,102,241,.5)); }
.auth__name { font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.auth__name span { color: var(--indigo-600); }
.auth__name small { color: var(--faint); font-weight: 600; font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; }
.auth h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth__sub { color: var(--muted); margin: 0 0 22px; }
.auth__error { background: var(--st-canc-bg); color: var(--st-canc); border: 1px solid #fecdd3; padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 16px; font-weight: 500; font-size: .9rem; }
.auth__hint { margin: 18px 0 0; text-align: center; font-size: .8rem; color: var(--muted); }
.auth .validation-message { color: var(--st-canc); font-size: .8rem; }

/* ---------- Appointment blocks are links now ---------- */
.appt { text-decoration: none; cursor: pointer; }
.appt:hover { box-shadow: var(--shadow); z-index: 3; }

/* ---------- Buttons: status variants + block ---------- */
.btn--block { width: 100%; }
.btn--confirm { background: var(--st-conf-line); box-shadow: none; }
.btn--confirm:hover { background: var(--st-conf); }
.btn--complete { background: var(--st-comp-line); box-shadow: none; }
.btn--complete:hover { background: var(--st-comp); }
.btn--noshow { background: var(--st-no-line); box-shadow: none; }
.btn--noshow:hover { background: var(--st-no); }
.btn--cancel { background: var(--st-canc-line); box-shadow: none; }
.btn--cancel:hover { background: var(--st-canc); }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 13px 16px; border-bottom: 1px solid var(--line); }
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl__name { font-weight: 600; color: var(--ink); }
.tbl__actions { text-align: right; }
.tbl tr.is-archived td:not(.tbl__actions) { opacity: .55; }

/* ---------- Checkbox rows ---------- */
.check { display: flex; align-items: center; gap: 9px; margin: 6px 0 16px; font-size: .9rem; color: var(--ink); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--indigo); }

/* ---------- Appointment detail ---------- */
.detail { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }
.detail__main { padding: 24px 26px; }
.detail__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.detail__head h2 { font-size: 1.4rem; }
.detail__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; margin: 0; }
.detail__grid dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px; }
.detail__grid dd { margin: 0; color: var(--ink); font-weight: 500; }
.detail__grid a { color: var(--indigo-600); }
.detail__notes { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.detail__notes dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.detail__notes p { margin: 6px 0 0; color: var(--ink); }
.detail__actions { padding: 22px; }
.detail__actions h3 { margin-bottom: 4px; }
.detail__act { margin-bottom: 8px; }
@media (max-width: 720px) {
  .detail { grid-template-columns: 1fr; }
  .detail__grid { grid-template-columns: 1fr; }
}

/* ---------- Calendar: quick-create popup, hover hint, drag ---------- */
.calgrid__col { cursor: pointer; }
.appt { cursor: grab; }
.appt.dragging { opacity: .45; }
.calgrid__col.drop-target { background: rgba(99,102,241,.08); box-shadow: inset 0 0 0 2px rgba(99,102,241,.35); }
.legend__hint { margin-left: auto; color: var(--faint); font-style: italic; }

.qc-hint {
  position: absolute; left: 2px; right: 2px; z-index: 1; pointer-events: none;
  display: none; align-items: center; padding-left: 8px;
  background: rgba(99,102,241,.10); border: 1px dashed rgba(99,102,241,.45);
  border-radius: 6px; color: var(--indigo-600); font-size: .72rem; font-weight: 700;
}

.qc-backdrop {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(15,23,42,.45); backdrop-filter: blur(2px);
  place-items: center; padding: 20px;
}
.qc-backdrop.open { display: grid; }
@keyframes qcIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.qc-modal {
  width: 100%; max-width: 440px; background: var(--surface);
  border-radius: 16px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.4);
  padding: 22px 24px; animation: qcIn .16s ease both;
}
.qc-modal__head { margin-bottom: 14px; }
.qc-modal__head h3 { font-size: 1.2rem; }
.qc-modal__head .muted { font-size: .85rem; }
.qc-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- Blazor error UI ---------- */
#blazor-error-ui {
  color-scheme: light only; background: #fff3cd; color: #664d03; bottom: 0; box-shadow: 0 -1px 4px rgba(0,0,0,.2);
  display: none; left: 0; padding: 0.8rem 1.4rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: 0.75rem; }

@media (max-width: 640px) {
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
