/* =============================================================
   Cloud HMS — Utility / Helper Styles
   ============================================================= */

/* Spacing helpers for clinical density */
.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }

/* Clinical alert indicators */
.allergy-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #fde8ea;
  color: #dc3545;
  border: 1px solid #f5c2c7;
  border-radius: 5px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.chronic-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffe69c;
  border-radius: 5px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Vitals pill */
.vital-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  min-width: 70px;
  text-align: center;
}
.vital-pill .val { font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
.vital-pill .lbl { font-size: 0.68rem; color: #6c757d; text-transform: uppercase; }
.vital-pill.critical { border-color: #dc3545; background: #fde8ea; }
.vital-pill.critical .val { color: #dc3545; }
.vital-pill.warning { border-color: #ffc107; background: #fff3cd; }
.vital-pill.warning .val { color: #856404; }

/* Queue number */
.queue-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--hms-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Section divider */
.hms-divider {
  border: none;
  border-top: 2px solid #f0f2f5;
  margin: 1rem 0;
}

/* Print styles */
@media print {
  .hms-topbar, .hms-sidebar, .hms-alerts-panel,
  .no-print, .btn { display: none !important; }
  .hms-main-content { margin-left: 0 !important; }
  body { background: white; }
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, #e9ecef 25%, #f8f9fa 50%, #e9ecef 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Focus ring for accessibility */
:focus-visible { outline: 2px solid var(--hms-primary); outline-offset: 2px; }

/* Compact form */
.form-compact .form-label { margin-bottom: 0.2rem; font-size: 0.8rem; font-weight: 600; }
.form-compact .form-control,
.form-compact .form-select { font-size: 0.85rem; padding: 0.3rem 0.6rem; }

/* Responsive table wrapper */
.table-responsive-hms { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Word break for long text in tables */
.break-word { word-break: break-word; }

/* Timeline */
.hms-timeline { position: relative; padding-left: 2rem; }
.hms-timeline::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #dee2e6;
}
.hms-timeline-item { position: relative; margin-bottom: 1.25rem; }
.hms-timeline-item::before {
  content: '';
  position: absolute;
  left: -1.42rem;
  top: 0.3rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--hms-primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--hms-primary);
}
.hms-timeline-item.critical::before { background: var(--hms-danger); box-shadow: 0 0 0 2px var(--hms-danger); }
.hms-timeline-item.warning::before  { background: var(--hms-warning); box-shadow: 0 0 0 2px var(--hms-warning); }
.hms-timeline-item.success::before  { background: var(--hms-success); box-shadow: 0 0 0 2px var(--hms-success); }

.hms-timeline-time { font-size: 0.72rem; color: #6c757d; }
.hms-timeline-title { font-size: 0.85rem; font-weight: 600; margin: 0; }
.hms-timeline-body { font-size: 0.82rem; color: #495057; margin-top: 0.15rem; }

/* SOAP notes */
.soap-section { border-left: 4px solid #dee2e6; padding-left: 0.75rem; margin-bottom: 0.75rem; }
.soap-section.subjective { border-color: #0d6efd; }
.soap-section.objective  { border-color: #198754; }
.soap-section.assessment { border-color: #fd7e14; }
.soap-section.plan       { border-color: #6f42c1; }

/* Bed grid */
.bed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 0.5rem; }
.bed-cell {
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s;
  font-size: 0.78rem;
}
.bed-cell:hover { transform: scale(1.03); }
.bed-cell.occupied { border-color: #dc3545; background: #fde8ea; }
.bed-cell.available { border-color: #198754; background: #d1e7dd; }
.bed-cell.reserved { border-color: #ffc107; background: #fff3cd; }
.bed-cell.maintenance { border-color: #6c757d; background: #e9ecef; }

/* Extra-small button (Bootstrap 5 has no btn-xs) */
.btn-xs {
  padding: 0.15rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.4;
  border-radius: 0.2rem;
}

/* Purple accent (radiographer role, imaging, custom roles) */
.bg-purple { background-color: #6f42c1 !important; color: #fff !important; }
.text-purple { color: #6f42c1 !important; }
