/* Zencia OPD — shared components: buttons, cards, chips, banners, forms. */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 10px 18px; border-radius: var(--r-md);
  border: 1px solid var(--c-line); background: var(--c-surface);
  cursor: pointer; font-weight: 550;
}
.btn:hover { background: var(--c-surface-2); }
.btn-primary { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }
.btn-primary:hover { background: var(--c-brand-dark); }
.btn-danger { background: var(--c-red); border-color: var(--c-red); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--c-brand); }
.btn-sm { padding: 5px 10px; font-size: var(--t-sm); border-radius: var(--r-sm); }

.card {
  background: var(--c-surface); border: 1px solid var(--c-line-soft);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: var(--s-5);
}
.card-tight { padding: var(--s-4); }
.card h3 { font-size: var(--t-md); margin-bottom: var(--s-3); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--c-line); background: var(--c-surface);
  font-size: var(--t-sm); font-weight: 550;
}
.chip-red    { background: var(--c-red-bg);    border-color: #f0bbb8; color: var(--c-red); }
.chip-orange { background: var(--c-orange-bg); border-color: #eccb9c; color: var(--c-orange); }
.chip-yellow { background: var(--c-yellow-bg); border-color: #e0d495; color: var(--c-yellow); }
.chip-green  { background: var(--c-green-bg);  border-color: #a9d6bd; color: var(--c-green); }
.chip-blue   { background: var(--c-blue-bg);   border-color: #b6c8ea; color: var(--c-blue); }
.chip-grey   { background: var(--c-surface-2); color: var(--c-ink-2); }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip-plain::before { display: none; }

.banner {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  border: 1px solid; font-size: var(--t-sm);
}
.banner-warn { background: var(--c-orange-bg); border-color: #eccb9c; color: #6b3a04; }
.banner-red  { background: var(--c-red-bg);    border-color: #f0bbb8; color: #7c1512; }
.banner-info { background: var(--c-blue-bg);   border-color: #b6c8ea; color: #1e3f77; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--c-surface); font-size: var(--t-sm); }
.tbl th {
  text-align: left; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em;
  color: var(--c-ink-3); font-weight: 650; padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--c-line);
}
.tbl td { padding: var(--s-3); border-bottom: 1px solid var(--c-line-soft); vertical-align: middle; }
.tbl tr:hover td { background: var(--c-surface-2); }
.tbl tr.is-dim td { color: var(--c-ink-3); background: #fafbfc; }
.tbl .num { font-family: var(--font-mono); }

.table-pagination {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: var(--s-3); padding: var(--s-3); border-top: 1px solid var(--c-line-soft);
}
.table-pagination button:disabled { opacity: .4; cursor: default; }

.field { display: block; margin-bottom: var(--s-4); }
.field > span { display: block; font-size: var(--t-sm); font-weight: 550; margin-bottom: 4px; color: var(--c-ink-2); }
.field > span .hint-sm { font-weight: 400; font-style: normal; color: var(--c-ink-3); }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--c-line);
  border-radius: var(--r-sm); background: var(--c-surface); font: inherit;
}
.hint { font-size: var(--t-xs); color: var(--c-ink-3); margin-top: 4px; }

/* Groups of related fields inside a form (e.g. the Add Doctor modal) -
   visually separates "account basics" from "appearance", so a form with
   several optional fields doesn't read as one undifferentiated block. */
.form-section { padding-bottom: var(--s-4); margin-bottom: var(--s-4); border-bottom: 1px solid var(--c-line-soft); }
.form-section:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: none; }
.form-section-title { margin: 0 0 var(--s-3); font-size: var(--t-sm); font-weight: 700; color: var(--c-ink); }
.form-section-title .hint-sm { font-weight: 400; }

.dept-checkbox-list { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 6px; }
.dept-checkbox { display: flex; align-items: center; gap: 7px; font-size: var(--t-sm); cursor: pointer; }

.kv { display: grid; grid-template-columns: 190px 1fr; gap: var(--s-2) var(--s-4); font-size: var(--t-sm); }
.kv dt { color: var(--c-ink-3); font-weight: 550; }
.kv dd { margin: 0; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-4); }
.tile { background: var(--c-surface); border: 1px solid var(--c-line-soft); border-radius: var(--r-md); padding: var(--s-4); }
.tile .n { font-size: var(--t-2xl); font-weight: 700; line-height: 1; }
.tile .l { font-size: var(--t-sm); color: var(--c-ink-3); margin-top: 6px; }

.summary-line { display: grid; grid-template-columns: 170px 1fr; gap: var(--s-4); padding: var(--s-3) 0; border-bottom: 1px solid var(--c-line-soft); font-size: var(--t-sm); }
.summary-line:last-child { border-bottom: 0; }
.summary-line .lbl { color: var(--c-ink-3); font-weight: 600; }
.summary-line.denied .lbl { color: var(--c-ink-3); }
.summary-line.denied .val { color: var(--c-ink-2); font-style: italic; }

/* ---- generic base rules used across every page ---- */
*, *::before, *::after { box-sizing: border-box; }
/* The [hidden] attribute's default UA rule (display:none) has no special
   priority - any author rule that sets `display` on the same element (e.g.
   `.soft-card { display: flex }`) silently wins and the element stays
   visible even with `hidden` set. This makes `hidden` actually work
   everywhere, regardless of what other display rules a class adds. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-ink);
  font-size: var(--t-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
:lang(hi), .deva { font-family: var(--font-deva); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.25; }
p { margin: 0 0 var(--s-3); }
a { color: var(--c-brand); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 2px; }

.muted { color: var(--c-ink-2); }
.dim   { color: var(--c-ink-3); }
.small { font-size: var(--t-sm); }
.xs    { font-size: var(--t-xs); }
.mono  { font-family: var(--font-mono); }
.center { text-align: center; }
.stack > * + * { margin-top: var(--s-4); }
.row { display: flex; gap: var(--s-3); align-items: center; }
.row-wrap { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- password show/hide toggle (js/common.js wraps every password field) ---------- */
.password-field { position: relative; display: block; }
.password-field .input { padding-right: 40px; }
.password-toggle {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  width: 30px; height: 30px; padding: 0; border: none; background: transparent;
  color: var(--c-ink-3); display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); cursor: pointer;
}
.password-toggle:hover { color: var(--c-ink-2); background: var(--c-surface-2); }
.password-toggle svg { width: 18px; height: 18px; }

/* ---------- modal dialog (generic - any page can use it) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 20, 25, .48);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-5); z-index: 100;
}
.modal-card {
  width: 100%; max-width: 460px; max-height: calc(100vh - var(--s-6) * 2);
  background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; overflow: hidden;
}
/* Wider variant for content that doesn't fit a form-style dialog - e.g. a
   full visit summary + transcript. */
.modal-card-wide { max-width: 820px; }
.modal-card-wide .modal-body { display: flex; flex-direction: column; gap: var(--s-4); }
.modal-head {
  display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--c-line-soft); flex: none;
}
.modal-head h3 { flex: 1; font-size: var(--t-md); }
.modal-close {
  width: 28px; height: 28px; border: none; background: transparent; color: var(--c-ink-3);
  display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm); cursor: pointer;
}
.modal-close:hover { background: var(--c-surface-2); color: var(--c-ink); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: var(--s-5); overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: var(--s-3);
  padding: var(--s-4) var(--s-5); border-top: 1px solid var(--c-line-soft); flex: none;
}

/* ---------- search field (generic) ---------- */
.search-field {
  position: relative; display: flex; align-items: center; flex: 1; min-width: 200px; max-width: 340px;
}
.search-field svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--c-ink-3); pointer-events: none; }
.search-field input {
  width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--c-line); border-radius: var(--r-sm);
  background: var(--c-surface); font: inherit; font-size: var(--t-sm);
}
