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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 32px rgba(0,0,0,.10);
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 16px; }
.section { padding: 32px 0 64px; }

/* ===== Header ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 60px; flex-wrap: wrap;
}
.logo { font-size: 1.35rem; font-weight: 700; color: var(--primary); }
.logo span { color: var(--text); }

.hamburger {
  display: flex; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px;
}
.hamburger span { width: 24px; height: 2px; background: var(--text); transition: transform .3s, opacity .3s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.main-nav { display: none; width: 100%; flex-direction: column; gap: 4px; padding: 12px 0 16px; }
.main-nav.open { display: flex; }
.main-nav > a { padding: 10px 4px; font-weight: 500; border-bottom: 1px solid var(--border); }
.nav-auth { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }

.dropdown { position: relative; }
.dropdown-toggle { width: 100%; }
.dropdown-menu {
  display: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px 0;
}
.dropdown-menu a { display: block; padding: 10px 16px; font-size: .95rem; }
.dropdown-menu a:hover { background: var(--bg); color: var(--primary); }
.dropdown.open .dropdown-menu { display: block; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: 8px; font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; cursor: pointer; transition: background .2s, border-color .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ===== Hero ===== */
.hero { background: linear-gradient(135deg, #dbeafe, #ede9fe); padding: 48px 0 40px; text-align: center; }
.hero h1 { font-size: 1.9rem; }
.hero h1 span { color: var(--primary); }
.hero p { color: var(--text-muted); margin: 10px 0 24px; }
.search-bar {
  width: 100%; max-width: 560px; padding: 14px 18px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 1rem; box-shadow: var(--shadow);
}
.search-bar:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

/* ===== Filters & Doctor Grid ===== */
.filter-row {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 12px; margin-bottom: 20px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: .88rem; cursor: pointer; transition: all .2s;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.doctor-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.doctor-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.doctor-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.doctor-card-head { display: flex; gap: 14px; align-items: center; }
.doctor-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0; background: var(--border);
}
.doctor-card h3 { font-size: 1.05rem; }
.doctor-card .spec { color: var(--primary); font-size: .9rem; font-weight: 500; }
.doctor-card .meta { font-size: .85rem; color: var(--text-muted); }
.doctor-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 12px;
  border-top: 1px solid var(--border); flex-wrap: wrap; gap: 8px;
}
.fee { font-weight: 700; }
.badge-verified {
  font-size: .72rem; background: #dcfce7; color: #16a34a;
  padding: 3px 8px; border-radius: 999px; font-weight: 600;
  display: inline-block; text-transform: capitalize;
}

.skeleton-card {
  height: 160px; border-radius: var(--radius);
  background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 50%, #eef2f7 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px 0; }

/* ===== Footer ===== */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 24px 0; }
.footer-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; font-size: .9rem; color: var(--text-muted);
}
.footer-inner nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.footer-inner a:hover { color: var(--primary); }

/* ===== Dashboard ===== */
.dash-layout { display: grid; grid-template-columns: 1fr; min-height: calc(100vh - 60px); }
.dash-sidebar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 16px; display: none;
}
.dash-sidebar.open { display: block; }
.dash-sidebar a { display: block; padding: 10px 14px; border-radius: 8px; font-weight: 500; cursor: pointer; }
.dash-sidebar a.active { background: var(--primary); color: #fff; }
.dash-main { padding: 20px 16px 48px; }
.dash-main h1 { margin-bottom: 20px; }
.dash-main h2 { margin: 24px 0 12px; font-size: 1.15rem; }

.dash-fab {
  position: fixed; bottom: 16px; right: 16px; z-index: 200;
  background: var(--primary); border: none; border-radius: 50%;
  width: 52px; height: 52px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
}
.dash-fab span { width: 20px; height: 2px; background: #fff; }

/* ===== Stats ===== */
.stats-row { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.stat-card h4 { font-size: .85rem; color: var(--text-muted); font-weight: 500; }
.stat-card .num { font-size: 1.6rem; font-weight: 700; }

/* ===== Tables ===== */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 12px 16px; text-align: left; font-size: .9rem; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; }
tbody tr:hover { background: var(--bg); }

/* ===== Auth & Forms ===== */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(135deg, #e0f2fe, #ede9fe);
}
.auth-card {
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 32px 24px; width: 100%; max-width: 460px;
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.subtitle { color: var(--text-muted); margin-bottom: 24px; font-size: .95rem; }
form { display: flex; flex-direction: column; gap: 14px; }
input, select, textarea {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 1rem; width: 100%; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
label { font-size: .9rem; font-weight: 500; }

.checkbox-label { display: flex; gap: 8px; font-size: .85rem; color: var(--text-muted); align-items: flex-start; }
.checkbox-label input { width: auto; margin-top: 3px; }
.checkbox-label a { color: var(--primary); }

.note { font-size: .82rem; color: #b45309; background: #fef3c7; padding: 10px; border-radius: 8px; margin: 16px 0; }
.message { font-size: .9rem; min-height: 20px; }
.message.error { color: #dc2626; }
.message.success { color: #16a34a; }
.switch-link { margin-top: 12px; font-size: .9rem; color: var(--text-muted); }
.switch-link a { color: var(--primary); font-weight: 500; }

/* ===== Legal pages ===== */
.legal h2 { margin: 24px 0 8px; font-size: 1.15rem; }
.legal p, .legal li { color: var(--text-muted); font-size: .95rem; margin-bottom: 8px; }
.legal ul { padding-left: 20px; }

/* ===== reCAPTCHA ===== */
#recaptcha-container { margin-top: 12px; }

/* ===== Tablet ≥640px ===== */
@media (min-width: 640px) {
  .container { padding-inline: 24px; }
  .hero h1 { font-size: 2.4rem; }
  .doctor-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; }
  .auth-card { padding: 40px; }
}

/* ===== Desktop ≥900px ===== */
@media (min-width: 900px) {
  .hamburger { display: none; }
  .dash-fab { display: none; }
  .main-nav { display: flex !important; flex-direction: row; align-items: center; width: auto; gap: 20px; padding: 0; }
  .main-nav > a { border-bottom: none; padding: 0; }
  .nav-auth { flex-direction: row; align-items: center; padding-top: 0; }
  .dropdown-toggle { width: auto; }
  .dropdown-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px; z-index: 50; }
  .dropdown:hover .dropdown-menu, .dropdown.open .dropdown-menu { display: block; }
  .doctor-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-layout { grid-template-columns: 240px 1fr; }
  .dash-sidebar { display: block; border-bottom: none; border-right: 1px solid var(--border); padding: 20px 12px; }
  .dash-main { padding: 32px 32px 64px; }
  .stats-row { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1200px) { .doctor-grid { grid-template-columns: repeat(4, 1fr); } }

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