/* ============================================================
   MediBook — Global Stylesheet
   ============================================================ */

:root {
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --green-100:#dcfce7;
  --green-800:#166534;
  --yellow-100:#fef9c3;
  --yellow-800:#854d0e;
  --red-100:  #fee2e2;
  --red-600:  #dc2626;
  --red-700:  #b91c1c;
  --red-800:  #991b1b;
  --white:    #ffffff;
  --radius:   0.5rem;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 1px 3px rgba(0,0,0,.10), 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; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px)  { .container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 0 2rem; } }

.page-wrapper { padding: 2rem 0; }

/* ── Navbar ── */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  display: flex;
  align-items: center;
  height: 4rem;
  gap: 1.5rem;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--blue-600);
  text-decoration: none;
}
.navbar-links { display: flex; gap: 1.5rem; flex: 1; }
.navbar-auth  { display: flex; align-items: center; gap: .75rem; }
.nav-link { font-size: .875rem; color: var(--gray-600); text-decoration: none; transition: color .15s; }
.nav-link:hover, .nav-link.active { color: var(--blue-600); text-decoration: none; }
.nav-greeting { font-size: .875rem; color: var(--gray-600); }

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem;
  margin-left: auto;
}
.nav-hamburger span { display: block; width: 22px; height: 2px; background: var(--gray-700); border-radius: 2px; }

.nav-mobile { display: none; flex-direction: column; gap: 1rem; padding: 1rem; border-top: 1px solid var(--gray-100); background: var(--white); }
.nav-mobile.open { display: flex; }
.nav-mobile-auth { display: flex; gap: .5rem; flex-wrap: wrap; }

@media (max-width: 767px) {
  .navbar-links, .navbar-auth { display: none; }
  .nav-hamburger { display: flex; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border-radius: var(--radius); font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm  { padding: .375rem .75rem; font-size: .8125rem; }
.btn-md  { padding: .5rem 1rem;    font-size: .875rem; }
.btn-lg  { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-primary { background: var(--blue-600); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); text-decoration: none; }
.btn-outline { background: var(--white); color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover:not(:disabled) { background: var(--gray-50); text-decoration: none; }
.btn-ghost  { background: transparent; color: var(--gray-700); }
.btn-ghost:hover:not(:disabled)  { background: var(--gray-100); text-decoration: none; }
.btn-danger { background: var(--red-600); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: var(--red-700); text-decoration: none; }
.btn-success { background: #16a34a; color: var(--white); }
.btn-success:hover:not(:disabled){ background: #15803d; text-decoration: none; }
.btn-full   { width: 100%; }
.btn-loading::before {
  content: '';
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: white;
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: .25rem; }
.form-label { font-size: .875rem; font-weight: 500; color: var(--gray-700); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: .5rem .75rem; font-size: .875rem;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  background: var(--white); color: var(--gray-900);
  transition: border-color .15s, box-shadow .15s; outline: none;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-input.error, .form-select.error, .form-textarea.error { border-color: var(--red-600); }
.form-error { font-size: .75rem; color: var(--red-600); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .5rem center; padding-right: 2rem; }

/* ── Cards ── */
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: .75rem; box-shadow: var(--shadow-sm); overflow: hidden; }
.card:hover { box-shadow: var(--shadow-md); transition: box-shadow .2s; }
.card-body   { padding: 1.25rem 1.5rem; }
.card-footer { padding: .875rem 1.5rem; border-top: 1px solid var(--gray-100); }
.card-header { padding: .875rem 1.5rem; border-bottom: 1px solid var(--gray-100); font-weight: 600; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: .2rem .625rem; border-radius: 9999px; font-size: .75rem; font-weight: 500; }
.badge-info    { background: var(--blue-100);   color: var(--blue-700); }
.badge-success { background: var(--green-100);  color: var(--green-800); }
.badge-warning { background: var(--yellow-100); color: var(--yellow-800); }
.badge-danger  { background: var(--red-100);    color: var(--red-800); }
.badge-default { background: var(--gray-100);   color: var(--gray-700); }

/* ── Grid ── */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(1, 1fr); }
.grid-3 { grid-template-columns: repeat(1, 1fr); }
.grid-4 { grid-template-columns: repeat(1, 1fr); }
@media (min-width: 640px)  { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* ── Hero ── */
.hero { background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-700) 100%); color: var(--white); padding: 5rem 0; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 800; line-height: 1.15; margin-bottom: 1rem; }
.hero p  { font-size: clamp(1rem, 2.5vw, 1.2rem); opacity: .9; max-width: 600px; margin: 0 auto 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── Section ── */
.section { padding: 4rem 0; }
.section-title { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; }
.section-subtitle { color: var(--gray-500); margin-bottom: 2.5rem; }

/* ── Alerts ── */
.alert { padding: .875rem 1rem; border-radius: var(--radius); font-size: .875rem; margin-bottom: 1rem; }
.alert-error   { background: var(--red-100);    color: var(--red-800);   border: 1px solid #fca5a5; }
.alert-success { background: var(--green-100);  color: var(--green-800); border: 1px solid #86efac; }
.alert-info    { background: var(--blue-100);   color: var(--blue-700);  border: 1px solid #93c5fd; }

/* ── Auth Page ── */
.auth-page { min-height: calc(100vh - 4rem); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: 1rem; box-shadow: var(--shadow-md); padding: 2.5rem; width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.625rem; font-weight: 700; margin-bottom: .25rem; }
.auth-card p  { color: var(--gray-500); font-size: .875rem; margin-bottom: 1.75rem; }
.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .875rem; color: var(--gray-500); }

/* ── Filter Bar ── */
.filter-bar { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.75rem; align-items: flex-end; }
.filter-bar .form-group { min-width: 180px; flex: 1; }
.filter-bar .form-group.search { flex: 2; min-width: 200px; }

/* ── Slot Picker ── */
.slot-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.slot-btn {
  padding: .35rem .75rem; font-size: .8125rem; border-radius: var(--radius);
  border: 1px solid var(--gray-300); background: var(--white); cursor: pointer;
  transition: background .15s, border-color .15s; color: var(--gray-700);
}
.slot-btn:hover    { border-color: var(--blue-500); background: var(--blue-50); }
.slot-btn.selected { background: var(--blue-600); color: var(--white); border-color: var(--blue-600); }

/* ── AI Chat ── */
.ai-section { background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%); border-radius: 1rem; padding: 2rem; }
.ai-chat { max-width: 700px; margin: 0 auto; }
.ai-chat h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: .25rem; color: var(--gray-900); }
.ai-chat p { color: var(--gray-500); font-size: .9rem; margin-bottom: 1.25rem; }
.ai-input-row { display: flex; gap: .75rem; }
.ai-input-row textarea { flex: 1; border-radius: var(--radius); border: 1px solid var(--gray-300); padding: .75rem; font-size: .9rem; font-family: inherit; resize: none; height: 72px; outline: none; }
.ai-input-row textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.ai-result { margin-top: 1.25rem; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem; display: none; }
.ai-result.visible { display: block; }
.ai-result p { color: var(--gray-700); font-size: .9rem; line-height: 1.7; white-space: pre-wrap; }
.ai-specialty { margin-top: 1rem; padding: .75rem 1rem; background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: var(--radius); display: flex; align-items: center; justify-content: space-between; flex-wrap: gap; gap: .75rem; }
.ai-specialty span { font-size: .875rem; font-weight: 500; color: var(--blue-700); }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: .75rem; padding: 1.5rem; text-align: center; }
.stat-number { font-size: 2rem; font-weight: 800; color: var(--blue-600); line-height: 1; }
.stat-label  { font-size: .875rem; color: var(--gray-500); margin-top: .25rem; }

/* ── Dashboard ── */
.dashboard-header { margin-bottom: 2rem; }
.dashboard-header h1 { font-size: 1.75rem; font-weight: 700; }
.dashboard-header p  { color: var(--gray-500); }

.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--gray-200); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab-btn { padding: .625rem 1.25rem; font-size: .875rem; font-weight: 500; color: var(--gray-500); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: color .15s; }
.tab-btn.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }
.tab-btn:hover:not(.active) { color: var(--gray-700); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Loading / Empty states ── */
.skeleton { background: var(--gray-200); border-radius: var(--radius); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--gray-400); }
.empty-state svg { margin: 0 auto 1rem; }
.empty-state p { font-size: .9375rem; }

/* ── Doctor Profile Page ── */
.doctor-hero { background: var(--white); border-bottom: 1px solid var(--gray-200); padding: 2rem 0; }
.doctor-hero-inner { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.doctor-avatar { width: 80px; height: 80px; background: var(--blue-50); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doctor-avatar svg { color: var(--blue-600); }
.doctor-info h1 { font-size: 1.5rem; font-weight: 700; }
.doctor-info p { color: var(--gray-500); font-size: .9rem; margin-top: .25rem; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: var(--white); border-radius: 1rem; padding: 1.5rem; width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; flex-wrap: wrap; }

/* ── Footer ── */
footer { background: var(--gray-900); color: var(--gray-400); text-align: center; padding: 1.5rem; font-size: .875rem; margin-top: auto; }
footer a { color: var(--gray-400); }

/* ── Utilities ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: .875rem; }
.text-gray { color: var(--gray-500); }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
