/* ============================================================
   KOAF MediPro - Main Stylesheet
   Modern Healthcare SaaS Design
   ============================================================ */

:root {
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --secondary: #0dcaf0;
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #0dcaf0;
  --teal: #20c997;
  --light: #f8f9fa;
  --dark: #212529;
  --gray: #6c757d;
  --gray-light: #e9ecef;
  --white: #ffffff;
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
  --transition: all 0.25s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--dark);
  background: #f0f4f8;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.page-content {
  flex: 1;
  padding: 24px;
  margin-top: var(--topbar-height);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0d1b2a 0%, #1a2e44 100%);
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-size: 16px;
  font-weight: 700;
}

.sidebar-logo i { color: #e74c3c; font-size: 22px; }

.sidebar-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 18px;
  cursor: pointer;
  display: none;
  padding: 4px;
}

.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-initials {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.sidebar-user-name { color: white; font-weight: 600; font-size: 13px; }
.sidebar-user-role { color: rgba(255,255,255,0.5); font-size: 11px; text-transform: capitalize; }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  border-radius: 0;
}

.sidebar-link:hover {
  color: white;
  background: rgba(255,255,255,0.08);
}

.sidebar-link.active {
  color: white;
  background: rgba(13,110,253,0.3);
  border-left: 3px solid var(--primary);
}

.sidebar-link i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

.badge-pulse {
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  margin-left: auto;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 900;
  box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--gray);
  padding: 8px;
  border-radius: var(--radius-sm);
  display: none;
}

.page-title { font-size: 18px; font-weight: 700; color: var(--dark); }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-item { position: relative; }

.topbar-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: var(--light);
  border-radius: 50%;
  color: var(--gray);
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.topbar-icon:hover { background: var(--primary); color: white; }

.badge-count {
  position: absolute;
  top: -2px; right: -2px;
  width: 18px; height: 18px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-user { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13px; }

.btn-icon {
  width: 34px; height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--light);
  border-radius: 50%;
  color: var(--gray);
  transition: var(--transition);
}
.btn-icon:hover { background: var(--danger); color: white; }

/* Notification Dropdown */
.notification-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 1050;
  overflow: hidden;
}

.topbar-item:hover .notification-dropdown { display: block; }

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-light);
  font-weight: 600;
  font-size: 13px;
}

.notif-list { max-height: 320px; overflow-y: auto; }

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-light);
  transition: var(--transition);
}

.notif-item:hover { background: var(--light); }
.notif-item.unread { background: #eff6ff; }

.notif-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.notif-primary { background: #dbeafe; color: var(--primary); }
.notif-danger { background: #fee2e2; color: var(--danger); }
.notif-success { background: #d1fae5; color: var(--success); }
.notif-info { background: #e0f7fa; color: var(--secondary); }

.notif-title { font-size: 12px; font-weight: 600; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--gray); margin-top: 2px; }
.notif-empty { padding: 24px; text-align: center; color: var(--gray); font-size: 13px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: none;
  overflow: hidden;
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
}

.card-title { font-size: 15px; font-weight: 700; color: var(--dark); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--gray-light); background: var(--light); }

/* Stat Cards */
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.teal::before { background: var(--teal); }
.stat-card.info::before { background: var(--info); }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.primary { background: #dbeafe; color: var(--primary); }
.stat-icon.success { background: #d1fae5; color: var(--success); }
.stat-icon.warning { background: #fef3c7; color: var(--warning); }
.stat-icon.danger { background: #fee2e2; color: var(--danger); }
.stat-icon.teal { background: #d1faf4; color: var(--teal); }
.stat-icon.info { background: #e0f7fa; color: var(--info); }

.stat-info { flex: 1; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1.1; color: var(--dark); }
.stat-label { font-size: 12px; color: var(--gray); font-weight: 500; margin-top: 2px; }
.stat-change { font-size: 11px; margin-top: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  padding: 12px 16px;
  background: var(--light);
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 2px solid var(--gray-light);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-light);
  vertical-align: middle;
}

.table tbody tr:hover { background: #f8fbff; }
.table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-primary { background: #dbeafe; color: var(--primary); }
.badge-success { background: #d1fae5; color: var(--success); }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-secondary { background: var(--gray-light); color: var(--gray); }
.badge-info { background: #e0f7fa; color: #0097a7; }
.badge-teal { background: #d1faf4; color: #0d9488; }

/* Status badges */
.status-active, .status-available, .status-completed, .status-paid, .status-present { background: #d1fae5; color: var(--success); }
.status-pending, .status-waiting { background: #fef3c7; color: #92400e; }
.status-approved, .status-called { background: #dbeafe; color: var(--primary); }
.status-cancelled, .status-inactive, .status-suspended { background: #fee2e2; color: var(--danger); }
.status-new { background: #fee2e2; color: var(--danger); }
.status-resolved { background: #d1fae5; color: var(--success); }
.status-with_doctor { background: #e0f7fa; color: #0097a7; }
.status-dispensed { background: #d1faf4; color: #0d9488; }
.status-partial { background: #fef3c7; color: #92400e; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #157347; color: white; }

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

.btn-warning { background: var(--warning); color: #212529; }
.btn-warning:hover { background: #ffca2c; }

.btn-teal { background: var(--teal); color: white; }
.btn-teal:hover { background: #1aab81; color: white; }

.btn-outline-primary { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }

.btn-outline-danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: white; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

.btn-sos {
  background: linear-gradient(135deg, #dc3545, #c0392b);
  color: white;
  font-size: 18px;
  padding: 18px 40px;
  border-radius: 50px;
  box-shadow: 0 0 0 0 rgba(220,53,69,0.7);
  animation: sosPulse 2s infinite;
  font-weight: 800;
  letter-spacing: 1px;
}

@keyframes sosPulse {
  0% { box-shadow: 0 0 0 0 rgba(220,53,69,0.7); }
  70% { box-shadow: 0 0 0 20px rgba(220,53,69,0); }
  100% { box-shadow: 0 0 0 0 rgba(220,53,69,0); }
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--dark);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--dark);
  transition: var(--transition);
  background: white;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,0.1);
}

.form-control::placeholder { color: #9ca3af; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.input-group {
  display: flex;
  gap: 0;
}
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding-left: 14px; padding-right: 14px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success { background: #d1fae5; color: #166534; border-left: 4px solid var(--success); }
.alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: #e0f7fa; color: #0c4a6e; border-left: 4px solid var(--info); }

/* ============================================================
   GRID UTILITIES
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }

/* ============================================================
   PATIENT PASSPORT
   ============================================================ */
.passport-card {
  max-width: 680px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  overflow: hidden;
}

.passport-header {
  background: linear-gradient(135deg, #0d6efd, #0dcaf0);
  padding: 24px 30px;
  color: white;
  display: flex;
  align-items: center;
  gap: 20px;
}

.passport-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.5);
  overflow: hidden;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: white;
}

.passport-info h2 { font-size: 22px; font-weight: 800; }
.passport-info .patient-code { font-size: 13px; opacity: 0.8; margin-top: 4px; }

.passport-body { padding: 24px 30px; }

.passport-section { margin-bottom: 20px; }
.passport-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--gray); margin-bottom: 12px; font-weight: 700; }

.passport-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.passport-field { background: var(--light); border-radius: var(--radius-sm); padding: 12px 14px; }
.passport-field-label { font-size: 11px; color: var(--gray); font-weight: 600; margin-bottom: 2px; }
.passport-field-value { font-size: 14px; font-weight: 700; color: var(--dark); }

.alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #fee2e2;
  color: var(--danger);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin: 4px 4px 4px 0;
}

/* ============================================================
   CHAT
   ============================================================ */
.chat-container {
  display: flex;
  height: calc(100vh - var(--topbar-height) - 48px);
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chat-list {
  width: 280px;
  border-right: 1px solid var(--gray-light);
  overflow-y: auto;
  flex-shrink: 0;
}

.chat-list-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-light);
  font-weight: 700;
  font-size: 15px;
}

.chat-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-light);
  cursor: pointer;
  transition: var(--transition);
}
.chat-item:hover, .chat-item.active { background: #f0f7ff; }

.chat-item-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.chat-item-info { flex: 1; min-width: 0; }
.chat-item-name { font-weight: 600; font-size: 13px; }
.chat-item-preview { font-size: 11px; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-item-time { font-size: 10px; color: var(--gray); margin-top: 4px; }

.chat-main { flex: 1; display: flex; flex-direction: column; }

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info h3 { font-size: 15px; font-weight: 700; }
.chat-header-info p { font-size: 12px; color: var(--success); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message { display: flex; gap: 10px; max-width: 70%; }
.message.sent { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  align-self: flex-end;
}

.message-bubble {
  background: white;
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  font-size: 13px;
  line-height: 1.5;
}

.message.sent .message-bubble {
  background: var(--primary);
  color: white;
  border-radius: 16px 16px 4px 16px;
}

.message-time { font-size: 10px; color: var(--gray); margin-top: 4px; text-align: right; }
.message.sent .message-time { text-align: left; color: rgba(255,255,255,0.7); }

.message.system .message-bubble {
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  max-width: 100%;
  text-align: center;
}

.chat-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--gray-light);
  background: white;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  border: 1.5px solid var(--gray-light);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 13px;
  outline: none;
  font-family: var(--font);
}

.chat-input-row textarea:focus { border-color: var(--primary); }

/* AI Chat */
.ai-chat-container {
  max-width: 760px;
  margin: 0 auto;
}

.ai-chat-header {
  background: linear-gradient(135deg, #1a2e44, #0d6efd);
  color: white;
  padding: 20px 24px;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.ai-icon {
  width: 50px; height: 50px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.ai-messages {
  height: 420px;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-disclaimer {
  background: #fef3c7;
  border-left: 3px solid var(--warning);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #92400e;
  margin-bottom: 16px;
}

/* ============================================================
   EMERGENCY SOS
   ============================================================ */
.sos-container {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.sos-warning {
  background: linear-gradient(135deg, #dc3545, #c0392b);
  color: white;
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 24px;
}

.sos-warning i { font-size: 48px; margin-bottom: 12px; }
.sos-warning h2 { font-size: 24px; font-weight: 800; }

.sos-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}

.sos-call-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  transition: var(--transition);
}

.sos-call-btn i { font-size: 28px; }
.sos-call-btn span { font-size: 12px; }

.sos-call-btn.clinic { background: #fee2e2; color: var(--danger); }
.sos-call-btn.contact { background: #dbeafe; color: var(--primary); }
.sos-call-btn.state { background: #fef3c7; color: #92400e; }

.sos-call-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* ============================================================
   QUEUE DISPLAY
   ============================================================ */
.queue-now-serving {
  background: linear-gradient(135deg, var(--primary), var(--teal));
  color: white;
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  margin-bottom: 24px;
}

.queue-number { font-size: 72px; font-weight: 900; line-height: 1; }
.queue-label { font-size: 16px; opacity: 0.8; margin-top: 8px; }

.queue-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: white;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.queue-pos {
  width: 36px; height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

/* ============================================================
   PUBLIC WEBSITE STYLES
   ============================================================ */
.navbar {
  background: white;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

.navbar-brand i { color: #dc3545; font-size: 24px; }

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--dark);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active { color: var(--primary); background: #dbeafe; }

.navbar-actions { display: flex; align-items: center; gap: 10px; }

.hero {
  background: linear-gradient(135deg, #0d1b2a 0%, #1a2e44 40%, #0d6efd 100%);
  padding: 100px 0 80px;
  color: white;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(13,202,240,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content { max-width: 640px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.hero h1 { font-size: 52px; font-weight: 900; line-height: 1.1; margin-bottom: 20px; }
.hero p { font-size: 18px; opacity: 0.85; margin-bottom: 32px; line-height: 1.7; }

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn-hero-primary {
  background: var(--primary);
  color: white;
  padding: 14px 28px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}
.btn-hero-primary:hover { background: var(--primary-dark); transform: translateY(-2px); color: white; }

.btn-hero-sos {
  background: linear-gradient(135deg, #dc3545, #c0392b);
  color: white;
  padding: 14px 28px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: sosPulse 2s infinite;
  transition: var(--transition);
}
.btn-hero-sos:hover { transform: translateY(-2px); color: white; }

.section { padding: 80px 0; }
.section-title { font-size: 36px; font-weight: 800; text-align: center; margin-bottom: 12px; }
.section-subtitle { font-size: 16px; color: var(--gray); text-align: center; margin-bottom: 56px; }

.dept-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }

.dept-card {
  background: white;
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
}

.dept-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-bottom: 3px solid var(--primary); }

.dept-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #dbeafe, #e0f7fa);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 26px;
  color: var(--primary);
}

.dept-name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.dept-desc { font-size: 12px; color: var(--gray); line-height: 1.5; }

.doctor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; }

.doctor-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.doctor-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.doctor-card-img {
  height: 200px;
  background: linear-gradient(135deg, #dbeafe, #e0f7fa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  color: var(--primary);
}

.doctor-card-body { padding: 18px; }
.doctor-name { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.doctor-spec { font-size: 12px; color: var(--primary); font-weight: 600; margin-bottom: 8px; }
.doctor-dept { font-size: 12px; color: var(--gray); }
.doctor-fee { font-size: 14px; font-weight: 700; color: var(--success); margin-top: 8px; }

.testimonial-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
}

.testimonial-card::before {
  content: '"';
  position: absolute;
  top: 16px; left: 20px;
  font-size: 60px;
  color: var(--primary);
  opacity: 0.2;
  font-family: Georgia, serif;
  line-height: 1;
}

.testimonial-text { font-size: 14px; line-height: 1.7; color: var(--gray); margin-bottom: 16px; padding-top: 16px; }
.testimonial-author { display: flex; align-items: center; gap: 12px; }
.testimonial-author-info strong { font-size: 14px; font-weight: 700; display: block; }
.testimonial-author-info span { font-size: 12px; color: var(--gray); }

.cta-section {
  background: linear-gradient(135deg, #0d1b2a, #0d6efd);
  color: white;
  padding: 80px 0;
  text-align: center;
}

.footer {
  background: #0d1b2a;
  color: rgba(255,255,255,0.7);
  padding: 60px 0 30px;
}

.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand { font-size: 20px; font-weight: 800; color: white; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.footer-desc { font-size: 13px; line-height: 1.7; margin-bottom: 16px; }
.footer-heading { font-size: 13px; font-weight: 700; color: white; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; }
.footer-link { display: block; padding: 4px 0; font-size: 13px; transition: color 0.2s; }
.footer-link:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 24px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; }

.whatsapp-float {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 56px; height: 56px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
  box-shadow: 0 4px 16px rgba(37,211,102,0.4);
  z-index: 999;
  transition: var(--transition);
}

.whatsapp-float:hover { transform: scale(1.1); background: #128C7E; color: white; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1b2a 0%, #1a2e44 50%, #0d6efd 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo .logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  margin-bottom: 12px;
}

.auth-logo h1 { font-size: 24px; font-weight: 800; color: var(--dark); }
.auth-logo p { font-size: 13px; color: var(--gray); margin-top: 4px; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--gray); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-light); }

/* ============================================================
   MOBILE MENU & HAMBURGER
   ============================================================ */
.mobile-menu-btn { display: none; }

/* ============================================================
   VITALS DISPLAY
   ============================================================ */
.vital-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }

.vital-item {
  background: white;
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.vital-icon { font-size: 22px; margin-bottom: 8px; }
.vital-value { font-size: 20px; font-weight: 800; color: var(--dark); }
.vital-unit { font-size: 11px; color: var(--gray); }
.vital-label { font-size: 12px; color: var(--gray); margin-top: 4px; }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--gray-light); }

.timeline-item { position: relative; margin-bottom: 24px; }
.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 3px var(--gray-light);
}
.timeline-dot.primary { background: var(--primary); box-shadow: 0 0 0 3px #dbeafe; }
.timeline-dot.success { background: var(--success); box-shadow: 0 0 0 3px #d1fae5; }
.timeline-dot.warning { background: var(--warning); box-shadow: 0 0 0 3px #fef3c7; }
.timeline-dot.danger { background: var(--danger); box-shadow: 0 0 0 3px #fee2e2; }

.timeline-content {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.timeline-title { font-weight: 700; font-size: 13px; }
.timeline-time { font-size: 11px; color: var(--gray); margin-bottom: 4px; }
.timeline-desc { font-size: 12px; color: var(--gray); line-height: 1.5; }

/* ============================================================
   UTILITIES
   ============================================================ */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.ms-auto { margin-left: auto; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--gray); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.w-100 { width: 100%; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}
.empty-state i { font-size: 48px; opacity: 0.3; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--dark); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 { font-size: 18px; font-weight: 700; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .sidebar-close { display: block; }

  .main-content { margin-left: 0; }

  .topbar {
    left: 0;
    padding: 0 16px;
  }

  .sidebar-toggle { display: block; }

  .page-content { padding: 16px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }

  .sos-actions { grid-template-columns: 1fr; }
  .passport-fields { grid-template-columns: 1fr; }

  .chat-container { flex-direction: column; height: auto; }
  .chat-list { width: 100%; height: 200px; }

  .navbar-menu { display: none; }
  .mobile-menu-btn { display: block; }

  .hero h1 { font-size: 32px; }
  .section-title { font-size: 26px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }

  .hero-actions { flex-direction: column; }
  .btn-hero-primary, .btn-hero-sos { justify-content: center; }
}

@media (max-width: 480px) {
  .grid-stats { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { margin-top: 0; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
