/* HIS Demo UI — shared styles */
:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --success: #198754;
  --warning: #f59e0b;
  --danger: #dc3545;
  --lab: #7c3aed;
  --pharmacy: #059669;
  --internal: #2563eb;
  --doctor: #0ea5e9;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Tahoma", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Top bar ── */
.demo-topbar {
  background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
  color: #fff;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.demo-brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.demo-brand p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

.demo-badge-demo {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

/* ── Navigation ── */
.demo-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
}

.demo-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.demo-nav a:hover { color: var(--primary); }

.demo-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.demo-nav .nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.demo-nav a[data-dept="doctor"] .nav-icon { background: #e0f2fe; }
.demo-nav a[data-dept="internal"] .nav-icon { background: #dbeafe; }
.demo-nav a[data-dept="lab"] .nav-icon { background: #ede9fe; }
.demo-nav a[data-dept="pharmacy"] .nav-icon { background: #d1fae5; }

.demo-nav .count {
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  min-width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
}

.demo-nav .count.hidden { display: none; }

/* ── Layout ── */
.demo-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
}

.demo-page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.demo-page-title h2 {
  margin: 0;
  font-size: 1.5rem;
}

.demo-page-title .dept-tag {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.dept-tag.doctor { background: #e0f2fe; color: #0369a1; }
.dept-tag.internal { background: #dbeafe; color: #1d4ed8; }
.dept-tag.lab { background: #ede9fe; color: #6d28d9; }
.dept-tag.pharmacy { background: #d1fae5; color: #047857; }

.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .demo-grid { grid-template-columns: 1fr; }
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card h3::before {
  content: "";
  width: 4px;
  height: 1.1rem;
  border-radius: 2px;
  background: var(--primary);
}

.card.full-width { grid-column: 1 / -1; }

/* ── Forms ── */
label {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

textarea { resize: vertical; min-height: 80px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, opacity 0.15s;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-lab { background: var(--lab); color: #fff; }
.btn-pharmacy { background: var(--pharmacy); color: #fff; }
.btn-internal { background: var(--internal); color: #fff; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* ── Order queue ── */
.queue-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.queue-empty .icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.4; }

.order-list { display: flex; flex-direction: column; gap: 0.75rem; }

.order-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: #f8fafc;
  border-right: 4px solid var(--primary);
  animation: slideIn 0.3s ease;
}

.order-card.lab { border-right-color: var(--lab); }
.order-card.pharmacy { border-right-color: var(--pharmacy); }
.order-card.internal { border-right-color: var(--internal); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.order-card-header strong { font-size: 1rem; }

.order-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.order-body {
  font-size: 0.9rem;
  line-height: 1.6;
}

.order-body dt {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.35rem;
}

.order-body dd {
  margin: 0.15rem 0 0;
}

.status-pill {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.pending { background: #fef3c7; color: #b45309; }
.status-pill.received { background: #dbeafe; color: #1d4ed8; }
.status-pill.done { background: #d1fae5; color: #047857; }

/* ── Hub cards ── */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.hub-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  display: block;
}

.hub-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
}

.hub-card .hub-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.hub-card h3 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.hub-card p { margin: 0; font-size: 0.85rem; color: var(--muted); line-height: 1.5; }

.hub-card .pending-count {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--danger);
}

/* ── Toast ── */
.demo-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.9rem;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.demo-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Patient chip ── */
.patient-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.medicine-line {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: flex-start;
}

.medicine-line input { flex: 1; }
.medicine-line .btn-remove {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1.4rem;
}
