/* ==========================================================================
   WEBSITE WARD — The Website Emergency Room (websiteward.com)
   Aesthetic: hospital monitor green-on-dark + ECG graph paper + triage tags
   ========================================================================== */

:root {
  --ink: #0a1410;
  --ward: #0d1a14;
  --paper: #f4f0e4;          /* clipboard paper */
  --paper-line: #d8d2bd;
  --pulse: #39ff8e;          /* monitor green */
  --pulse-dim: #1f7a4d;
  --alert: #ff4d5e;
  --warn: #ffb340;
  --caution: #ff7a3d;
  --info: #55c8ff;
  --mono: 'Share Tech Mono', monospace;
  --sans: 'Space Grotesk', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--ink);
  color: #d7efe2;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- ECG graph-paper background --------------------------------------- */
#ecg-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(57, 255, 142, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 142, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(57, 255, 142, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 142, 0.09) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 0%, #12291d 0%, var(--ink) 70%);
  background-size: 16px 16px, 16px 16px, 80px 80px, 80px 80px, 100% 100%;
}

/* --- Header ------------------------------------------------------------ */
#ward-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.2rem 2rem;
  border-bottom: 2px solid rgba(57, 255, 142, 0.25);
  background: rgba(10, 20, 16, 0.85);
  backdrop-filter: blur(4px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.hospital-sign { display: flex; align-items: center; gap: 0.9rem; }

.cross-badge {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--alert);
  color: #fff;
  font-size: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 0 22px rgba(255, 77, 94, 0.55);
  animation: crossGlow 2.4s ease-in-out infinite;
}
@keyframes crossGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(255,77,94,.4); }
  50% { box-shadow: 0 0 28px rgba(255,77,94,.8); }
}

.ward-title {
  font-family: var(--mono);
  font-size: 1.55rem;
  letter-spacing: 0.24em;
  color: var(--pulse);
  text-shadow: 0 0 14px rgba(57, 255, 142, 0.6);
}
.ward-sub {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  color: #7fae95;
}

.header-vitals {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: #9fd8ba;
  display: flex; align-items: center; gap: 0.5rem;
}
.header-vitals b { color: var(--pulse); }
.blink-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--pulse);
  box-shadow: 0 0 10px var(--pulse);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0.15; } }

/* --- Ward floor --------------------------------------------------------- */
#ward-floor {
  max-width: 980px;
  margin: 0 auto;
  padding: 2.5rem 1.2rem 4rem;
}

.hidden { display: none !important; }

/* --- Admission clipboard ------------------------------------------------ */
.clipboard {
  position: relative;
  background: var(--paper);
  color: #2c2a20;
  border-radius: 8px 8px 14px 14px;
  padding: 2.6rem 2rem 1.8rem;
  max-width: 640px;
  margin: 1rem auto 0;
  transform: rotate(-0.6deg);
  box-shadow: 0 14px 40px rgba(0,0,0,0.5), inset 0 0 60px rgba(120,100,40,0.06);
  background-image: repeating-linear-gradient(transparent, transparent 27px, var(--paper-line) 28px);
}
.clipboard-clip {
  position: absolute;
  top: -18px; left: 50%;
  transform: translateX(-50%);
  width: 130px; height: 34px;
  background: linear-gradient(#8b939c, #5b636c);
  border-radius: 8px 8px 4px 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}
.clipboard-clip::after {
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 46px; height: 12px;
  background: var(--paper);
  border-radius: 4px;
}

.form-title {
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  color: #a03535;
  border-bottom: 2px solid #a03535;
  display: inline-block;
  padding-bottom: 2px;
  margin-bottom: 0.6rem;
}
.form-hint { font-size: 0.9rem; color: #5d5a4a; margin-bottom: 1.4rem; }

.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: #8a2f2f;
  margin-bottom: 0.4rem;
}

.admit-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

#patient-url {
  flex: 1 1 260px;
  font-family: var(--mono);
  font-size: 1.05rem;
  padding: 0.7rem 0.9rem;
  background: transparent;
  border: none;
  border-bottom: 2px dashed #8a8264;
  color: #23301f;
  outline: none;
}
#patient-url:focus { border-bottom-color: #a03535; }
#patient-url::placeholder { color: #a89f80; }

#admit-btn {
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  padding: 0.75rem 1.3rem;
  background: #b13a3a;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 0 #7c2323;
  transition: transform 0.08s, box-shadow 0.08s;
}
#admit-btn:hover { background: #c74444; }
#admit-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #7c2323; }
#admit-btn:disabled { opacity: 0.55; cursor: wait; }

.frequent-patients {
  margin-top: 1.5rem;
  font-size: 0.78rem;
  color: #6b6753;
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.quick-admit {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  background: transparent;
  border: 1px dashed #9b9377;
  border-radius: 999px;
  color: #4d4936;
  cursor: pointer;
}
.quick-admit:hover { background: #e8e2cd; border-style: solid; }

/* --- Operating theatre / live monitor ----------------------------------- */
#operating-theatre { margin-top: 2.6rem; }

.monitor-frame {
  background: #05100a;
  border: 2px solid rgba(57,255,142,0.35);
  border-radius: 14px;
  padding: 1rem 1.2rem 1.2rem;
  box-shadow: 0 0 40px rgba(57,255,142,0.12), inset 0 0 50px rgba(57,255,142,0.05);
}
.monitor-head {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  color: var(--pulse);
  margin-bottom: 0.6rem;
}
.monitor-patient { color: #9fd8ba; }

#ecg-canvas {
  width: 100%;
  height: 160px;
  display: block;
  background:
    linear-gradient(rgba(57,255,142,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57,255,142,0.07) 1px, transparent 1px);
  background-size: 20px 20px;
  border-radius: 6px;
}

.procedure-log {
  margin-top: 0.8rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #7fd8a8;
  min-height: 4.2em;
}
.procedure-log div { animation: logIn 0.3s ease; }
.procedure-log div::before { content: '> '; color: var(--pulse-dim); }
@keyframes logIn { from { opacity: 0; transform: translateX(-6px); } }

/* --- Diagnosis chart ------------------------------------------------------ */
#diagnosis { margin-top: 2.6rem; animation: chartIn 0.5s ease; }
@keyframes chartIn { from { opacity: 0; transform: translateY(18px); } }

.chart-top {
  display: flex;
  gap: 1.6rem;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(13, 26, 20, 0.9);
  border: 1px solid rgba(57,255,142,0.25);
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
}

/* triage tag — like a hospital wrist/toe tag */
.triage-tag {
  position: relative;
  min-width: 120px;
  padding: 1rem 1rem 0.9rem;
  border-radius: 6px;
  text-align: center;
  transform: rotate(-3deg);
  font-family: var(--mono);
  box-shadow: 0 6px 16px rgba(0,0,0,0.45);
  color: #1c1c1c;
  background: #ccc;
}
.tag-hole {
  position: absolute;
  top: 7px; left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 14px;
  background: var(--ink);
  border-radius: 50%;
  box-shadow: inset 0 0 4px #000;
}
.tag-label { display: block; margin-top: 12px; font-size: 0.62rem; letter-spacing: 0.3em; opacity: 0.75; }
.tag-level { display: block; font-size: 1.5rem; font-weight: 700; letter-spacing: 0.1em; }
.triage-GREEN  { background: #59e08b; }
.triage-YELLOW { background: #ffd84d; }
.triage-ORANGE { background: var(--caution); }
.triage-RED    { background: var(--alert); color: #fff; }
.triage-BLACK  { background: #23252a; color: #d9dbe0; }

.patient-summary { flex: 1 1 300px; }
.chart-patient {
  font-family: var(--mono);
  font-size: 1.5rem;
  color: var(--pulse);
  text-shadow: 0 0 12px rgba(57,255,142,0.4);
  word-break: break-all;
}
.chart-summary { margin-top: 0.4rem; color: #cfe9db; line-height: 1.5; }
.chart-meta { margin-top: 0.5rem; font-family: var(--mono); font-size: 0.75rem; color: #6fa387; }

/* overall dial */
.overall-dial { position: relative; width: 120px; height: 120px; flex: 0 0 auto; }
.dial-track { fill: none; stroke: rgba(57,255,142,0.12); stroke-width: 10; }
.dial-fill {
  fill: none;
  stroke: var(--pulse);
  stroke-width: 10;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
  transition: stroke-dashoffset 1.4s cubic-bezier(.2,.8,.3,1), stroke 0.5s;
  filter: drop-shadow(0 0 6px rgba(57,255,142,0.6));
}
.dial-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--mono);
}
.dial-text span { font-size: 1.9rem; color: #eafff3; line-height: 1; }
.dial-text small { color: #6fa387; }
.dial-text em { font-style: normal; font-size: 0.55rem; letter-spacing: 0.3em; color: #6fa387; margin-top: 2px; }

/* --- Radiology: patient imaging (X-ray film) -------------------------------- */
.radiology { margin-top: 1.6rem; }

.film-frame {
  background: #0b0e14;
  border: 1px solid rgba(85, 200, 255, 0.28);
  border-radius: 12px;
  padding: 1rem 1.2rem 0.9rem;
  box-shadow: 0 0 34px rgba(85, 200, 255, 0.1), inset 0 0 40px rgba(85, 200, 255, 0.04);
  animation: chartIn 0.5s ease both;
}
.film-head {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  color: var(--info);
  margin-bottom: 0.7rem;
}
.film-id { color: #7aa8c4; }

.film-viewport {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, #10202e 0%, #060a10 80%);
  border: 1px solid rgba(85,200,255,0.18);
  min-height: 220px;
  display: grid;
  place-items: center;
}

.film-loading {
  display: flex; flex-direction: column; align-items: center; gap: 0.7rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  color: var(--info);
  padding: 3rem 1rem;
}
.film-loading i { font-size: 1.8rem; opacity: 0.8; }

.film-img {
  display: none;
  width: 100%;
  height: auto;
  /* radiograph treatment: cool blue negative-ish grade */
  filter: grayscale(0.35) contrast(1.06) brightness(0.92) sepia(0.25) hue-rotate(170deg) saturate(1.5);
  opacity: 0;
  transition: opacity 1.6s ease;
}
.film-img.developed { display: block; opacity: 1; }
.film-viewport:hover .film-img.developed { filter: none; transition: filter 0.4s, opacity 1.6s ease; }

.film-scanlines {
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(transparent 0 3px, rgba(0,0,0,0.14) 3px 4px),
    radial-gradient(ellipse at center, transparent 55%, rgba(4, 8, 14, 0.55) 100%);
  mix-blend-mode: multiply;
}
.film-marker {
  position: absolute;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: rgba(200, 230, 255, 0.75);
  text-shadow: 0 0 8px rgba(85,200,255,0.6);
  pointer-events: none;
}
.fm-tl { top: 8px; left: 12px; }
.fm-br { bottom: 8px; right: 12px; }

.film-caption {
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: #6e8ba0;
  font-style: italic;
}

/* --- Vitals grid: organ cards --------------------------------------------- */
.vitals-grid {
  margin-top: 1.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
}

.organ-card {
  background: rgba(13, 26, 20, 0.92);
  border: 1px solid rgba(57,255,142,0.2);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  animation: chartIn 0.5s ease both;
}
.organ-card:nth-child(2) { animation-delay: 0.08s; }
.organ-card:nth-child(3) { animation-delay: 0.16s; }
.organ-card:nth-child(4) { animation-delay: 0.24s; }
.organ-card:nth-child(5) { animation-delay: 0.32s; }

.organ-head { display: flex; align-items: center; gap: 0.7rem; }
.organ-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-size: 1.1rem;
}
.organ-label { font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.06em; flex: 1; }
.organ-score { font-family: var(--mono); font-size: 1.25rem; }

.st-healthy  .organ-icon { background: rgba(57,255,142,0.14); color: var(--pulse); }
.st-stable   .organ-icon { background: rgba(85,200,255,0.14); color: var(--info); }
.st-concern  .organ-icon { background: rgba(255,179,64,0.15); color: var(--warn); }
.st-critical .organ-icon { background: rgba(255,77,94,0.16); color: var(--alert); animation: crossGlow 1.6s infinite; }
.st-healthy  .organ-score { color: var(--pulse); }
.st-stable   .organ-score { color: var(--info); }
.st-concern  .organ-score { color: var(--warn); }
.st-critical .organ-score { color: var(--alert); }

.organ-bar {
  height: 6px;
  margin: 0.7rem 0 0.8rem;
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  overflow: hidden;
}
.organ-bar i {
  display: block; height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width 1.2s cubic-bezier(.2,.8,.3,1);
}
.st-healthy  .organ-bar i { background: var(--pulse); }
.st-stable   .organ-bar i { background: var(--info); }
.st-concern  .organ-bar i { background: var(--warn); }
.st-critical .organ-bar i { background: var(--alert); }

.organ-findings { list-style: none; font-size: 0.83rem; color: #b9d8c6; }
.organ-findings li { padding: 0.22rem 0 0.22rem 1.1rem; position: relative; line-height: 1.4; }
.organ-findings li::before {
  content: '▸';
  position: absolute; left: 0;
  color: var(--pulse-dim);
}

/* --- Prescription pad ------------------------------------------------------ */
.rx-pad {
  margin-top: 1.8rem;
  background: #fdfbf3;
  color: #2b2a22;
  border-radius: 10px;
  padding: 1.5rem 1.8rem;
  transform: rotate(0.4deg);
  box-shadow: 0 12px 34px rgba(0,0,0,0.45);
  border-top: 10px solid #3a6ea8;
}
.rx-head { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; border-bottom: 2px solid #3a6ea8; padding-bottom: 0.6rem; }
.rx-symbol { font-size: 2.2rem; font-weight: 700; color: #3a6ea8; font-family: Georgia, serif; }
.rx-head h3 { font-family: var(--mono); letter-spacing: 0.15em; font-size: 1rem; color: #3a6ea8; }
.rx-doctor { margin-left: auto; font-size: 0.75rem; font-style: italic; color: #7a7666; }
#rx-list { margin: 1rem 0 0 1.4rem; }
#rx-list li { padding: 0.35rem 0; font-size: 0.92rem; line-height: 1.5; border-bottom: 1px dotted #cfc9ae; }
.rx-footer { margin-top: 1rem; font-size: 0.8rem; color: #6d6954; font-style: italic; }

/* --- Buttons / footer -------------------------------------------------------- */
.new-patient-btn {
  margin: 2rem auto 0;
  display: block;
  font-family: var(--mono);
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  padding: 0.8rem 1.6rem;
  background: transparent;
  color: var(--pulse);
  border: 1px solid rgba(57,255,142,0.5);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.new-patient-btn:hover { background: rgba(57,255,142,0.1); box-shadow: 0 0 18px rgba(57,255,142,0.25); }

#ward-footer {
  text-align: center;
  padding: 1.6rem 1rem 2.2rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: #567a67;
  border-top: 1px solid rgba(57,255,142,0.15);
}

@media (max-width: 640px) {
  .ward-title { font-size: 1.2rem; letter-spacing: 0.2em; }
  .header-vitals { display: none; }
  .chart-top { flex-direction: column; text-align: center; }
  .patient-summary { order: 2; }
}
