/* ===== MediSlot — mobile-first ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(15, 23, 42, .07);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.55; }
img { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
.container { width: min(1100px, 100% - 32px); margin-inline: auto; }
.section { padding: 32px 0 56px; }

/* ===== Header / Nav ===== */
.site-header { background: var(--surface); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.logo { font-size: 1.35rem; font-weight: 800; color: var(--text); }
.logo span { color: var(--primary); }
.hamburger { display: inline-flex; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; margin-left: auto; }
.hamburger span { width: 24px; height: 2.5px; background: var(--text); border-radius: 2px; transition: .25s; }
.hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
.main-nav { display: none; }
.main-nav.open { display: flex; flex-direction: column; gap: 10px; position: absolute; top: 60px; right: 16px; left: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.main-nav > a { padding: 8px 4px; font-weight: 600; color: var(--text); }
.nav-auth-group { display: flex; flex-direction: column; gap: 8px; width: 100%; }
/* The hidden attribute must win over desktop nav display rules. */
.nav-auth-group[hidden] { display: none !important; }
.nav-username { font-weight: 700; }

/* dropdowns (guest) */
.dropdown { position: relative; }
.dropdown-toggle { width: 100%; }
.dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; min-width: 180px; padding: 6px; box-shadow: var(--shadow); z-index: 60; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.dropdown-menu a:hover { background: var(--bg); }

/* ===== Buttons / forms ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 10px; border: 1.5px solid transparent; font-size: .95rem; font-weight: 600; cursor: pointer; transition: .15s; text-align: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: rgba(37, 99, 235, .08); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-dark); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

input, select, textarea { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; font: inherit; background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37, 99, 235, .35); border-color: var(--primary); }
label { display: block; margin-bottom: 14px; font-size: .88rem; font-weight: 600; }
label input, label select, label textarea { margin-top: 6px; font-weight: 400; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 0; }
.phone-group { display: flex; align-items: stretch; margin-top: 6px; }
.phone-prefix { display: inline-flex; align-items: center; padding: 0 12px; border: 1.5px solid var(--border); border-right: 0; border-radius: 10px 0 0 10px; background: var(--bg); font-weight: 700; }
.phone-group input { border-radius: 0 10px 10px 0; margin-top: 0; }
.pw-group { display: flex; margin-top: 6px; }
.pw-group input { margin-top: 0; border-radius: 10px 0 0 10px; }
.pw-toggle { border: 1.5px solid var(--border); border-left: 0; border-radius: 0 10px 10px 0; background: var(--bg); padding: 0 14px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.message { min-height: 20px; font-size: .88rem; font-weight: 600; margin-top: 10px; }
.message.error { color: var(--danger); }
.message.success { color: #15803d; }

/* ===== Hero / search / chips ===== */
.hero { background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; padding: 56px 0 64px; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.6rem); }
.hero h1 span { color: #bfdbfe; }
.hero p { margin: 10px 0 22px; opacity: .92; }
.search-bar { max-width: 520px; margin-inline: auto; padding: 14px 18px; border-radius: 999px; border: 0; font-size: 1rem; box-shadow: var(--shadow); }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; }
.chip { flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); font-weight: 600; font-size: .85rem; cursor: pointer; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== Doctor cards ===== */
.doctor-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.doctor-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.doctor-card-head { display: flex; gap: 14px; align-items: center; }
.doctor-avatar, .dash-user img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--bg); }
.doctor-card h3 { font-size: 1.05rem; }
.doctor-card .spec { color: var(--primary); font-weight: 600; font-size: .88rem; }
.doctor-card .meta { color: var(--text-muted); font-size: .82rem; }
.doctor-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.fee { font-weight: 700; }
.fee small { color: var(--text-muted); font-weight: 400; }
.skeleton-card { height: 160px; border-radius: var(--radius); background: linear-gradient(90deg, #e8edf5 25%, #f4f7fb 50%, #e8edf5 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px 0; }

/* ===== Auth pages ===== */
.auth-body { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; padding: 32px 16px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; width: 100%; max-width: 440px; }
.auth-card-wide { max-width: 560px; }
.auth-card h1 { font-size: 1.3rem; margin-bottom: 4px; }
.auth-sub { color: var(--text-muted); font-size: .88rem; margin-bottom: 18px; }
.auth-alt { margin-top: 16px; font-size: .88rem; color: var(--text-muted); }
#recaptcha-container { margin: 10px 0; display: flex; justify-content: center; }

/* ===== Dashboard ===== */
.dash-topbar { display: flex; align-items: center; justify-content: space-between; background: var(--surface); padding: 10px 16px; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 50; }
.dash-layout { display: block; }
.dash-sidebar { display: none; }
.dash-sidebar.open { display: flex; flex-direction: column; gap: 14px; position: absolute; top: 56px; right: 12px; left: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); z-index: 40; }
.dash-user { display: flex; gap: 12px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.dash-user small { display: block; color: var(--text-muted); text-transform: capitalize; }
.dash-nav { display: flex; flex-direction: column; gap: 4px; }
.dash-nav button { text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; color: var(--text); }
.dash-nav button.active { background: rgba(37, 99, 235, .1); color: var(--primary); }
.dash-main { padding: 20px 16px 60px; }
.dash-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: top; }
th { background: var(--bg); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warn { background: #fef9c3; color: #a16207; }
.badge.bad { background: #fee2e2; color: var(--danger); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== Modern appointment cards ===== */
.appt-list { display: grid; gap: 14px; margin-top: 16px; }
.appt-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--primary); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
}
.appt-card.st-confirmed { border-left-color: #16a34a; }
.appt-card.st-pending_payment { border-left-color: #d97706; }
.appt-card.st-cancelled { border-left-color: var(--danger); opacity: .75; }
.appt-card.st-completed { border-left-color: #64748b; opacity: .85; }
.appt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.appt-head strong { font-size: 1.02rem; }
.appt-sub { display: block; color: var(--text-muted); font-size: .82rem; }
.appt-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; font-size: .88rem; color: var(--text); }
.appt-pay { margin-top: 8px; font-size: .85rem; color: var(--text-muted); }
.appt-utr { margin-left: 10px; font-family: monospace; background: var(--bg); padding: 2px 8px; border-radius: 6px; }
.appt-card .row-actions { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
button:disabled, .btn:disabled { opacity: .55; cursor: wait; }

/* ===== Footer / legal ===== */
.site-footer { background: #0f172a; color: #cbd5e1; padding: 28px 0; margin-top: auto; }
.footer-inner { display: flex; flex-direction: column; gap: 12px; text-align: center; font-size: .88rem; }
.footer-inner nav { display: flex; gap: 18px; justify-content: center; }
.footer-inner a { color: #93c5fd; }
.legal-page { max-width: 760px; }
.legal-page h2 { margin: 22px 0 8px; font-size: 1.1rem; }
.legal-page p { margin-bottom: 10px; color: #334155; }

/* ===== ≥ 640px ===== */
@media (min-width: 640px) {
  .form-row { grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .doctor-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; }
}

/* ===== ≥ 900px ===== */
@media (min-width: 900px) {
  .hamburger { display: none; }
  .main-nav { display: flex !important; align-items: center; gap: 22px; position: static; box-shadow: none; border: 0; padding: 0; background: none; }
  .nav-auth, .nav-auth-group { display: flex !important; flex-direction: row; align-items: center; gap: 10px; width: auto; }
  .dropdown:hover .dropdown-menu, .dropdown.open .dropdown-menu { display: block; }
  .hero { padding: 80px 0 90px; }
  .doctor-grid { grid-template-columns: repeat(3, 1fr); }

  /* dashboard: sidebar layout */
  .dash-topbar { display: none; }
  .dash-layout { display: flex; min-height: 100vh; }
  .dash-sidebar { display: flex !important; flex-direction: column; gap: 16px; position: static; width: 250px; background: var(--surface); border-right: 1px solid var(--border); padding: 24px 16px; box-shadow: none; border-radius: 0; }
  .dash-sidebar .btn { width: 100%; }
  .dash-main { flex: 1; padding: 32px 36px; }
}

/* ===== Mobile-only fixed bottom navigation (home + dashboard) ===== */
.mobile-bottom-nav { display:none; }
@media (max-width: 899px) {
  body:not([data-page="dashboard"]) { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .mobile-bottom-nav {
    position:fixed; left:0; right:0; bottom:0; z-index:1000;
    display:grid; grid-template-columns:repeat(5,minmax(0,1fr));
    min-height:64px; padding:7px 5px calc(7px + env(safe-area-inset-bottom));
    background:#fff; border-top:1px solid #e2e8f0;
    box-shadow:0 -3px 14px rgba(15,23,42,.08);
  }
  .mobile-bottom-nav a, .mobile-bottom-nav button {
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    gap:3px; min-width:0; border:0; background:transparent; color:#64748b;
    font:inherit; font-size:11px; line-height:1.2; text-decoration:none;
    cursor:pointer; -webkit-tap-highlight-color:transparent;
  }
  .mobile-bottom-nav .mobile-nav-icon { display:flex; align-items:center; justify-content:center; width:24px; height:24px; line-height:1; }
  .mobile-bottom-nav .mobile-nav-icon svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
  .mobile-bottom-nav a.active, .mobile-bottom-nav a:active, .mobile-bottom-nav button:active { color:var(--primary); }
}

/* Active dashboard bottom-nav destination (including button-based tabs). */
@media (max-width: 899px) {
  body[data-page="dashboard"] { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .mobile-bottom-nav a.active,
  .mobile-bottom-nav button.active {
    color: var(--primary);
    font-weight: 700;
  }
  .mobile-bottom-nav a.active .mobile-nav-icon svg,
  .mobile-bottom-nav button.active .mobile-nav-icon svg {
    stroke-width: 2.25;
  }
}


/* ===== Help and offers pages ===== */
.info-page { padding-bottom: 78px; }
.info-content { max-width: 980px; }
.info-hero { text-align: center; padding: 20px 0 30px; }
.info-hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.15; margin: 8px 0 12px; }
.info-hero > p:last-child { color: var(--text-muted); max-width: 620px; margin: 0 auto; }
.eyebrow { color: var(--primary); font-size: .76rem; font-weight: 800; letter-spacing: .12em; }
.faq-list { max-width: 780px; margin: 0 auto 28px; }
.faq-list h2 { margin-bottom: 12px; font-size: 1.35rem; }
.faq-list details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin: 9px 0; padding: 15px 17px; box-shadow: var(--shadow); }
.faq-list summary { cursor: pointer; font-weight: 700; }
.faq-list details p { margin-top: 10px; color: var(--text-muted); }
.contact-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; background: #eaf1ff; border: 1px solid #cddcff; border-radius: 16px; padding: 22px; }
.contact-panel h2 { margin: 5px 0; }
.contact-panel p:not(.eyebrow) { color: #475569; max-width: 600px; }
.email-note,.offer-disclaimer { color: var(--text-muted); font-size: .82rem; margin-top: 12px; }
.offer-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.offer-card { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.offer-card img { display: block; width: 100%; height: 190px; object-fit: cover; background: #dbeafe; }
.offer-copy { padding: 18px; }
.offer-copy h2 { font-size: 1.2rem; margin: 8px 0; }
.offer-copy p { color: var(--text-muted); margin-bottom: 14px; }
.offer-tag { color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .09em; }
.text-link { font-weight: 700; }
.dash-extra-links { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.dash-extra-links a { padding: 8px 12px; border-radius: 8px; font-weight: 600; color: var(--text); }
.dash-extra-links a:hover { background: var(--bg); color: var(--primary); }
@media (max-width: 899px) { .offer-card img { height: 175px; } }
@media (min-width: 640px) { .offer-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .offer-card:first-child { grid-column: span 2; display: grid; grid-template-columns: 1.1fr 1fr; } .offer-card:first-child img { height: 100%; min-height: 240px; } }
@media (min-width: 900px) { .info-page { padding-bottom: 0; } .offer-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } .offer-card:first-child { grid-column: auto; display: block; } .offer-card:first-child img { height: 190px; min-height: 0; } }
