/* MedSim design system. Tailwind handles layout; these classes define the visual language. */

:root {
  --ink-950: #070b16;
  --ink-900: #0b1020;
  --ink-800: #111a2e;
  --line: rgba(148, 163, 184, 0.14);
  --text: #e6ecf7;
  --muted: #8a97b0;
  --brand-500: #6366f1;
  --brand-400: #818cf8;
  --accent-500: #a855f7;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --radius: 18px;
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  min-height: 100%;
  background: var(--ink-950);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(168, 85, 247, 0.16), transparent 60%),
    radial-gradient(800px 600px at 50% 120%, rgba(14, 165, 233, 0.10), transparent 60%),
    var(--ink-950);
  background-attachment: fixed;
}

/* Glass surfaces */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.025));
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255,255,255,0.04);
  border-radius: var(--radius);
}

.glass-strong {
  background: linear-gradient(180deg, rgba(20,28,50,0.92), rgba(12,18,34,0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.7);
}

/* Typography helpers */
.eyebrow {
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.headline {
  font-weight: 700; letter-spacing: -0.02em;
}
.gradient-text {
  background: linear-gradient(90deg, #c7d2fe, #a5b4fc 40%, #e9d5ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1rem; border-radius: 12px; font-weight: 600; font-size: 0.9rem;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease, opacity .2s;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg, .btn i { width: 18px; height: 18px; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.7);
}
.btn-primary:hover { box-shadow: 0 14px 36px -10px rgba(99, 102, 241, 0.9); transform: translateY(-1px); }

.btn-ghost {
  color: var(--text); background: rgba(255,255,255,0.04); border-color: var(--line);
}
.btn-ghost:hover { background: rgba(255,255,255,0.09); border-color: rgba(148,163,184,0.3); }

.btn-danger {
  color: #fff; background: linear-gradient(135deg, #e11d48, #f43f5e);
  box-shadow: 0 10px 30px -12px rgba(244, 63, 94, 0.7);
}

/* Icon buttons: round, glass, with tooltips via the title attribute */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 12px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--muted);
  transition: all .18s ease; cursor: pointer;
}
.icon-btn:hover { color: #fff; background: rgba(255,255,255,0.1); border-color: rgba(148,163,184,0.35); transform: translateY(-1px); }
.icon-btn.ok:hover { color: var(--ok); }
.icon-btn.warn:hover { color: var(--warn); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn svg, .icon-btn i { width: 17px; height: 17px; }

/* Inputs */
.input, .select, .textarea {
  width: 100%; padding: 0.7rem 0.9rem; border-radius: 12px;
  background: rgba(8, 12, 24, 0.6); border: 1px solid var(--line); color: var(--text);
  outline: none; transition: border-color .2s, box-shadow .2s, background .2s; font-size: 0.92rem;
}
.input::placeholder, .textarea::placeholder { color: #5b6780; }
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(129,140,248,0.7); box-shadow: 0 0 0 4px rgba(99,102,241,0.18); background: rgba(8,12,24,0.85);
}
.label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 0.4rem; }

/* Segmented control */
.segmented { display: inline-flex; padding: 4px; border-radius: 14px; background: rgba(8,12,24,0.7); border: 1px solid var(--line); gap: 4px; }
.segmented button {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.8rem; border-radius: 10px;
  color: var(--muted); font-size: 0.85rem; font-weight: 600; transition: all .2s;
}
.segmented button.active { color: #fff; background: linear-gradient(135deg, rgba(99,102,241,0.55), rgba(168,85,247,0.55)); box-shadow: 0 6px 18px -8px rgba(99,102,241,.8); }
.segmented button:not(.active):hover { color: #fff; background: rgba(255,255,255,0.05); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.22rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge-ok { color: #6ee7b7; background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.3); }
.badge-warn { color: #fde68a; background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.3); }
.badge-danger { color: #fda4af; background: rgba(244,63,94,0.12); border-color: rgba(244,63,94,0.3); }
.badge-info { color: #c7d2fe; background: rgba(99,102,241,0.14); border-color: rgba(99,102,241,0.35); }
.badge-muted { color: var(--muted); background: rgba(148,163,184,0.1); border-color: var(--line); }

/* Navigation */
.nav-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.8rem; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 0.92rem; transition: all .18s; cursor: pointer;
}
.nav-item svg, .nav-item i { width: 18px; height: 18px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: linear-gradient(135deg, rgba(99,102,241,0.28), rgba(168,85,247,0.18)); box-shadow: inset 0 0 0 1px rgba(129,140,248,0.35); }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.ms { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
table.ms th {
  text-align: left; padding: 0.8rem 1rem; font-size: 0.7rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.ms td { padding: 0.85rem 1rem; border-bottom: 1px solid rgba(148,163,184,0.08); vertical-align: middle; }
table.ms tr:hover td { background: rgba(255,255,255,0.025); }
table.ms tr:last-child td { border-bottom: none; }

/* Stat cards */
.stat { padding: 1.15rem 1.25rem; }
.stat-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; }

/* Monitor vitals */
.vital { position: relative; overflow: hidden; border-radius: 16px; padding: 0.9rem 1rem; background: rgba(4,8,18,0.7); border: 1px solid var(--line); }
.vital .num { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.7rem; font-weight: 700; color: #7CFFB2; text-shadow: 0 0 18px rgba(124,255,178,0.25); }
.vital.alarm .num { color: #fb7185; text-shadow: 0 0 18px rgba(251,113,133,0.35); animation: pulse-soft 1.2s ease-in-out infinite; }
.vital .label { font-size: 0.68rem; letter-spacing: .12em; text-transform: uppercase; color: #6b7a96; font-weight: 700; }
.vital .sweep { position: absolute; inset: auto 0 0 0; height: 2px; background: linear-gradient(90deg, transparent, rgba(124,255,178,0.7), transparent); animation: sweep 2.4s linear infinite; }

@keyframes pulse-soft { 0%,100% { opacity: 1 } 50% { opacity: .55 } }
@keyframes sweep { 0% { transform: translateX(-100%) } 100% { transform: translateX(100%) } }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
@keyframes breathe { 0%,100% { transform: scale(1) } 50% { transform: scale(1.012) } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

.fade-up { animation: fade-up .45s ease both; }
.float { animation: float 6s ease-in-out infinite; }
.breathe { animation: breathe 4s ease-in-out infinite; }

/* Chat bubbles */
.bubble { max-width: 82%; padding: 0.7rem 0.95rem; border-radius: 16px; font-size: 0.93rem; line-height: 1.5; }
.bubble-doc { margin-left: auto; background: linear-gradient(135deg, rgba(99,102,241,0.35), rgba(168,85,247,0.28)); border: 1px solid rgba(129,140,248,0.35); border-bottom-right-radius: 4px; }
.bubble-pat { background: rgba(255,255,255,0.05); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble-sys { margin: 0 auto; background: transparent; color: var(--muted); font-size: 0.8rem; text-align: center; border: 1px dashed var(--line); border-radius: 999px; padding: 0.3rem 0.8rem; }

/* Avatar stage */
.stage {
  position: relative; border-radius: 22px; overflow: hidden; min-height: 320px;
  background: radial-gradient(600px 300px at 50% 0%, rgba(99,102,241,0.25), transparent 70%), linear-gradient(180deg, #0e1730, #080d1c);
  border: 1px solid var(--line);
}

/* Upload dropzone */
.dropzone {
  border: 1.5px dashed rgba(129,140,248,0.4); border-radius: 18px; background: rgba(99,102,241,0.05);
  transition: all .2s; cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: rgba(129,140,248,0.9); background: rgba(99,102,241,0.12); }

/* Modal */
.modal-backdrop { background: rgba(3,6,14,0.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.2); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Focus ring for keyboard users */
:focus-visible { outline: 2px solid rgba(129,140,248,0.8); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

[x-cloak] { display: none !important; }
