/* =====================================================
   OHC — Dashboard / Portal Shared Styles
   ===================================================== */

/* ─── LAYOUT ─── */
body { overflow-x: hidden; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 240px;
  background: var(--primary-dark);
  z-index: var(--z-nav);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}
.sidebar.collapsed { transform: translateX(-240px); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--sp-lg);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
/* OHC logo image in sidebar */
.brand-logo-img {
  height: 42px;
  width: auto;
  background: white;
  border-radius: 10px;
  padding: 4px 9px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  flex-shrink: 0;
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #FF4444);
  border-radius: 8px;
  flex-shrink: 0;
}
.brand-name { font-family: var(--font-heading); font-weight: 800; color: white; font-size: 0.95rem; line-height: 1.2; }
.brand-sub { font-size: 0.58rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 1px; }

.sidebar-nav {
  flex: 1;
  padding: var(--sp-md);
  overflow-y: auto;
}
.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  padding: var(--sp-sm) var(--sp-sm) 4px;
  margin-top: var(--sp-sm);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 10px var(--sp-sm);
  border-radius: var(--r-md);
  color: rgba(255,255,255,0.65);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--ease-fast);
  margin-bottom: 2px;
}
.sidebar-link:hover { background: rgba(255,255,255,0.08); color: white; }
.sidebar-link.active { background: rgba(255,255,255,0.15); color: white; }
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-full);
}

.sidebar-footer {
  padding: var(--sp-md);
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-footer .btn-ghost { color: rgba(255,255,255,0.6); font-size: 0.85rem; }
.sidebar-footer .btn-ghost:hover { color: white; background: rgba(255,255,255,0.08); }

/* ─── DASHBOARD MAIN ─── */
.dashboard-main {
  margin-left: 240px;
  min-height: 100vh;
  background: var(--bg);
  transition: margin-left 0.3s ease;
}
.dashboard-main.expanded { margin-left: 0; }

/* ─── TOPBAR ─── */
.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-xl);
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.dash-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}
.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--ease-fast);
}
.btn-icon:hover { background: var(--primary-xlight); color: var(--primary); }
.btn-icon svg { width: 18px; height: 18px; }

.notif-btn { position: relative; }
.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(27,46,107,0.3);
}

/* ─── CONTENT ─── */
.dash-content { padding: var(--sp-xl); }
.page { animation: fadeIn 0.3s ease; }

/* Welcome Banner */
.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--grad-hero);
  border-radius: var(--r-xl);
  padding: var(--sp-xl) var(--sp-2xl);
  margin-bottom: var(--sp-xl);
  position: relative;
  overflow: hidden;
}
.welcome-banner::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}
.welcome-left { position: relative; z-index: 1; }
.welcome-left h2 { color: white !important; margin-bottom: 4px; }
.welcome-left p { color: rgba(255,255,255,0.75) !important; }

/* Stats */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
}
.dash-stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  box-shadow: var(--shadow-sm);
  transition: var(--ease);
}
.dash-stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dsc-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dsc-icon.primary { background: var(--primary-xlight); }
.dsc-icon.primary svg { color: var(--primary); }
.dsc-icon.accent { background: var(--accent-xlight); }
.dsc-icon.accent svg { color: var(--accent); }
.dsc-icon.success { background: #D1FAE5; }
.dsc-icon.success svg { color: var(--success); }
.dsc-icon.warning { background: #FEF3C7; }
.dsc-icon.warning svg { color: var(--warning); }
.dsc-icon svg { width: 22px; height: 22px; }
.dsc-value { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1; }
.dsc-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* Dash Grid */
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-xl); }

/* Cards */
.dash-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--border);
}
.dash-card-header h4 { margin: 0; }
.dash-list { padding: var(--sp-md); }

/* Booking Item */
.booking-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md) 0;
  border-bottom: 1px solid var(--border);
}
.booking-item:last-child { border-bottom: none; }
.booking-item-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--primary-xlight);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.booking-item-icon svg { width: 18px; height: 18px; color: var(--primary); }
.booking-item-info { flex: 1; }
.booking-item-name { font-weight: 600; font-size: 0.88rem; }
.booking-item-date { font-size: 0.75rem; color: var(--text-muted); }
.booking-item-actions { display: flex; align-items: center; gap: var(--sp-sm); }

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-xl);
}
.page-header h2 { margin: 0; }

/* Bookings List */
.bookings-list { display: flex; flex-direction: column; gap: var(--sp-md); }
.booking-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--sp-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--ease);
}
.booking-card:hover { box-shadow: var(--shadow-md); }
.booking-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--sp-md); flex-wrap: wrap; gap: var(--sp-sm); }
.booking-card-id { font-size: 0.8rem; color: var(--text-muted); }
.booking-card-tests { font-weight: 700; font-size: 0.95rem; }
.booking-card-meta {
  display: flex;
  gap: var(--sp-lg);
  flex-wrap: wrap;
  margin-bottom: var(--sp-md);
}
.booking-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.booking-card-meta span svg { width: 14px; height: 14px; }
.booking-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--sp-md);
  border-top: 1px solid var(--border);
}
.booking-price { font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; color: var(--primary); }

/* Reports Grid */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-lg);
}
.report-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--sp-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--ease);
}
.report-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.report-card-icon {
  width: 48px; height: 48px;
  background: var(--primary-xlight);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-md);
}
.report-card-icon svg { width: 22px; height: 22px; color: var(--primary); }
.report-card-name { font-weight: 700; margin-bottom: 4px; }
.report-card-date { font-size: 0.78rem; color: var(--text-muted); margin-bottom: var(--sp-md); }
.report-card-footer { display: flex; gap: var(--sp-sm); }

/* Health Tips */
.tips-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-lg); }
.tip-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  border: 1px solid var(--border);
  display: flex;
  gap: var(--sp-md);
  box-shadow: var(--shadow-sm);
}
.tip-icon {
  width: 44px; height: 44px;
  background: var(--primary-xlight);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tip-icon svg { width: 20px; height: 20px; color: var(--primary); }
.tip-icon.accent { background: var(--accent-xlight); }
.tip-icon.accent svg { color: var(--accent); }
.tip-icon.success { background: #D1FAE5; }
.tip-icon.success svg { color: var(--success); }
.tip-card strong { font-size: 0.9rem; display: block; margin-bottom: 4px; }
.tip-card p { font-size: 0.82rem; }

/* Profile */
.profile-grid { max-width: 720px; }
.profile-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--sp-2xl);
  border: 1px solid var(--border);
  display: flex;
  gap: var(--sp-2xl);
}
.profile-avatar-section { text-align: center; flex-shrink: 0; }
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  box-shadow: 0 4px 16px rgba(27,46,107,0.3);
}
.profile-form { flex: 1; }

/* Notifications Panel */
.notif-panel {
  position: fixed;
  top: var(--nav-h);
  right: 0;
  width: 320px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  border-radius: 0 0 0 var(--r-xl);
  animation: slideInRight 0.25s ease;
}
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--border);
}
.notif-header h4 { margin: 0; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item {
  display: flex;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--border);
  transition: var(--ease-fast);
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-xlight); }
.notif-item svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.notif-item strong { font-size: 0.85rem; display: block; }
.notif-item p { font-size: 0.78rem; color: var(--text-muted); margin: 2px 0 0; }
.notif-time { font-size: 0.7rem; color: var(--text-light); }

/* Admin specific */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--primary-xlight); }
.data-table tr:last-child td { border-bottom: none; }

/* Agent portal */
.agent-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
}
.assignment-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--sp-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-md);
  transition: var(--ease);
}
.assignment-card:hover { box-shadow: var(--shadow-md); }
.assignment-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-md); }
.assignment-id { font-size: 0.8rem; color: var(--text-muted); }
.assignment-meta { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-md); }
.assignment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}
.assignment-row svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.assignment-actions { display: flex; gap: var(--sp-sm); }

/* Responsive */
@media(max-width:1024px) {
  .dash-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tips-grid { grid-template-columns: 1fr; }
  .admin-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media(max-width:768px) {
  .sidebar { transform: translateX(-240px); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.4); }
  .dashboard-main { margin-left: 0; }
  .dash-stats-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid-2 { grid-template-columns: 1fr; }
  .profile-card { flex-direction: column; }
  .agent-stats { grid-template-columns: 1fr; }
}

/* ─── SIDEBAR OVERLAY (mobile backdrop) ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: calc(var(--z-nav) - 1);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  cursor: pointer;
}
.sidebar-overlay.active { display: block; }

/* ─── SIDEBAR CLOSE BUTTON (mobile only) ─── */
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 14px;
  right: 12px;
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
@media(max-width:768px) {
  .sidebar-close-btn { display: flex; }
  .sidebar-brand { position: relative; }
}

/* ─── UTILITIES & MODALS ─── */
.hidden { display: none !important; }

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
  padding: var(--sp-md);
}
.modal-box {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: slideUp 0.3s ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 1.25rem; }
.modal-body {
  padding: var(--sp-lg);
  overflow-y: auto;
}
.modal-footer {
  padding: var(--sp-lg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-sm);
  background: var(--bg);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
