@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700&family=Fira+Code:wght@500&display=swap");

/* Voxel components — every colour, length and shadow comes from tokens.json.
   Motion: crisp product feedback only. 120–200 ms, strong ease-out, transform/opacity/colour. */
.vx-root {
  --vx-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --vx-fast: 120ms;
  --vx-base: 160ms;
  font-family: var(--font-sans); color: var(--foreground);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  caret-color: var(--primary);
  scrollbar-color: var(--border) transparent; scrollbar-width: thin;
}
.vx-root, .vx-root * { box-sizing: border-box; }
.vx-root ::selection { background: var(--accent); color: var(--accent-foreground); }
body { background: var(--card); color: var(--foreground); font-family: var(--font-sans); margin: 0; }

.vx-icon { width: var(--icon-size); height: var(--icon-size); flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vx-icon-sm { width: 16px; height: 16px; }
.vx-spin { animation: vx-spin 700ms linear infinite; }
@keyframes vx-spin { to { transform: rotate(360deg); } }

/* Logo */
.vx-logo { display: inline-flex; align-items: center; color: var(--secondary); --vx-logo-accent: var(--primary); text-decoration: none; }
[data-theme=dark] .vx-logo { color: var(--foreground); }
.vx-logo svg { flex: none; display: block; }

/* Focus — one ring everywhere: 2px solid ring, 2px offset */
.vx-btn:focus-visible, .vx-search-clear:focus-visible, .vx-row:focus-visible, .vx-code button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.vx-nav:focus-visible { outline: 2px solid var(--sidebar-ring); outline-offset: 2px; }

/* Button */
.vx-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control-height); padding: 0 16px; border-radius: var(--radius-md); border: 1px solid transparent; font-family: var(--font-sans); font-size: 14px; line-height: 20px; font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-xs); user-select: none;
  transition: background-color var(--vx-base) ease, color var(--vx-base) ease, opacity var(--vx-base) ease, transform var(--vx-base) var(--vx-ease-out); }
.vx-btn:active:not(:disabled) { transform: scale(0.97); }
.vx-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.vx-btn[aria-busy="true"] { cursor: progress; opacity: 1; }
.vx-btn-sm { height: var(--control-height-sm); padding: 0 12px; font-size: 13px; }
.vx-btn-primary { background: var(--primary); color: var(--primary-foreground); font-weight: 600; }
.vx-btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.vx-btn-outline { background: var(--card); color: var(--foreground); border-color: var(--border); }
.vx-btn-ghost { background: transparent; color: var(--foreground); box-shadow: none; }
.vx-btn-destructive { background: var(--destructive); color: var(--destructive-foreground); font-weight: 600; }
@media (hover: hover) and (pointer: fine) {
  .vx-btn-primary:hover:not(:disabled), .vx-btn-secondary:hover:not(:disabled), .vx-btn-destructive:hover:not(:disabled) { opacity: .9; }
  .vx-btn-outline:hover:not(:disabled), .vx-btn-ghost:hover:not(:disabled) { background: var(--accent); color: var(--accent-foreground); }
}

/* Search — the ring moves to the whole field, the input itself stays clean */
.vx-search { display: flex; align-items: center; gap: var(--space-3); height: var(--search-height); padding: 0 var(--space-2) 0 var(--space-4); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-float); color: var(--muted-foreground); transition: border-color var(--vx-base) ease, box-shadow var(--vx-base) ease; }
.vx-search:focus-within { border-color: var(--ring); box-shadow: var(--shadow-float), 0 0 0 1px var(--ring); }
.vx-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--foreground); font-family: var(--font-sans); font-size: 16px; line-height: 24px; outline: none; }
.vx-search input::placeholder { color: var(--muted-foreground); opacity: 1; }
.vx-search input::-webkit-search-cancel-button { display: none; }
.vx-search-count { font-size: 13px; line-height: 18px; color: var(--muted-foreground); white-space: nowrap; }
.vx-search-clear { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--muted-foreground); cursor: pointer; transition: background-color var(--vx-fast) ease, color var(--vx-fast) ease; }
.vx-kbd { font-family: var(--font-mono); font-size: 11px; line-height: 16px; padding: 1px 6px; margin-right: var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--muted); color: var(--muted-foreground); }
@media (hover: hover) and (pointer: fine) { .vx-search-clear:hover { background: var(--accent); color: var(--accent-foreground); } }

/* Nav item (sidebar filter) — used tens of times a day: colour change only, no motion */
.vx-nav { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 36px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--sidebar-foreground); font-family: var(--font-sans); font-size: 14px; line-height: 20px; font-weight: 500; text-align: left; cursor: pointer; }
.vx-nav.is-active { background: var(--sidebar-primary); color: var(--sidebar-primary-foreground); font-weight: 600; }
.vx-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-nav-count { font-size: 13px; line-height: 18px; }
.vx-nav-count.is-warning { min-width: 22px; padding: 0 6px; border-radius: var(--radius-sm); background: var(--secondary); color: var(--secondary-foreground); text-align: center; font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .vx-nav:not(.is-active):hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); } }

/* Badge */
.vx-badge { display: inline-flex; align-items: center; gap: var(--space-1); height: 22px; padding: 0 8px; border-radius: var(--radius-md); font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.vx-badge .vx-icon { width: 14px; height: 14px; }
.vx-badge-neutral { background: var(--card); color: var(--foreground); border-color: var(--border); }
.vx-badge-info { background: var(--accent); color: var(--accent-foreground); }
.vx-badge-success { background: var(--success-tint); color: var(--success); }
.vx-badge-warning { background: var(--warning-tint); color: var(--warning); }
.vx-badge-danger { background: var(--danger-tint); color: var(--danger); }

/* Patient code */
.vx-code { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px 2px 2px 8px; border-radius: var(--radius); background: var(--muted); border: 1px solid var(--border); color: var(--foreground); font-family: var(--font-mono); font-size: 12px; line-height: 16px; font-weight: 500; }
.vx-code button { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); cursor: pointer; transition: background-color var(--vx-fast) ease, transform var(--vx-base) var(--vx-ease-out); }
.vx-code button:active { transform: scale(0.92); }
.vx-code-copied { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding-right: 6px; color: var(--success); font-family: var(--font-sans); font-size: 12px; }
@media (hover: hover) and (pointer: fine) { .vx-code button:hover { background: var(--accent); color: var(--accent-foreground); } }

/* Patient row — list navigation: no motion */
.vx-row { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); cursor: pointer; }
.vx-row.is-selected { background: var(--accent); }
.vx-row-name { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--card-foreground); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-row-name mark { background: transparent; color: var(--accent-foreground); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.vx-row-date { font-size: 13px; line-height: 18px; color: var(--card-foreground); font-weight: 500; text-align: right; }
.vx-row-meta, .vx-row-meta-right { font-size: 13px; line-height: 18px; color: var(--muted-foreground); }
.vx-row-meta-right { text-align: right; }
.vx-row.is-selected .vx-row-meta, .vx-row.is-selected .vx-row-meta-right { color: var(--accent-foreground); }
.vx-row-badges { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-1); padding-top: var(--space-1); }
.vx-row.is-skeleton { cursor: default; }
.vx-skel { display: block; height: 12px; margin-block: 4px; border-radius: var(--radius-sm); background: var(--input); animation: vx-pulse 1.4s ease-in-out infinite; }
@keyframes vx-pulse { 50% { opacity: .55; } }
@media (hover: hover) and (pointer: fine) { .vx-row:not(.is-selected):not(.is-skeleton):hover { background: var(--input); } }

/* Study card */
.vx-study { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-5); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); margin: 0; }
.vx-study-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--muted); border: 1px solid var(--border); color: var(--accent-foreground); }
.vx-study-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vx-study-title { margin: 0; font-size: 17px; line-height: 24px; font-weight: 600; color: var(--card-foreground); }
.vx-study-date { font-size: 13px; line-height: 18px; color: var(--muted-foreground); }
.vx-study-status { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; line-height: 18px; color: var(--muted-foreground); }
.vx-study-status .vx-icon { width: 15px; height: 15px; margin-top: 1.5px; }
.vx-study-status.is-success { color: var(--success); }
.vx-study-status.is-warning { color: var(--warning); }
.vx-study-status.is-danger { color: var(--danger); }
.vx-progress { grid-column: 2 / -1; height: 4px; border-radius: var(--radius-sm); background: var(--input); overflow: hidden; }
.vx-progress > span { display: block; height: 100%; background: var(--primary); transform-origin: left center; transition: transform 240ms linear; }

/* Banner — appears occasionally: a short settle-in from above */
.vx-banner { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); min-height: 48px; border-radius: var(--radius); font-size: 14px; line-height: 20px; border: 1px solid transparent;
  transition: opacity 200ms var(--vx-ease-out), transform 200ms var(--vx-ease-out); }
@starting-style { .vx-banner { opacity: 0; transform: translateY(-6px); } }
.vx-banner-text { flex: 1; min-width: 0; }
.vx-banner-text strong { font-weight: 600; }
.vx-banner-info { background: var(--secondary); color: var(--secondary-foreground); }
.vx-banner-success { background: var(--success-tint); color: var(--foreground); } .vx-banner-success > .vx-icon { color: var(--success); }
.vx-banner-warning { background: var(--warning-tint); color: var(--foreground); border-color: var(--warning); } .vx-banner-warning > .vx-icon { color: var(--warning); }
.vx-banner-danger { background: var(--danger-tint); color: var(--foreground); border-color: var(--danger); } .vx-banner-danger > .vx-icon { color: var(--danger); }

/* Status line (bottom of sidebar) */
.vx-status { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; line-height: 18px; color: var(--muted-foreground); }
.vx-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--success); }
.vx-dot.is-warning { background: var(--warning); }
.vx-dot.is-danger { background: var(--danger); }

/* Glow — the brand signature, only behind floating surfaces; static */
.vx-glow { position: relative; overflow: hidden; background: var(--card); isolation: isolate; }
.vx-glow::before { content: ""; position: absolute; z-index: -1; left: -20%; right: -20%; bottom: -55%; height: 120%; border-radius: 50%;
  background:
    radial-gradient(40% 45% at 22% 50%, var(--chart-2), transparent 70%),
    radial-gradient(45% 50% at 50% 55%, var(--chart-4), transparent 72%),
    radial-gradient(40% 45% at 80% 50%, var(--chart-1), transparent 70%);
  filter: blur(48px); opacity: .8; }
.vx-glow-inner { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-6); text-align: center; height: 100%; padding: var(--space-12) var(--space-6); }

/* Reduced motion: keep colour and opacity feedback, drop movement */
@media (prefers-reduced-motion: reduce) {
  .vx-btn:active:not(:disabled), .vx-code button:active { transform: none; }
  .vx-banner { transition: opacity 200ms ease; }
  @starting-style { .vx-banner { transform: none; } }
  .vx-skel { animation: none; }
  .vx-spin { animation-duration: 1.6s; }
}
