/* VaxBook - Main Stylesheet */

:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --primary-light: #EEF2FF;
  --success: #16A34A;
  --success-light: #DCFCE7;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --info: #0891B2;
  --info-light: #E0F2FE;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --white: #FFFFFF;
  --sidebar-w: 240px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  color: var(--gray-700);
  background: var(--gray-50);
  line-height: 1.5;
}

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  color: #D1D5DB;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid #374151;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo span { color: #818CF8; }

.sidebar-section-title {
  padding: 16px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6B7280;
}

.sidebar-nav { list-style: none; padding: 4px 8px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: #D1D5DB;
  text-decoration: none;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #374151;
  color: #fff;
}

.sidebar-nav a.active { background: var(--primary); color: #fff; }

.sidebar-nav .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .8;
}

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

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 15px; font-weight: 600; color: var(--gray-900); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--gray-500);
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.page-body { padding: 24px; flex: 1; }

/* ── Cards ── */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.card-title { font-size: 15px; font-weight: 600; color: var(--gray-900); }

.card-body { padding: 20px; }

/* ── Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; text-transform: uppercase; letter-spacing:.04em; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.stat-change { font-size: 12px; color: var(--success); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }

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

thead th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* ── Forms ── */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 5px; }

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=date],
input[type=time],
input[type=tel],
select,
textarea {
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-info     { background: var(--info); color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-50); }
.btn-sm       { padding: 5px 10px; font-size: 12.5px; }
.btn-xs       { padding: 3px 8px; font-size: 12px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success  { background: var(--success-light); color: #15803D; }
.badge-danger   { background: var(--danger-light); color: #B91C1C; }
.badge-warning  { background: var(--warning-light); color: #92400E; }
.badge-info     { background: var(--info-light); color: #075985; }
.badge-gray     { background: var(--gray-100); color: var(--gray-700); }
.badge-primary  { background: var(--primary-light); color: var(--primary-dark); }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 16px;
  border-left: 4px solid;
}

.alert-success { background: var(--success-light); border-color: var(--success); color: #15803D; }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: #B91C1C; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #92400E; }
.alert-info    { background: var(--info-light);    border-color: var(--info);    color: #075985; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 20px 25px rgba(0,0,0,.15);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title { font-size: 15px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray-500);
  padding: 4px;
  line-height: 1;
}

.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--gray-200); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Timeline / Progress ── */
.timeline { position: relative; }

.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  z-index: 1;
}

.dot-done    { background: var(--success-light); color: var(--success); border: 2px solid var(--success); }
.dot-pending { background: var(--gray-100); color: var(--gray-500); border: 2px solid var(--gray-300); }
.dot-current { background: var(--primary-light); color: var(--primary); border: 2px solid var(--primary); }

.timeline-content { flex: 1; }

/* ── Misc ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h1 { font-size: 20px; font-weight: 700; color: var(--gray-900); }

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.search-bar input { max-width: 280px; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-500);
}

.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }

.text-muted { color: var(--gray-500); }
.text-sm    { font-size: 12px; }
.fw-600     { font-weight: 600; }
.mt-4       { margin-top: 16px; }
.mb-4       { margin-bottom: 16px; }
.d-flex     { display: flex; }
.gap-2      { gap: 8px; }
.align-center { align-items: center; }

/* ── Login Page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4F46E5 0%, #0891B2 100%);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px rgba(0,0,0,.2);
}

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

.login-logo h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.login-logo p { color: var(--gray-500); font-size: 13px; margin-top: 4px; }

/* ── Vaccination Card View ── */
.vac-card {
  border: 2px solid var(--primary);
  border-radius: 12px;
  overflow: hidden;
}

.vac-card-header {
  background: var(--primary);
  color: #fff;
  padding: 16px 20px;
}

.vac-card-header h3 { font-size: 16px; margin-bottom: 2px; }
.vac-card-header p  { font-size: 12px; opacity: .8; }

.vac-card-body { padding: 0; }

.dose-row {
  display: grid;
  grid-template-columns: 200px 1fr 1fr 1fr;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13px;
}

.dose-row:last-child { border-bottom: none; }

.dose-row > div {
  padding: 10px 14px;
  border-right: 1px solid var(--gray-200);
}

.dose-row > div:last-child { border-right: none; }

.dose-row-header > div {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 12px;
  color: var(--gray-500);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dose-row { grid-template-columns: 1fr 1fr; }
}

/* Print */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .page-body { padding: 0; }
}
