/* ═══════════════════════════════════════════════════
   MediConnect — Professional Healthcare Design System
   ═══════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Brand */
  --brand:        #2563EB;
  --brand-dark:   #1D4ED8;
  --brand-light:  #DBEAFE;
  --accent:       #0EA5E9;

  /* Semantic */
  --success:      #10B981;
  --success-light:#D1FAE5;
  --warning:      #F59E0B;
  --warning-light:#FEF3C7;
  --danger:       #EF4444;
  --danger-light: #FEE2E2;
  --info:         #6366F1;
  --info-light:   #EDE9FE;

  /* Neutral scale */
  --gray-50:  #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  /* Layout */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  18px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 6px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.06);
  --shadow-md:  0 10px 15px rgba(0,0,0,.06), 0 4px 6px rgba(0,0,0,.05);
  --shadow-lg:  0 20px 25px rgba(0,0,0,.07), 0 10px 10px rgba(0,0,0,.04);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: .9rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: var(--brand); }
a:hover { color: var(--brand-dark); }

/* ── Typography ── */
h1,h2,h3,h4,h5,h6 { font-weight: 700; color: var(--gray-900); letter-spacing: -.02em; }
.text-muted { color: var(--gray-500) !important; }

/* ── Scrollbar (Webkit) ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }

/* ════════════════════════════════════════
   NAVBAR (Patient)
════════════════════════════════════════ */
.navbar {
  background: rgba(255,255,255,1) !important;
  border-bottom: 1px solid var(--gray-200);
  padding: 10px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
/* Flatpickr calendar always above navbar */
.flatpickr-calendar { z-index: 99999 !important; }
/* Page content never hidden under sticky bar */
html { scroll-padding-top: 65px; }
.navbar-brand {
  font-size: 1.1rem; font-weight: 800;
  color: var(--brand) !important;
  letter-spacing: -.03em;
}
.nav-link {
  font-size: .84rem; font-weight: 500;
  color: var(--gray-600) !important;
  padding: 6px 10px !important;
  border-radius: var(--radius-sm);
  transition: all .15s;
}
.nav-link:hover { color: var(--brand) !important; background: var(--brand-light); }
.navbar-toggler { border: 1px solid var(--gray-200); border-radius: var(--radius-sm); }

/* ════════════════════════════════════════
   SIDEBAR (Doctor / Admin)
════════════════════════════════════════ */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  width: 220px !important; min-width: 220px !important;
  background: var(--gray-900) !important;
  border-right: 1px solid var(--gray-800);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; color: var(--gray-400);
  border-radius: var(--radius-sm); margin-bottom: 1px;
  font-size: .83rem; font-weight: 500;
  transition: all .15s; letter-spacing: .01em;
}
.sidebar-link i { width: 16px; opacity: .7; }
.sidebar-link:hover { color: white; background: rgba(255,255,255,.07); }
.sidebar-link.active { color: white; background: var(--brand); }
.sidebar-link.active i { opacity: 1; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1040;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }
.sidebar-toggle {
  display: none !important; /* Replaced by mobile top bar in header.php */
}
@media (min-width: 769px) {
  .sidebar { position: sticky !important; transform: none !important; }
  .sidebar-overlay { display: none !important; }
}

/* ════════════════════════════════════════
   PAGE HEADER
════════════════════════════════════════ */
.page-header {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--brand);
}
.page-header h3 { margin: 0; font-size: 1.25rem; color: var(--gray-900); }
.page-header p  { margin: 3px 0 0; font-size: .83rem; color: var(--gray-500); }

/* ════════════════════════════════════════
   CARDS
════════════════════════════════════════ */
.card {
  border: 1px solid var(--gray-200) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  background: white;
}
.card-header {
  background: white !important;
  border-bottom: 1px solid var(--gray-100) !important;
  padding: 14px 20px !important;
  font-weight: 600;
}
.card-body { padding: 20px !important; }
.card-footer { background: var(--gray-50) !important; border-top: 1px solid var(--gray-100) !important; }

/* Stat Card */
.stat-card {
  border: 1px solid var(--gray-200) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  background: white;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md) !important;
  border-color: var(--brand) !important;
}
.stat-card .icon-box {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.stat-label { font-size: .77rem; color: var(--gray-500); margin-top: 2px; font-weight: 500; }

/* ════════════════════════════════════════
   APPOINTMENT CARDS
════════════════════════════════════════ */
.appt-card {
  border: 1px solid var(--gray-200) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  border-left: 3px solid var(--gray-300) !important;
  transition: all .15s; background: white;
}
.appt-card:hover { box-shadow: var(--shadow-md) !important; transform: translateY(-1px); }
.appt-card.pending   { border-left-color: var(--warning) !important; }
.appt-card.confirmed { border-left-color: var(--brand) !important; }
.appt-card.completed { border-left-color: var(--success) !important; }
.appt-card.cancelled { border-left-color: var(--gray-300) !important; opacity: .75; }
.appt-card.no_show   { border-left-color: var(--gray-300) !important; opacity: .75; }

.appt-status-icon {
  width: 38px; height: 38px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.appt-status-icon.pending   { background: var(--warning-light); color: #92400E; }
.appt-status-icon.confirmed { background: var(--brand-light);   color: var(--brand-dark); }
.appt-status-icon.completed { background: var(--success-light); color: #065F46; }
.appt-status-icon.cancelled { background: var(--gray-100);      color: var(--gray-500); }
.appt-status-icon.no_show   { background: var(--gray-100);      color: var(--gray-500); }

/* Status Pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px;
  font-size: .71rem; font-weight: 600; letter-spacing: .02em;
}
.status-pill.pending   { background: var(--warning-light); color: #92400E; }
.status-pill.confirmed { background: var(--brand-light);   color: var(--brand-dark); }
.status-pill.completed { background: var(--success-light); color: #065F46; }
.status-pill.cancelled { background: var(--gray-100);      color: var(--gray-600); }
.status-pill.no_show   { background: var(--gray-100);      color: var(--gray-600); }

/* ════════════════════════════════════════
   TABLES
════════════════════════════════════════ */
.table {
  font-size: .85rem; color: var(--gray-700);
  border-color: var(--gray-100);
}
.table thead th {
  font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--gray-500); border-bottom: 1px solid var(--gray-200);
  padding: 10px 14px; background: var(--gray-50);
}
.table tbody td { padding: 10px 14px; vertical-align: middle; border-color: var(--gray-100); }
.table-hover tbody tr:hover { background: var(--gray-50); }
.table-responsive { border: 1px solid var(--gray-200); border-radius: var(--radius-lg); overflow: hidden; }

/* ════════════════════════════════════════
   FORMS
════════════════════════════════════════ */
.form-control, .form-select {
  font-size: .875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--gray-800);
  transition: border-color .15s, box-shadow .15s;
  background: white;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  outline: none;
}
.form-control::placeholder { color: var(--gray-400); }
.form-label {
  font-size: .8rem; font-weight: 600;
  color: var(--gray-700); margin-bottom: 5px;
}
.input-group-text {
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  color: var(--gray-500);
  font-size: .85rem;
}
.form-text { font-size: .75rem; color: var(--gray-400); }

/* Auth Card */
.auth-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn {
  font-size: .84rem; font-weight: 600;
  border-radius: var(--radius);
  transition: all .15s;
  letter-spacing: .01em;
}
.btn-sm  { font-size: .78rem; padding: 4px 10px; }
.btn-lg  { font-size: .95rem; padding: 10px 20px; }
.btn-primary {
  background: var(--brand); border-color: var(--brand);
  color: white;
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }

/* ════════════════════════════════════════
   BADGES
════════════════════════════════════════ */
.badge {
  font-size: .71rem; font-weight: 600;
  padding: .3em .65em; border-radius: 99px;
  letter-spacing: .02em;
}

/* ════════════════════════════════════════
   MODALS
════════════════════════════════════════ */
.modal-content {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom: 1px solid var(--gray-100); padding: 16px 20px; }
.modal-footer { border-top: 1px solid var(--gray-100); padding: 14px 20px; }
.modal-body { padding: 20px; }
.btn-close { opacity: .4; }
.btn-close:hover { opacity: .8; }

/* ════════════════════════════════════════
   ALERTS
════════════════════════════════════════ */
.alert {
  border-radius: var(--radius); font-size: .85rem;
  border-width: 1px; padding: 10px 14px;
}
.alert-info    { background: #EFF6FF; border-color: var(--brand-light); color: var(--brand-dark); }
.alert-success { background: var(--success-light); border-color: #A7F3D0; color: #065F46; }
.alert-warning { background: var(--warning-light); border-color: #FDE68A; color: #92400E; }
.alert-danger  { background: var(--danger-light); border-color: #FECACA; color: #991B1B; }

/* ════════════════════════════════════════
   LANDING PAGE
════════════════════════════════════════ */
.hero-section {
  background: linear-gradient(135deg, var(--gray-900) 0%, #1e3a5f 60%, #1e3a8a 100%);
  color: white; padding: 80px 0 60px;
}
.hero-section h1 { font-size: clamp(2rem,5vw,3.2rem); font-weight: 800; letter-spacing: -.04em; color: white; }
.hero-section p   { opacity: .8; font-size: 1.1rem; }
.feature-card {
  background: white; border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl); box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-icon {
  width: 60px; height: 60px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; font-size: 1.5rem;
}
.spec-card {
  border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  cursor: pointer; transition: all .2s; background: white;
}
.spec-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-3px); }

/* ════════════════════════════════════════
   SLOT PICKER
════════════════════════════════════════ */
.slot-btn {
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200); background: white;
  cursor: pointer; font-size: .82rem; font-weight: 500;
  color: var(--gray-600); transition: all .15s;
}
.slot-btn:hover   { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.slot-btn.selected { background: var(--brand); color: white; border-color: var(--brand); }
.slot-btn.unavailable { background: var(--gray-50); color: var(--gray-300); cursor: not-allowed; }

/* ════════════════════════════════════════
   DOCTOR DASHBOARD COMPONENTS
════════════════════════════════════════ */
.time-chip {
  background: var(--gray-800); color: white;
  border-radius: var(--radius-sm); padding: 5px 9px;
  font-weight: 700; font-size: .8rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  white-space: nowrap; min-width: 68px; text-align: center;
  line-height: 1.2;
}
.patient-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .74rem; flex-shrink: 0;
}
.type-pill-video    { background:#DCFCE7;color:#15803D;font-size:.67rem;font-weight:700;padding:2px 7px;border-radius:99px; }
.type-pill-inperson { background:var(--gray-100);color:var(--gray-600);font-size:.67rem;font-weight:600;padding:2px 7px;border-radius:99px; }

.appt-timeline { display: flex; flex-direction: column; gap: 5px; }
.timeline-item {
  border-radius: var(--radius); padding: 10px 13px;
  border: 1px solid var(--gray-200); background: white;
  transition: all .15s; box-shadow: var(--shadow-sm);
}
.timeline-item:hover { box-shadow: var(--shadow); border-color: var(--gray-300); transform: translateX(2px); }
.timeline-item.status-confirmed { border-left: 3px solid var(--brand); }
.timeline-item.status-pending   { border-left: 3px solid var(--warning); }
.timeline-item.status-completed { border-left: 3px solid var(--success); }
.timeline-item.status-no_show   { border-left: 3px solid var(--gray-300); opacity: .75; }

.dr-appt-card {
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  background: white; box-shadow: var(--shadow-sm); transition: all .15s;
}
.dr-appt-card:hover { box-shadow: var(--shadow); transform: translateX(2px); }
.dr-appt-card.pending   { border-left: 3px solid var(--warning); }
.dr-appt-card.confirmed { border-left: 3px solid var(--brand); }
.dr-appt-card.completed { border-left: 3px solid var(--success); }
.dr-appt-card.no_show   { border-left: 3px solid var(--gray-300); opacity: .75; }

/* ════════════════════════════════════════
   PRESCRIPTIONS
════════════════════════════════════════ */
.rx-card {
  border: 1px solid var(--gray-200) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
}
.rx-icon { width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }

/* ════════════════════════════════════════
   SCHEDULE
════════════════════════════════════════ */
.schedule-day { border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 12px; background: white; }
.schedule-day.has-schedule { border-color: var(--brand); background: var(--brand-light); }

/* ════════════════════════════════════════
   VIDEO CALL
════════════════════════════════════════ */
.video-container { border-radius: var(--radius-xl); overflow: hidden; background: var(--gray-900); }

/* ════════════════════════════════════════
   PAGINATION
════════════════════════════════════════ */
.page-link {
  font-size: .8rem; padding: 5px 10px;
  border-radius: var(--radius-sm) !important;
  color: var(--gray-600); border-color: var(--gray-200);
}
.page-link:hover { background: var(--brand-light); color: var(--brand); border-color: var(--brand-light); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }

/* ════════════════════════════════════════
   UTILITIES
════════════════════════════════════════ */
.shadow-card { box-shadow: var(--shadow) !important; }
.rounded-card { border-radius: var(--radius-lg) !important; }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 768px) {
  body { font-size: .875rem; }
  .sidebar {
    position: fixed !important; top: 0; left: 0; z-index: 1045;
    transform: translateX(-100%); height: 100vh;
    width: 240px !important; min-width: 240px !important;
  }
  .sidebar.show { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-toggle { display: flex !important; }
  .flex-grow-1 { min-width: 0; }
  .page-header { padding: 14px 16px; }
  .page-header h3 { font-size: 1.1rem; }
  .card-body { padding: 14px !important; }
  .card-header { padding: 12px 14px !important; }
  .stat-value { font-size: 1.5rem; }
  .table { min-width: 580px; font-size: .8rem; }
  .row.g-4 { --bs-gutter-y: 12px; --bs-gutter-x: 12px; }
  .row.g-3 { --bs-gutter-y: 10px; --bs-gutter-x: 10px; }
  .btn { font-size: .8rem; }
  .modal-dialog { margin: 8px; }
}
@media (max-width: 480px) {
  body { font-size: .84rem; }
  .page-header h3 { font-size: 1rem; }
  .container-fluid { padding: 0 12px; }
}

/* ════════════════════════════════════════
   PRINT
════════════════════════════════════════ */
@media print {
  .navbar,.sidebar,.no-print,.btn,.sidebar-toggle,.sidebar-overlay { display: none !important; }
  .card { box-shadow: none !important; border: 1px solid var(--gray-200) !important; }
  body { background: white; color: black; }
}
