/* ============================================================
   webforms.css  v1.0
   Small additions for the server-rendered (ASP.NET Web Forms) UI.
   The design itself lives unchanged in tokens/layout/components.css.
   ============================================================ */

/* Shell without sidebar/top bar (login, patient portal, queue display) */
#app-shell.no-chrome { display: block; height: auto; min-height: 100vh; }
#app-shell.no-chrome #main-content { overflow: visible; }

/* LinkButtons render as <a class="btn"> */
a.btn, a.btn:hover, a.nav-item { text-decoration: none; }
a.btn.aspNetDisabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Validators / field errors */
.field-error { display: block; font-size: var(--text-xs); color: var(--color-danger); margin-top: 2px; }
.vital-error { font-size: 10px; color: var(--color-danger); }
.validation-summary { background: var(--color-danger-bg); color: var(--color-danger); border-radius: var(--radius-md); padding: 8px 12px; margin-bottom: 12px; font-size: var(--text-sm); }
.validation-summary ul { margin: 4px 0 0 16px; padding: 0; }

/* CheckBoxList / RadioButtonList rendered inline */
.inline-list { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.inline-list label { margin-left: 4px; font-size: var(--text-sm); }
.inline-list input { vertical-align: middle; }

/* Server-side modal: an asp:Panel with these classes is shown only when Visible=true */
.modal-overlay .modal-frame--wide { width: 640px; }

/* Toasts fade out (site.js removes them) */
.toast { transition: opacity 0.4s; }
.toast.toast--hiding { opacity: 0; }

/* Chips rendered as buttons/links */
a.chip, a.phrase-chip, a.rx-chip, a.settings-tab { text-decoration: none; color: inherit; }
a.settings-tab--active { color: var(--color-primary); }

/* Section card list rows */
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--border-default); }
.list-row:last-child { border-bottom: none; }

/* Report bars */
.report-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.report-bar-label { width: 140px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); }
.report-bar-track { flex: 1; height: 20px; background: var(--surface-page); border-radius: 4px; overflow: hidden; }
.report-bar-fill { height: 100%; border-radius: 4px; }
.report-bar-value { width: 30px; font-weight: 600; font-size: var(--text-xs); }

@media print {
  #sidebar, #topbar, #menu-toggle, #toastStack, .no-print { display: none !important; }
  #app-shell { display: block; height: auto; }
  #main-content { overflow: visible; padding: 0; }
}

/* Patient typeahead (appointment booking dialogs) */
.patient-suggest { position: relative; }
.patient-suggest .form-control.is-picked { border-color: var(--color-success); background: var(--color-success-bg); }
.patient-suggest-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px);
  background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover); max-height: 260px; overflow-y: auto; z-index: var(--z-popover);
}
.patient-suggest-list[hidden] { display: none; }
.patient-suggest-item { padding: 6px 10px; cursor: pointer; border-bottom: 1px solid var(--border-default); }
.patient-suggest-item:last-child { border-bottom: none; }
.patient-suggest-item:hover, .patient-suggest-item.is-active { background: var(--color-primary-light); }
.patient-suggest-name { font-size: var(--text-sm); font-weight: 600; }
.patient-suggest-meta { font-size: var(--text-xs); color: var(--text-secondary, #64748b); }
.patient-suggest-item mark { background: transparent; color: var(--color-primary); font-weight: 700; padding: 0; }
.patient-suggest-empty { padding: 8px 10px; font-size: var(--text-sm); color: var(--text-secondary, #64748b); }

/* Weekly availability editor (Schedule Settings → Doctors) */
.avail-add { border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-page, #f8fafc); padding: 12px 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.avail-add-title { font-weight: 600; font-size: var(--text-sm); }
.avail-field { display: flex; flex-direction: column; gap: 4px; }
.avail-field .form-label { margin: 0; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chips input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-chips label { display: inline-block; min-width: 46px; text-align: center; padding: 5px 10px; border: 1px solid var(--border-default); border-radius: 999px; background: var(--surface-card); font-size: var(--text-sm); cursor: pointer; user-select: none; }
.day-chips label:hover { border-color: var(--color-primary); }
.day-chips input:checked + label { background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: 600; }
.day-chips input:focus-visible + label { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.avail-time { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.avail-time .form-select { width: auto; min-width: 120px; }
.avail-shortcuts { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.link-btn { background: none; border: none; padding: 0; color: var(--color-primary); font-size: var(--text-xs); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.avail-week .avail-closed td { color: var(--text-muted, #94a3b8); }
.avail-chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 3px 4px 3px 8px; border-radius: 999px; background: var(--color-success-bg); color: var(--text-primary, inherit); font-size: var(--text-xs); font-weight: 500; }
.avail-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; color: inherit; text-decoration: none; font-size: 13px; line-height: 1; }
.avail-chip-x:hover { background: var(--color-danger); color: #fff; }

/* Notification bell (top bar; floats bottom-right on pages without chrome). Filled and polled by site.js */
.notif { position: relative; margin-right: 12px; }
.notif--floating { position: fixed; right: 20px; bottom: 20px; margin: 0; }
.notif-bell { position: relative; background: transparent; border: 1px solid transparent; border-radius: 50%; width: 34px; height: 34px; cursor: pointer; color: var(--text-secondary, #64748b); font-size: 18px; display: inline-flex; align-items: center; justify-content: center; }
.notif-bell:hover, .notif-bell[aria-expanded="true"] { background: var(--surface-muted, #f1f5f9); color: var(--text-primary, #1e293b); }
.notif--floating .notif-bell { width: 44px; height: 44px; background: var(--surface-card, #fff); border-color: var(--border-default, #e2e8f0); box-shadow: var(--shadow-popover, 0 4px 12px rgba(0,0,0,0.15)); }
.notif-count { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--color-danger, #dc2626); color: #fff; font-size: 10px; font-weight: 700; line-height: 18px; text-align: center; }
.notif-count[hidden] { display: none; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 6px); width: 340px; max-width: calc(100vw - 32px); background: var(--surface-card, #fff); border: 1px solid var(--border-default, #e2e8f0); border-radius: var(--radius-md, 8px); box-shadow: var(--shadow-popover, 0 4px 12px rgba(0,0,0,0.15)); z-index: var(--z-popover, 900); overflow: hidden; }
.notif--floating .notif-panel { top: auto; bottom: calc(100% + 8px); }
.notif-panel[hidden] { display: none; }
.notif-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border-default, #e2e8f0); font-size: 13px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: block; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--border-default, #e2e8f0); text-decoration: none; color: var(--text-secondary, #64748b); font-size: 12px; border-left: 3px solid transparent; }
.notif-item:hover { background: var(--surface-muted, #f8fafc); }
.notif-item--unread { color: var(--text-primary, #1e293b); border-left-color: var(--color-primary, #2563eb); background: rgba(37, 99, 235, 0.04); }
.notif-item--critical.notif-item--unread { border-left-color: var(--color-danger, #dc2626); background: #fef2f2; }
.notif-item-title { font-weight: 600; font-size: 13px; }
.notif-item--critical .notif-item-title { color: var(--color-danger, #dc2626); }
.notif-item-time { font-size: 11px; opacity: 0.75; margin-top: 2px; }
.notif-empty { padding: 20px 12px; text-align: center; font-size: 12px; color: var(--text-secondary, #64748b); }
.notif-panel-foot { display: block; padding: 9px 12px; text-align: center; font-size: 12px; text-decoration: none; color: var(--color-primary, #2563eb); }
.lab-result-row { scroll-margin-top: 12px; }
.lab-result-row:target { outline: 2px solid var(--color-primary, #2563eb); outline-offset: -2px; }

/* Date picker (site.js): DD-MM-YYYY text box + popup calendar */
/* Field with a validation message under it (site.js): red border, kept while typing until fixed */
.form-control.is-invalid, .form-select.is-invalid,
.form-control.is-invalid:focus, .form-select.is-invalid:focus { border-color: var(--color-danger); }
.datepicker { position: fixed; z-index: 2000; width: 280px; padding: var(--space-2); background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); box-shadow: var(--shadow-popover); font-size: var(--text-sm); color: var(--text-primary); }
.datepicker[hidden] { display: none; }
.datepicker-head { display: flex; align-items: center; gap: 4px; padding: 6px; background: var(--color-primary-light); border-radius: var(--radius-sm); }
.datepicker-head select { flex: 1; height: 28px; padding: 0 4px; font-size: var(--text-sm); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-card); color: var(--text-primary); }
.datepicker-nav { width: 28px; height: 28px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-pill); background: var(--color-primary); color: var(--text-on-primary); cursor: pointer; }
.datepicker-nav:hover { background: var(--color-primary-dark); }
.datepicker-nav:disabled { opacity: 0.35; cursor: default; }
.datepicker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: var(--space-2); }
.datepicker-dow { padding: 6px 0; text-align: center; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; background: var(--color-primary); color: var(--text-on-primary); }
.datepicker-dow:first-child { border-top-left-radius: var(--radius-sm); }
.datepicker-dow:nth-child(7) { border-top-right-radius: var(--radius-sm); }
.datepicker-day { height: 32px; padding: 0 6px; text-align: right; font-size: var(--text-sm); border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--surface-page); color: var(--text-primary); cursor: pointer; }
.datepicker-day:hover:not(:disabled) { background: var(--color-row-hover); border-color: var(--color-primary); }
.datepicker-day.is-today { background: var(--color-primary-light); border-color: var(--color-primary); font-weight: 700; }
.datepicker-day.is-selected { background: var(--color-primary); border-color: var(--color-primary); color: var(--text-on-primary); font-weight: 700; }
.datepicker-day:disabled { background: transparent; color: var(--text-muted); opacity: 0.45; cursor: default; }
.datepicker-foot { display: flex; justify-content: space-between; margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border-default); }
