/* ── DESIGN TOKENS ──────────────────────────────────────────────── */
:root {
  --sage:       #4a7c6f;
  --sage-light: #6b9e91;
  --sage-pale:  #edf4f2;
  --sage-deep:  #2d5a4f;
  --ink:        #1a1e1b;
  --ink-mid:    #3d4540;
  --ink-mute:   #6b736e;
  --ink-faint:  #a0a8a3;
  --surface:    #f7f9f8;
  --surface-2:  #eef2f0;
  --white:      #ffffff;
  --border:     #d8e2de;
  --error:      #b83232;
  --success:    #27ae60;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px;
  --sh-sm: 0 1px 4px rgba(26,30,27,.07);
  --sh-md: 0 4px 18px rgba(26,30,27,.10);
  --sh-lg: 0 12px 40px rgba(26,30,27,.14);
  --font-d: 'DM Serif Display', Georgia, serif;
  --font-b: 'DM Sans', system-ui, sans-serif;
  --tr: .16s ease;
}

/* ── RESET ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-b); background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.6; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-b); cursor: pointer; }

/* ── NAV ────────────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; height: 60px;
  background: rgba(247,249,248,.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; z-index: 1000;
}
.nav-logo { display: flex; align-items: center; gap: 9px; font-family: var(--font-d); font-size: 1.18rem; color: var(--ink); }
.logo-mark { width: 24px; height: 24px; background: var(--sage); border-radius: 50%; position: relative; flex-shrink: 0; }
.logo-mark::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 8px; height: 8px; background: #fff; border-radius: 50%; }
.nav-links { display: flex; align-items: center; gap: 2px; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-actions { display: flex; align-items: center; gap: 8px; }

/* ── BUTTONS ────────────────────────────────────────────────────── */
.btn { border: none; border-radius: var(--r-md); padding: 9px 20px; font-size: .88rem; font-weight: 500; transition: all var(--tr); display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--sage); color: #fff; }
.btn-primary:hover { background: var(--sage-deep); }
.btn-outline { background: transparent; color: var(--sage); border: 1.5px solid var(--sage); }
.btn-outline:hover { background: var(--sage-pale); }
.btn-ghost { background: transparent; color: var(--ink-mid); border: none; padding: 8px 13px; font-size: .86rem; border-radius: var(--r-md); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { padding: 13px 30px; font-size: .98rem; border-radius: var(--r-lg); }
.btn-sm { padding: 7px 14px; font-size: .82rem; }
.btn-full { width: 100%; padding: 12px; }

/* ── VIEWS ──────────────────────────────────────────────────────── */
.view { display: none; padding-top: 60px; min-height: 100vh; animation: fadeIn .2s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ── HOME ───────────────────────────────────────────────────────── */
.hero { max-width: 660px; margin: 0 auto; padding: 88px 28px 64px; text-align: center; }
.hero-eyebrow { font-size: .72rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--sage); margin-bottom: 16px; }
.hero-title { font-family: var(--font-d); font-size: clamp(2.4rem, 5.5vw, 4rem); line-height: 1.07; letter-spacing: -.02em; margin-bottom: 20px; }
.hero-title em { font-style: italic; color: var(--sage); }
.hero-sub { font-size: 1.06rem; color: var(--ink-mute); max-width: 480px; margin: 0 auto 32px; line-height: 1.72; font-weight: 300; }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.how { background: var(--white); border-top: 1px solid var(--border); padding: 64px 28px; }
.section-title { font-family: var(--font-d); font-size: 1.8rem; text-align: center; margin-bottom: 40px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 24px; max-width: 820px; margin: 0 auto; }
.step-card { padding: 26px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.step-num { font-family: var(--font-d); font-size: 2rem; color: var(--sage-pale); -webkit-text-stroke: 1.5px var(--sage-light); margin-bottom: 10px; line-height: 1; }
.step-card h3 { font-size: .94rem; font-weight: 600; margin-bottom: 6px; }
.step-card p { font-size: .85rem; color: var(--ink-mute); }

/* ── BROWSE ─────────────────────────────────────────────────────── */
.browse-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 60px); }

/* Filters */
.filters-panel { background: var(--white); border-right: 1px solid var(--border); padding: 24px 18px; overflow-y: auto; position: sticky; top: 60px; height: calc(100vh - 60px); }
.filters-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.filters-header h2 { font-size: .94rem; font-weight: 600; }
.fg { margin-bottom: 18px; }
.fl { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 7px; }
.fi, .fs { width: 100%; padding: 8px 11px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); font-family: var(--font-b); font-size: .86rem; color: var(--ink); outline: none; transition: border-color var(--tr); }
.fi:focus, .fs:focus { border-color: var(--sage); }

/* Results */
.results-panel { padding: 24px 28px; }
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.results-count { font-size: .82rem; color: var(--ink-mute); }
#filters-toggle { display: none; }

/* Therapist list */
.therapist-list { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }

/* Card */
.tcard { padding: 22px 24px; border-bottom: 1px solid var(--surface-2); }
.tcard:last-child { border-bottom: none; }
.tcard-top { display: flex; align-items: center; gap: 13px; margin-bottom: 10px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--sage-pale); color: var(--sage-deep); display: flex; align-items: center; justify-content: center; font-size: .76rem; font-weight: 600; flex-shrink: 0; border: 1.5px solid var(--border); }
.tcard-name { font-size: .96rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.tcard-spec { font-size: .81rem; color: var(--ink-mute); margin-top: 1px; }
.tcard-about { font-size: .85rem; color: var(--ink-mid); line-height: 1.62; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcard-actions { display: flex; gap: 8px; }

/* ── BOOKINGS ───────────────────────────────────────────────────── */
.bookings-wrap { max-width: 620px; margin: 0 auto; padding: 44px 28px; }
.bookings-wrap h1 { font-family: var(--font-d); font-size: 1.8rem; margin-bottom: 6px; }
.bookings-note { font-size: .82rem; color: var(--ink-mute); margin-bottom: 28px; }
.booking-item { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 22px; margin-bottom: 10px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.booking-info { flex: 1; }
.booking-name { font-weight: 600; font-size: .94rem; margin-bottom: 3px; }
.booking-when { font-size: .81rem; color: var(--ink-mute); }
.booking-status { padding: 3px 11px; background: #e6f4ec; color: var(--success); border-radius: 20px; font-size: .74rem; font-weight: 600; }
.empty-state { text-align: center; padding: 60px 0; color: var(--ink-mute); }
.empty-state p { margin-bottom: 14px; }

/* ── CHAT ───────────────────────────────────────────────────────── */
#view-chat .chat-layout { display: flex; flex-direction: column; height: calc(100vh - 60px); }
.chat-head { display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: var(--white); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-head-info { font-weight: 500; flex: 1; font-size: .92rem; }
.chat-head-info small { display: block; font-size: .75rem; color: var(--ink-mute); font-weight: 400; }
.privacy-badge { font-size: .73rem; color: var(--sage); background: var(--sage-pale); padding: 3px 10px; border-radius: 20px; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.chat-foot { padding: 14px 18px; background: var(--white); border-top: 1px solid var(--border); display: flex; gap: 9px; }
.chat-input { flex: 1; padding: 10px 16px; border: 1px solid var(--border); border-radius: 24px; font-family: var(--font-b); font-size: .88rem; outline: none; background: var(--surface); transition: border-color var(--tr); }
.chat-input:focus { border-color: var(--sage); }
.chat-msg-wrap { display: flex; flex-direction: column; }
.chat-msg-wrap.mine { align-items: flex-end; }
.chat-msg-wrap.theirs { align-items: flex-start; }
.chat-bubble { max-width: 70%; padding: 10px 15px; font-size: .88rem; line-height: 1.5; border-radius: 18px; }
.mine .chat-bubble { background: var(--sage); color: #fff; border-bottom-right-radius: 4px; }
.theirs .chat-bubble { background: var(--white); color: var(--ink); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-time { font-size: .7rem; color: var(--ink-faint); margin-top: 3px; }
.chat-center { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 14px; text-align: center; padding: 30px; color: var(--ink-mute); }
.chat-center h3 { font-size: 1rem; color: var(--ink); }
.chat-center code { display: block; background: var(--surface-2); padding: 11px 15px; border-radius: var(--r-sm); font-size: .82rem; border: 1px solid var(--border); text-align: left; margin: 8px 0; word-break: break-all; }
.chat-system { text-align: center; font-size: .76rem; color: var(--ink-faint); padding: 4px 0; }

/* ── MODAL ──────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(26,30,27,.42); backdrop-filter: blur(4px); z-index: 2000; display: none; align-items: center; justify-content: center; padding: 18px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: var(--r-xl); padding: 32px; max-width: 440px; width: 100%; position: relative; box-shadow: var(--sh-lg); animation: modalIn .18s ease; max-height: 90vh; overflow-y: auto; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-close { position: absolute; top: 14px; right: 14px; background: transparent; border: none; font-size: 1.3rem; color: var(--ink-faint); padding: 4px 8px; line-height: 1; }
.modal-close:hover { color: var(--ink); }
.modal h2 { font-family: var(--font-d); font-size: 1.4rem; margin-bottom: 4px; }
.modal > p { color: var(--ink-mute); font-size: .84rem; margin-bottom: 22px; }
.fg2 { margin-bottom: 18px; }
.fl2 { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 9px; }
.pill-row { display: flex; gap: 7px; flex-wrap: wrap; }
.pill-btn { padding: 7px 14px; border: 1.5px solid var(--border); background: var(--surface); border-radius: var(--r-md); font-family: var(--font-b); font-size: .82rem; transition: all var(--tr); }
.pill-btn:hover { border-color: var(--sage); color: var(--sage); }
.pill-btn.sel { border-color: var(--sage); background: var(--sage); color: #fff; }
.time-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.time-slot { padding: 8px 4px; border: 1.5px solid var(--border); background: var(--surface); border-radius: var(--r-sm); font-family: var(--font-b); font-size: .78rem; transition: all var(--tr); }
.time-slot:hover { border-color: var(--sage); color: var(--sage); }
.time-slot.sel { border-color: var(--sage); background: var(--sage); color: #fff; }
.form-error { padding: 9px 13px; background: #fdf0ef; color: var(--error); border-radius: var(--r-sm); font-size: .83rem; margin-bottom: 11px; border: 1px solid #f5c6c6; }

/* ── NO RESULTS ─────────────────────────────────────────────────── */
.no-results { text-align: center; padding: 60px 28px; color: var(--ink-mute); background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); }
.no-results p { margin-bottom: 14px; }

/* ── TOAST ──────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 22px; border-radius: var(--r-lg); font-size: .85rem; opacity: 0; transition: opacity .2s, transform .2s; z-index: 3000; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--error); }

/* ── SPINNER ────────────────────────────────────────────────────── */
.spinner { width: 28px; height: 28px; border: 2.5px solid var(--border); border-top-color: var(--sage); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 740px) {
  .browse-layout { grid-template-columns: 1fr; }
  .filters-panel { position: fixed; left: 0; top: 60px; bottom: 0; width: 260px; z-index: 500; transform: translateX(-100%); transition: transform .24s ease; box-shadow: var(--sh-lg); }
  .filters-panel.open { transform: translateX(0); }
  #filters-toggle { display: block; }
  .results-panel { padding: 16px; }
  .time-picker { grid-template-columns: repeat(3,1fr); }
  .hero { padding: 52px 20px 52px; }
  .nav { padding: 0 16px; }
  .nav-links { display: none; }
}

/* ── RESOURCES ──────────────────────────────────────────────────── */
.resources-wrap { max-width: 1100px; margin: 0 auto; padding: 44px 28px 64px; }
.resources-hero { text-align: center; margin-bottom: 36px; }
.resources-title { font-family: var(--font-d); font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; margin-bottom: 10px; }
.resources-sub { font-size: .98rem; color: var(--ink-mute); font-weight: 300; }

/* Search + filters */
.res-search-wrap { margin-bottom: 14px; }
.res-search-input { font-size: .92rem !important; padding: 11px 16px !important; border-radius: var(--r-lg) !important; }
.res-filters { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.res-topics { display: flex; gap: 7px; flex-wrap: wrap; }
.topic-btn { padding: 6px 15px; border: 1.5px solid var(--border); background: var(--surface); border-radius: 20px; font-family: var(--font-b); font-size: .8rem; color: var(--ink-mute); transition: all var(--tr); cursor: pointer; }
.topic-btn:hover { border-color: var(--sage); color: var(--sage); }
.topic-btn.sel { border-color: var(--sage); background: var(--sage); color: #fff; }
.res-sort-select { width: auto !important; min-width: 140px; }

/* Article grid */
.articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.article-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; transition: box-shadow var(--tr), transform var(--tr); display: flex; flex-direction: column; }
.article-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.article-thumb { width: 100%; height: 160px; object-fit: cover; background: var(--surface-2); display: block; }
.article-thumb-placeholder { width: 100%; height: 160px; background: linear-gradient(135deg, var(--sage-pale), var(--surface-2)); display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--sage-light); }
.article-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 7px; }
.article-section-tag { display: inline-block; font-size: .68rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--sage); background: var(--sage-pale); padding: 3px 9px; border-radius: 20px; align-self: flex-start; }
.article-title { font-size: .9rem; font-weight: 600; line-height: 1.45; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.article-trail { font-size: .81rem; color: var(--ink-mute); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-meta { font-size: .74rem; color: var(--ink-faint); }
.article-read { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 500; color: var(--sage); text-decoration: none; margin-top: 4px; }
.article-read:hover { color: var(--sage-deep); }

/* Skeleton loader */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Resources message (no key / error / no results) */
.res-message { text-align: center; padding: 60px 20px; color: var(--ink-mute); grid-column: 1 / -1; }
.res-message h3 { font-size: 1rem; color: var(--ink); margin-bottom: 8px; }
.res-message code { display: inline-block; background: var(--surface-2); padding: 7px 13px; border-radius: var(--r-sm); font-size: .82rem; border: 1px solid var(--border); margin: 6px 0; word-break: break-all; }

@media (max-width: 600px) {
  .articles-grid { grid-template-columns: 1fr; }
  .res-filters { flex-direction: column; align-items: flex-start; }
  .res-sort-select { width: 100% !important; }
}

