/* ==========================================================================
   MediBook — clinical/professional design system
   Palette, type, and layout chosen to read as trustworthy patient-portal
   software rather than a generic SaaS template.
   ========================================================================== */

:root {
  /* Color */
  --navy-900: #0B2E42;
  --navy-800: #0F3D5C;
  --navy-700: #164B71;
  --teal-600: #1C7A73;
  --teal-050: #E7F2F1;
  --amber-600: #B8862B;
  --amber-050: #FBF2E2;
  --brick-600: #B23A3A;
  --brick-050: #FBEAEA;
  --bg: #F5F7F8;
  --surface: #FFFFFF;
  --border: #DCE3E7;
  --text: #16232E;
  --text-muted: #5B6B79;
  --focus: #2E7DD1;

  /* Type */
  --font: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Radius (deliberately restrained, not one radius everywhere) */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font);
  font-weight: 600;
  color: var(--navy-900);
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h1 { font-size: 1.9rem; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

p { max-width: 68ch; }

a { color: var(--teal-600); }
a:hover { color: var(--navy-800); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Nav ---------------------------------------------------------------- */

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--navy-900);
  color: #fff;
  padding: 14px 32px;
}
.site-nav-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}
.site-nav-brand img {
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 2px;
}
.site-nav-links a {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.92rem;
  font-weight: 500;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.site-nav-links a:hover {
  color: #fff;
  border-bottom-color: rgba(255,255,255,0.5);
}
.site-nav-links span {
  margin-left: 20px;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
}

/* A single, deliberate motif: a thin EKG line under the nav.
   Appears once — not repeated as generic decoration elsewhere. */
.ekg-divider {
  height: 10px;
  background-color: var(--navy-800);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='20' viewBox='0 0 200 20'%3E%3Cpath d='M0 10 H70 L78 10 L84 2 L92 18 L98 4 L104 10 H200' fill='none' stroke='%231C7A73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: left center;
}

/* ---- Flash messages ------------------------------------------------------ */

.site-flash {
  padding: 12px 24px;
  font-weight: 500;
  font-size: 0.92rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.site-flash-success { background: var(--teal-050); color: var(--teal-600); }
.site-flash-error { background: var(--brick-050); color: var(--brick-600); }

/* ---- Layout --------------------------------------------------------------*/

.site-main {
  max-width: 1080px;
  margin: 32px auto;
  padding: 0 24px 48px;
}

.hero {
  text-align: center;
  padding: 48px 20px 8px;
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='120' viewBox='0 0 400 120'%3E%3Cpath d='M0 60 H140 L152 60 L164 20 L178 100 L190 40 L202 60 H400' fill='none' stroke='%230F3D5C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center 18px;
  background-size: 400px 120px;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 2.1rem; }
.hero p { margin: 0 auto; color: var(--text-muted); font-size: 1.05rem; }

/* ---- Auth page shells -----------------------------------------------------
   Each role gets a faint, tinted wash in one corner using the same EKG
   motif — enough to feel distinct without competing with the form. */

.auth-shell {
  position: relative;
  padding: 56px 20px;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.auth-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.06;
  background-repeat: no-repeat;
  background-position: right -40px top -20px;
  background-size: 480px;
}
.auth-shell > * { position: relative; z-index: 1; }

.auth-shell-patient::before {
  background-image: radial-gradient(circle at top right, var(--teal-600), transparent 60%);
}
.auth-shell-doctor::before {
  background-image: radial-gradient(circle at top right, var(--navy-800), transparent 60%);
}
.auth-shell-admin::before {
  background-image: radial-gradient(circle at top right, var(--amber-600), transparent 60%);
}

/* ---- Cards ---------------------------------------------------------------
   Every panel gets a thin navy top accent — a real patient-portal / EHR
   convention for marking "this is a clinical data panel," applied
   consistently rather than as one-off decoration. */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--navy-800);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 24px;
}

/* ---- Forms ---------------------------------------------------------------*/

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(46, 125, 209, 0.15);
  outline: none;
}
.form-group input[readonly] {
  background: var(--bg);
  color: var(--text-muted);
}

/* ---- Buttons ---------------------------------------------------------------
   Solid navy = primary action. Brick red reserved only for destructive
   actions (cancel/delete) — color carries meaning, not decoration. */

.btn {
  display: inline-block;
  background: var(--navy-800);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  font-family: var(--font);
  text-decoration: none;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--navy-700); color: #fff; }
.btn-danger { background: var(--brick-600); }
.btn-danger:hover { background: #942f2f; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* ---- Tabs ------------------------------------------------------------------*/

.tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tabs a {
  padding: 10px 18px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tabs a:hover { color: var(--navy-800); }
.tabs a.active { color: var(--navy-800); border-bottom-color: var(--navy-800); }

/* ---- Tables ------------------------------------------------------------------
   No zebra striping — calmer and more clinical. Clear row dividers instead. */

table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.9rem; }
table th, table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; }
table th {
  color: var(--navy-900);
  font-weight: 600;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
table tr:last-child td { border-bottom: none; }

/* ---- Status badges ----------------------------------------------------------
   Pill chips with a color dot — the same convention real scheduling
   software uses to mark appointment state at a glance. */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.badge-pending { background: var(--amber-050); color: var(--amber-600); }
.badge-pending::before { background: var(--amber-600); }
.badge-accepted { background: var(--teal-050); color: var(--teal-600); }
.badge-accepted::before { background: var(--teal-600); }
.badge-cancelled { background: var(--brick-050); color: var(--brick-600); }
.badge-cancelled::before { background: var(--brick-600); }

/* ---- Footer ------------------------------------------------------------------*/

.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

/* ---- Responsive ----------------------------------------------------------- */

@media (max-width: 640px) {
  .site-nav { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 20px; }
  .site-nav-links a, .site-nav-links span { margin-left: 0; margin-right: 16px; }
  .site-main { padding: 0 16px 32px; }
  .card { padding: 20px; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}
