/* =========================================================================
   ui-kit.css — shadcn/ui design language, hand-authored for WebForms.

   No React, no Tailwind, no build step: the shadcn token model and component
   anatomy reproduced as plain CSS so ASP.NET server controls can wear it.
   Class names mirror the shadcn component they implement (.card, .input,
   .btn, .alert, .checkbox …) so the markup reads the same way.

   Style: "new-york".  Base: neutral.  Primary: clinic teal.
   ========================================================================= */

/* ---------------------------------------------------------------- tokens */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;

  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;

  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;

  --primary: 174.7 83.9% 31.6%;
  --primary-hover: 175.3 77.4% 26.1%;
  --primary-foreground: 0 0% 100%;

  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;

  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;

  --accent: 174 60% 96%;
  --accent-foreground: 175 60% 20%;

  --destructive: 0 72.2% 50.6%;
  --destructive-foreground: 0 0% 100%;

  --success: 142 71% 45%;

  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 174.7 83.9% 31.6%;

  --radius: 0.625rem;

  --shadow-xs: 0 1px 2px 0 hsl(240 6% 10% / 0.05);
  --shadow-sm: 0 1px 3px 0 hsl(240 6% 10% / 0.08), 0 1px 2px -1px hsl(240 6% 10% / 0.08);
  --shadow-lg: 0 10px 15px -3px hsl(240 6% 10% / 0.08), 0 4px 6px -4px hsl(240 6% 10% / 0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;

    --card: 240 8% 6.5%;
    --card-foreground: 0 0% 98%;

    --popover: 240 8% 6.5%;
    --popover-foreground: 0 0% 98%;

    --primary: 174 70% 41%;
    --primary-hover: 174 70% 46%;
    --primary-foreground: 240 10% 4%;

    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;

    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;

    --accent: 174 40% 14%;
    --accent-foreground: 174 70% 78%;

    --destructive: 0 62.8% 55%;
    --destructive-foreground: 0 0% 98%;

    --border: 240 3.7% 17%;
    --input: 240 3.7% 20%;
    --ring: 174 70% 41%;

    --shadow-xs: 0 1px 2px 0 hsl(0 0% 0% / 0.3);
    --shadow-sm: 0 1px 3px 0 hsl(0 0% 0% / 0.4), 0 1px 2px -1px hsl(0 0% 0% / 0.4);
    --shadow-lg: 0 10px 15px -3px hsl(0 0% 0% / 0.45), 0 4px 6px -4px hsl(0 0% 0% / 0.4);
  }
}

[data-theme="dark"] {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 8% 6.5%;
  --card-foreground: 0 0% 98%;
  --popover: 240 8% 6.5%;
  --popover-foreground: 0 0% 98%;
  --primary: 174 70% 41%;
  --primary-hover: 174 70% 46%;
  --primary-foreground: 240 10% 4%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 174 40% 14%;
  --accent-foreground: 174 70% 78%;
  --destructive: 0 62.8% 55%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 3.7% 17%;
  --input: 240 3.7% 20%;
  --ring: 174 70% 41%;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "rlig" 1, "calt" 1;
}

:where(h1, h2, h3, h4, p, figure) { margin: 0; }

::selection { background: hsl(var(--primary) / 0.22); }

/* --------------------------------------------------------------- utility */
.muted        { color: hsl(var(--muted-foreground)); }
.text-sm      { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs      { font-size: 0.75rem;  line-height: 1rem; }
.grid         { display: grid; }
.gap-2        { gap: 0.5rem; }
.gap-3        { gap: 0.75rem; }
.gap-6        { gap: 1.5rem; }
.mt-2         { margin-top: 0.5rem; }
.mt-6         { margin-top: 1.5rem; }
.w-full       { width: 100%; }
.text-center  { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ card */
.card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-sm);
  padding-block: 1.5rem;
}

.card-header {
  display: grid;
  gap: 0.375rem;
  padding-inline: 1.5rem;
}

.card-title {
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card-description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.card-content { padding-inline: 1.5rem; }

.card-footer {
  display: flex;
  align-items: center;
  padding-inline: 1.5rem;
}

/* ----------------------------------------------------------------- label */
.label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  user-select: none;
  color: hsl(var(--foreground));
}

.label[data-disabled] { opacity: 0.5; cursor: not-allowed; }

/* ----------------------------------------------------------------- field */
.field { display: grid; gap: 0.5rem; }

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Validators render as inline spans; keep them block-level and quiet. */
.field-error {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.15rem;
  color: hsl(var(--destructive));
  font-weight: 500;
}

/* ----------------------------------------------------------------- input */
.input {
  display: flex;
  width: 100%;
  height: 2.5rem;
  min-width: 0;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: hsl(var(--foreground));
  background: transparent;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  outline: none;
  transition: color .15s, box-shadow .15s, border-color .15s;
}

.input::placeholder { color: hsl(var(--muted-foreground)); }

.input:focus-visible,
.input:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.35);
}

.input:disabled { cursor: not-allowed; opacity: 0.5; }

.input[aria-invalid="true"] {
  border-color: hsl(var(--destructive));
}
.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px hsl(var(--destructive) / 0.25);
}

/* autofill: keep the shadcn surface instead of the UA's yellow */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus {
  -webkit-text-fill-color: hsl(var(--foreground));
  -webkit-box-shadow: 0 0 0 1000px hsl(var(--card)) inset;
  caret-color: hsl(var(--foreground));
}

/* input with a trailing affordance (e.g. reveal-password) */
.input-group { position: relative; display: block; }
.input-group .input { padding-right: 2.75rem; }
.input-affix {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: color .15s, background-color .15s;
}
.input-affix:hover { color: hsl(var(--foreground)); background: hsl(var(--muted)); }
.input-affix:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.35);
}
.input-affix svg { width: 1rem; height: 1rem; }

/* ---------------------------------------------------------------- button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  outline: none;
  text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, opacity .15s;
}

.btn:focus-visible { box-shadow: 0 0 0 3px hsl(var(--ring) / 0.4); }
.btn:disabled { pointer-events: none; opacity: 0.5; }
.btn svg { width: 1rem; height: 1rem; flex-shrink: 0; }

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: hsl(var(--primary-hover)); }
.btn-primary:active { transform: translateY(0.5px); }

.btn-outline {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover { background: hsl(var(--muted)); }

.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--muted)); }

.btn-link {
  height: auto; padding: 0; background: transparent;
  color: hsl(var(--primary)); text-decoration: underline;
  text-underline-offset: 4px; font-weight: 500;
}
.btn-link:hover { color: hsl(var(--primary-hover)); }

.btn-block { width: 100%; }

/* -------------------------------------------------------------- checkbox */
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }

/* asp:CheckBox emits <span><input type=checkbox></span> — target the input. */
.checkbox-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}

.checkbox-row input[type="checkbox"]::before {
  content: "";
  width: 0.625rem;
  height: 0.625rem;
  transform: scale(0);
  transition: transform .12s ease-out;
  background: hsl(var(--primary-foreground));
  clip-path: polygon(14% 44%, 0 65%, 39% 100%, 100% 16%, 84% 0, 39% 68%);
}

.checkbox-row input[type="checkbox"]:checked {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
}
.checkbox-row input[type="checkbox"]:checked::before { transform: scale(1); }

.checkbox-row input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.35);
  outline: none;
}

.checkbox-row label { cursor: pointer; font-size: 0.875rem; font-weight: 500; }

/* ----------------------------------------------------------------- alert */
.alert {
  display: grid;
  grid-template-columns: 0 1fr;
  gap: 0;
  align-items: start;
  padding: 0.75rem 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  font-size: 0.875rem;
}

.alert:has(> svg) { grid-template-columns: 1rem 1fr; gap: 0.75rem; }
.alert > svg { width: 1rem; height: 1rem; translate: 0 2px; }

.alert-title { font-weight: 500; line-height: 1.25rem; letter-spacing: -0.006em; }
.alert-description { color: hsl(var(--muted-foreground)); line-height: 1.35rem; }

.alert-destructive {
  color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.06);
  border-color: hsl(var(--destructive) / 0.35);
}
.alert-destructive .alert-description { color: hsl(var(--destructive) / 0.9); }

.alert-info {
  color: hsl(var(--accent-foreground));
  background: hsl(var(--accent));
  border-color: hsl(var(--primary) / 0.28);
}
.alert-info .alert-description { color: hsl(var(--accent-foreground) / 0.85); }

/* ------------------------------------------------------------- separator */
.separator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
.separator::before,
.separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: hsl(var(--border));
}

/* --------------------------------------------------------------- spinner */
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ui-spin .6s linear infinite;
}
@keyframes ui-spin { to { transform: rotate(360deg); } }

/* full-page busy veil, toggled by the WebForms PageRequestManager */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: hsl(var(--background) / 0.6);
  backdrop-filter: blur(2px);
}
.overlay[data-open="true"] { display: flex; }
.overlay .spinner {
  width: 1.75rem; height: 1.75rem; border-width: 3px;
  color: hsl(var(--primary));
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  * { transition-duration: .01ms !important; }
}
