/* ============================================================
   CHIKITSAALYE — COMPONENTS
   Reusable UI elements: buttons, badges, cards, forms, tables
   ============================================================ */

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5625rem 1.125rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--brand-teal);
  color: white;
  border-color: var(--brand-teal);
}
.btn-primary:hover {
  background: #0C6680;
  border-color: #0C6680;
  color: white;
  box-shadow: 0 2px 8px rgba(14,116,144,0.3);
}

.btn-navy {
  background: var(--brand-navy);
  color: white;
  border-color: var(--brand-navy);
}
.btn-navy:hover {
  background: var(--brand-navy-dark);
  color: white;
  box-shadow: 0 2px 8px rgba(30,58,95,0.3);
}

.btn-outline {
  background: transparent;
  color: var(--brand-teal);
  border-color: var(--brand-teal);
}
.btn-outline:hover {
  background: var(--brand-teal-xlight);
  color: var(--brand-teal);
}

.btn-outline-navy {
  background: transparent;
  color: var(--brand-navy);
  border-color: var(--brand-navy);
}
.btn-outline-navy:hover {
  background: rgba(30,58,95,0.06);
  color: var(--brand-navy);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}
.btn-danger:hover { background: #B91C1C; color: white; }

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: var(--text-md);
  border-radius: var(--radius-lg);
}

.btn-xl {
  padding: 1rem 2rem;
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-md);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── BADGES / STATUS CHIPS ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.6rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info); }
.badge-navy    { background: rgba(30,58,95,0.1);       color: var(--brand-navy); }
.badge-teal    { background: var(--brand-teal-light);  color: var(--brand-teal); }
.badge-muted   { background: var(--surface-muted);     color: var(--text-muted); }
.badge-purple  { background: var(--color-purple-bg);   color: var(--color-purple); }

.badge-dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-hover {
  transition: var(--transition-base);
}
.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
  border-color: var(--border-mid);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.card-body {
  padding: var(--space-5);
}

.card-footer {
  padding: var(--space-3) var(--space-5);
  background: var(--surface-subtle);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Stat card */
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: var(--space-3);
}
.stat-card .stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
  color: var(--text-primary);
}
.stat-card .stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}
.stat-card .stat-delta {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  margin-top: var(--space-2);
}
.stat-card .stat-delta.up   { color: var(--color-success); }
.stat-card .stat-delta.down { color: var(--color-danger); }

/* Highlight card */
.card-teal-accent { border-left: 4px solid var(--brand-teal); }
.card-navy-accent { border-left: 4px solid var(--brand-navy); }
.card-danger-accent { border-left: 4px solid var(--color-danger); }
.card-warning-accent { border-left: 4px solid var(--color-warning); }
.card-success-accent { border-left: 4px solid var(--color-success); }

/* ── ALERT BANNERS ──────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  border: 1px solid transparent;
}
.alert-icon { font-size: 18px; flex-shrink: 0; line-height: 1; }
.alert-body { flex: 1; }
.alert-title { font-weight: var(--weight-semibold); margin-bottom: 2px; }

.alert-info    { background: var(--color-info-bg);    border-color: #BFDBFE; color: #1E40AF; }
.alert-success { background: var(--color-success-bg); border-color: #A7F3D0; color: #065F46; }
.alert-warning { background: var(--color-warning-bg); border-color: #FDE68A; color: #92400E; }
.alert-danger  { background: var(--color-danger-bg);  border-color: #FECACA; color: #991B1B; }

/* ── PROGRESS BAR ───────────────────────────────────────────── */
.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--surface-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}
.progress-bar-fill.teal    { background: var(--brand-teal); }
.progress-bar-fill.navy    { background: var(--brand-navy); }
.progress-bar-fill.danger  { background: var(--color-danger); }
.progress-bar-fill.warning { background: var(--color-warning); }
.progress-bar-fill.success { background: var(--color-success); }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.5625rem 0.875rem;
  font-size: var(--text-base);
  background: var(--surface-white);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: var(--transition-fast);
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand-teal);
  box-shadow: var(--shadow-focus);
}
.form-input::placeholder { color: var(--text-faint); }
.form-textarea { resize: vertical; min-height: 100px; }

.input-wrap {
  position: relative;
}
.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 16px;
}
.input-wrap .form-input { padding-left: 2.25rem; }

.input-wrap-right .input-icon { left: auto; right: 12px; }
.input-wrap-right .form-input { padding-right: 2.25rem; }

/* ── TABLES ─────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.data-table thead tr {
  background: var(--surface-subtle);
  border-bottom: 2px solid var(--border-light);
}
.data-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  white-space: nowrap;
}
.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-secondary);
}
.data-table tbody tr:hover { background: var(--surface-subtle); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── AVATAR ─────────────────────────────────────────────────── */
.avatar {
  border-radius: var(--radius-full);
  background: var(--brand-teal-light);
  color: var(--brand-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  flex-shrink: 0;
}
.avatar-sm  { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-md  { width: 40px; height: 40px; }
.avatar-lg  { width: 48px; height: 48px; font-size: var(--text-md); }
.avatar-xl  { width: 64px; height: 64px; font-size: var(--text-xl); }

.avatar-navy  { background: rgba(30,58,95,0.12); color: var(--brand-navy); }
.avatar-green { background: var(--color-success-bg); color: var(--color-success); }
.avatar-amber { background: var(--color-warning-bg); color: var(--color-warning); }
.avatar-red   { background: var(--color-danger-bg); color: var(--color-danger); }

/* ── QUEUE TOKEN ────────────────────────────────────────────── */
.token-number {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-xl);
  background: var(--brand-teal);
  color: white;
  box-shadow: 0 4px 16px rgba(14,116,144,0.35);
}
.token-number .token-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  opacity: 0.85;
  letter-spacing: 0.04em;
}
.token-number .token-val {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: 1;
}

/* ── NOTIFICATION DOT ───────────────────────────────────────── */
.notif-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
  border: 2px solid white;
}

/* ── PILL TABS (for small filter groups) ────────────────────── */
.pill-tabs {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.pill-tab {
  padding: 0.3rem 0.875rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-light);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.pill-tab:hover  { border-color: var(--brand-teal); color: var(--brand-teal); }
.pill-tab.active {
  background: var(--brand-teal);
  color: white;
  border-color: var(--brand-teal);
}

/* ── LIST ITEM (patient row, task row) ──────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
  cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--surface-subtle); }

.list-item-body { flex: 1; min-width: 0; }
.list-item-title {
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.list-item-meta {
  flex-shrink: 0;
  text-align: right;
}
.list-item-time {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* ── SECTION HEADER ─────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.section-header-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}
.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.empty-state-body { font-size: var(--text-sm); }

/* ── LOADING STATE ──────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-muted) 25%, var(--border-light) 50%, var(--surface-muted) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── TOOLTIP ─────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
  cursor: pointer;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: var(--z-tooltip, 200);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── DEPARTMENT PILL ─────────────────────────────────────────── */
.dept-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.25rem 0.6rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-sm);
  background: var(--brand-teal-light);
  color: var(--brand-teal);
}

/* ── ICON BOX ─────────────────────────────────────────────────── */
.icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
.icon-box-teal  { background: var(--brand-teal-light); color: var(--brand-teal); }
.icon-box-navy  { background: rgba(30,58,95,0.1); color: var(--brand-navy); }
.icon-box-green { background: var(--color-success-bg); color: var(--color-success); }
.icon-box-amber { background: var(--color-warning-bg); color: var(--color-warning); }
.icon-box-red   { background: var(--color-danger-bg); color: var(--color-danger); }
.icon-box-blue  { background: var(--color-info-bg); color: var(--color-info); }
.icon-box-purple{ background: var(--color-purple-bg); color: var(--color-purple); }

/* ── BAR CHART (CSS-only) ────────────────────────────────────── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 100px;
}
.bar-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  height: 100%;
  justify-content: flex-end;
}
.bar-chart-bar {
  width: 100%;
  background: var(--brand-teal);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height 0.6s ease;
  min-height: 4px;
}
.bar-chart-bar.muted  { background: var(--border-mid); }
.bar-chart-bar.danger { background: var(--color-danger); }
.bar-chart-bar.amber  { background: var(--color-warning); }
.bar-chart-label {
  font-size: 10px;
  color: var(--text-faint);
  text-align: center;
  white-space: nowrap;
}

/* ── HORIZONTAL OCCUPANCY GAUGE ──────────────────────────────── */
.occ-gauge-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.occ-gauge-bar {
  flex: 1;
  height: 10px;
  background: var(--surface-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.occ-gauge-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* ── LIVE DOT ─────────────────────────────────────────────────── */
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-success);
}
.live-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--color-success);
  border-radius: 50%;
  animation: live-pulse 1.8s ease infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}
