/* ============================================================
   Theme Engine — 60/30/10 color system via CSS variables
   60% dominant background, 30% structural identity, 10% CTA accent
   ============================================================ */
/*
 * Token roles (each token has ONE job, so themes never collide):
 *   --bg-dominant / --bg-surface  -> page + card backgrounds (60%)
 *   --text-primary / --text-secondary -> body text
 *   --structural / --structural-soft  -> BRAND surfaces (nav, hero). These
 *        stay dark in EVERY theme so the white text on them is always legible.
 *   --accent / --accent-amber     -> CTA accents (10%)
 * The previous bug was --structural flipping to a light value in dark mode,
 * which washed out the nav and hero. It is now always a dark brand color.
 */
:root,
[data-theme="light"] {
    --bg-dominant: #f4f6f8;
    --bg-surface: #ffffff;
    --text-primary: #1c2b3a;
    --text-secondary: #5a6b7a;
    --border-color: #e1e6ea;
    --structural: #1c2b3a;
    --structural-soft: #2c3e50;
    --on-structural: #ffffff;
    --accent: #1f9d63;
    --accent-hover: #178050;
    --accent-amber: #d68910;
    --danger: #c0392b;
    --success-bg: #e8f7ee;
    --success-text: #1f9d63;
    --error-bg: #fdecea;
    --error-text: #c0392b;
    --shadow: 0 2px 8px rgba(28, 43, 58, 0.08);
    --radius: 10px;
}

[data-theme="dark"] {
    --bg-dominant: #14191f;
    --bg-surface: #1f2730;
    --text-primary: #e8edf2;
    --text-secondary: #9fb0bd;
    --border-color: #313b46;
    --structural: #0f141a;        /* darker than the page, keeps nav distinct */
    --structural-soft: #1b2530;
    --on-structural: #ffffff;
    --accent: #2ecc71;
    --accent-hover: #45d684;
    --accent-amber: #e2a23a;
    --danger: #e74c3c;
    --success-bg: #15301f;
    --success-text: #5fd897;
    --error-bg: #3a1c19;
    --error-text: #f0796a;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    --radius: 10px;
}

/* Ocean — cool blues */
[data-theme="ocean"] {
    --bg-dominant: #eef4f8;
    --bg-surface: #ffffff;
    --text-primary: #103048;
    --text-secondary: #4d6b80;
    --border-color: #d3e1ea;
    --structural: #0c3a5e;
    --structural-soft: #14557f;
    --on-structural: #ffffff;
    --accent: #0d9bb5;
    --accent-hover: #0a7e94;
    --accent-amber: #e08a1e;
    --danger: #c0392b;
    --success-bg: #e2f4f7;
    --success-text: #0a7e94;
    --error-bg: #fdecea;
    --error-text: #c0392b;
    --shadow: 0 2px 8px rgba(16, 48, 72, 0.1);
    --radius: 10px;
}

/* Forest — earthy greens */
[data-theme="forest"] {
    --bg-dominant: #f1f5ef;
    --bg-surface: #ffffff;
    --text-primary: #1f3322;
    --text-secondary: #56684f;
    --border-color: #dde6d8;
    --structural: #1f3d2b;
    --structural-soft: #2f5740;
    --on-structural: #ffffff;
    --accent: #4a8c3f;
    --accent-hover: #3a7031;
    --accent-amber: #c9852a;
    --danger: #b8392b;
    --success-bg: #e7f3e4;
    --success-text: #3a7031;
    --error-bg: #fbeae8;
    --error-text: #b8392b;
    --shadow: 0 2px 8px rgba(31, 51, 34, 0.1);
    --radius: 10px;
}

/* Sunset — warm dark with amber accents */
[data-theme="sunset"] {
    --bg-dominant: #1d1620;
    --bg-surface: #2a2030;
    --text-primary: #f6ecef;
    --text-secondary: #c4a9b4;
    --border-color: #43344b;
    --structural: #2a1330;
    --structural-soft: #4a2148;
    --on-structural: #ffffff;
    --accent: #e8762d;
    --accent-hover: #f08a45;
    --accent-amber: #f3b14a;
    --danger: #e74c3c;
    --success-bg: #2c1f33;
    --success-text: #f3b14a;
    --error-bg: #3a1c19;
    --error-text: #f0796a;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    --radius: 10px;
}

/* High contrast — accessibility */
[data-theme="contrast"] {
    --bg-dominant: #ffffff;
    --bg-surface: #ffffff;
    --text-primary: #000000;
    --text-secondary: #1a1a1a;
    --border-color: #000000;
    --structural: #000000;
    --structural-soft: #1a1a1a;
    --on-structural: #ffffff;
    --accent: #0050d8;
    --accent-hover: #003ba6;
    --accent-amber: #9a5b00;
    --danger: #b00000;
    --success-bg: #d6f5e0;
    --success-text: #00662e;
    --error-bg: #ffd9d6;
    --error-text: #b00000;
    --shadow: 0 0 0 1px #000000;
    --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-dominant);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { color: var(--text-primary); margin: 0 0 0.5rem; }
p { line-height: 1.5; }
.muted { color: var(--text-secondary); font-size: 0.9rem; }
.center { text-align: center; }

/* ============================================================
   Layout helpers
   ============================================================ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   Top Navigation
   ============================================================ */
.topnav {
    background: var(--structural);
    color: var(--on-structural);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}
.topnav a { color: var(--on-structural); }
.topnav .brand { font-weight: 700; font-size: 1.2rem; }
.topnav nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* Hamburger toggle — hidden on larger screens */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius);
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    margin: 0 auto;
    background: var(--on-structural);
    transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 720px) {
    .nav-toggle { display: flex; }
    .topnav { flex-wrap: nowrap; }
    .topnav nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--structural);
        padding: 0.5rem 1rem 1rem;
        box-shadow: var(--shadow);
    }
    .topnav nav.open { display: flex; }
    .topnav nav a {
        padding: 0.85rem 0.25rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }
    .topnav nav .theme-toggle { margin-top: 0.75rem; align-self: flex-start; }
}
.theme-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.35);
    color: var(--on-structural);
    border-radius: var(--radius);
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    min-height: 40px;
}

/* ============================================================
   Cards / Surfaces
   ============================================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

/* ============================================================
   Buttons — large touch targets (min 44px)
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-amber {
    background: var(--accent-amber);
    color: #fff;
}
.btn-secondary {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-google {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
    margin-top: 0.75rem;
}
.btn-danger { background: var(--danger); color: #fff; }

/* ============================================================
   Forms
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg-dominant);
}
.auth-card {
    background: var(--bg-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}
.auth-form, form.stacked {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 1rem;
}
label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.checkbox-row {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="date"],
input[type="time"], input[type="datetime-local"], textarea, select {
    min-height: 44px;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1rem;
    width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(31, 157, 99, 0.15);
}

/* ============================================================
   Role tabs (registration)
   ============================================================ */
.role-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}
.role-tab {
    flex: 1;
    min-height: 44px;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    background: var(--bg-dominant);
    color: var(--text-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95rem;
}
.role-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ============================================================
   Alerts / Flash messages
   ============================================================ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }

/* ============================================================
   Calendar / Scheduler grid
   ============================================================ */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.slot {
    min-height: 56px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
    touch-action: manipulation;
    user-select: none;
}
.slot:active { transform: scale(0.96); }
.slot-available {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-text);
}
.slot-unavailable {
    background: var(--bg-dominant);
    color: var(--text-secondary);
    cursor: not-allowed;
}
.slot-booked {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-text);
}
.slot-mine { background: var(--accent); color: #fff; }
.slot-selected {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
    background: var(--accent);
    color: #fff;
}

/* Sticky booking action bar (mobile-friendly) */
.book-bar {
    position: sticky;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    z-index: 40;
}
.book-bar.show { display: flex; }
.book-bar-info { font-weight: 600; }

/* ============================================================
   Modal (booking/event details) — mobile-friendly
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    padding: 0;
}
/* The author rule above would otherwise override the [hidden] attribute,
   leaving the modal permanently visible. Force it hidden when closed. */
.modal-overlay[hidden] { display: none !important; }
.modal {
    background: var(--bg-surface);
    color: var(--text-primary);
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow);
    max-height: 85vh;
    overflow-y: auto;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-surface);
}
.modal-head h3 { margin: 0; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
}
.modal-body {
    margin: 0;
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: minmax(90px, auto) 1fr;
    gap: 0.5rem 1rem;
}
.modal-body dt { color: var(--text-secondary); font-size: 0.9rem; }
.modal-body dd { margin: 0; font-weight: 600; word-break: break-word; }

@media (min-width: 640px) {
    .modal-overlay { align-items: center; }
    .modal { border-radius: var(--radius); }
}

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
}

/* Danger zone (destructive actions) */
.danger-zone { border: 1px solid var(--danger); }
.danger-zone h1, .danger-zone h3 { color: var(--danger); }

/* ============================================================
   Consultant calendar
   ============================================================ */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.cal-header strong { font-size: 1.1rem; }
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}
.cal-weekdays span {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-cell {
    min-height: 64px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    border-radius: var(--radius);
    padding: 0.3rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    cursor: pointer;
    color: var(--text-primary);
    font: inherit;
}
.cal-cell:hover { border-color: var(--accent); }
.cal-cell-empty { background: transparent; border: none; cursor: default; }
.cal-num { font-weight: 700; }
.cal-badge {
    font-size: 0.65rem;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
}
.cal-avail { font-size: 0.65rem; color: var(--text-secondary); }
.cal-day { margin-top: 1.25rem; }

@media (max-width: 540px) {
    .cal-cell { min-height: 52px; padding: 0.2rem; }
    .cal-num { font-size: 0.85rem; }
    .cal-badge, .cal-avail { font-size: 0.55rem; }
}

/* ============================================================
   Search
   ============================================================ */
.search-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}
.search-bar input[type="search"] {
    flex: 1 1 220px;
    min-height: 44px;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--text-primary);
}
.search-bar select {
    min-height: 44px;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--text-primary);
}
.badge-muted {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-dominant);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

/* ============================================================
   Landing page
   ============================================================ */
.hero {
    background: linear-gradient(135deg, var(--structural), var(--structural-soft));
    color: var(--on-structural);
    border-radius: var(--radius);
    padding: 3rem 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
}
.hero h1 { color: var(--on-structural); font-size: clamp(1.6rem, 4vw, 2.6rem); }
.hero p { color: var(--on-structural); opacity: 0.88; max-width: 640px; margin: 0.75rem auto 1.5rem; font-size: 1.05rem; }
.hero .btn-row { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.hero .btn-secondary { color: var(--on-structural); border-color: rgba(255,255,255,0.4); background: transparent; }

.section { margin: 2.5rem 0; }
.section h2 { text-align: center; margin-bottom: 0.4rem; }
.section .lede { text-align: center; color: var(--text-secondary); max-width: 640px; margin: 0 auto 1.5rem; }

.step { position: relative; }
.step .step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 700; margin-bottom: 0.5rem;
}

.benefit-icon { font-size: 1.6rem; margin-bottom: 0.4rem; }

/* ============================================================
   Marketplace cards
   ============================================================ */
.consultant-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.consultant-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.consultant-card .body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.consultant-card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
.consultant-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(0,0,0,0.14); }
.consultant-card.is-featured { border-color: var(--accent-amber); box-shadow: 0 0 0 1px var(--accent-amber) inset; }
/* Compact (image-less) directory cards */
.consultant-card-compact .body { padding: 1.1rem; gap: 0.35rem; }
.consultant-card-compact.is-featured { border-left: 4px solid var(--accent-amber); }
.consultant-card .btn { margin-top: auto; }

/* ============================================================
   Landing page — filters, search, animations
   ============================================================ */
.hero-trust { font-size: 0.92rem; opacity: 0.9; margin-top: 1rem !important; }
.cat-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 1rem; justify-content: center; }
.cat-chip {
    padding: 0.4rem 0.9rem; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border-color); background: var(--bg-surface);
    color: var(--text-secondary); font-size: 0.9rem; transition: all 0.15s ease;
}
.cat-chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.cat-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.dir-search-wrap { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dir-search-wrap input[type="search"] {
    flex: 1; min-width: 220px; padding: 0.7rem 1rem;
    border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-surface);
    color: var(--text-primary); font-size: 1rem; transition: border-color 0.15s, box-shadow 0.15s;
}
.dir-search-wrap input[type="search"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }
.filtered-out, .paged-out { display: none !important; }
.pagination { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; margin-top: 1.5rem; }
.page-btn {
    min-width: 2.2rem; padding: 0.4rem 0.7rem; cursor: pointer;
    border: 1px solid var(--border-color); background: var(--bg-surface);
    color: var(--text-secondary); border-radius: 8px; font-size: 0.9rem; transition: all 0.15s ease;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: default; }

.feature-card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
.feature-card:hover, .card.step:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(0,0,0,0.12); }
.cta-banner { background: linear-gradient(135deg, var(--structural), var(--structural-soft)); color: var(--on-structural); }
.cta-banner h2, .cta-banner .muted { color: var(--on-structural); }
.cta-banner .muted { opacity: 0.9; }

/* Scroll-reveal entrance animation */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .consultant-card, .feature-card, .card.step, .cat-chip { transition: none; }
    .consultant-card:hover, .feature-card:hover, .card.step:hover { transform: none; }
}

/* Placeholder avatar for members-only consultants seen by logged-out visitors */
.avatar-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--structural), var(--structural-soft));
    color: var(--on-structural);
    font-weight: 700; text-transform: uppercase;
    user-select: none;
}
.avatar-placeholder-card { width: 100%; aspect-ratio: 4/3; font-size: 2.5rem; }
.avatar-placeholder-lg { width: 120px; height: 120px; border-radius: 50%; font-size: 2.75rem; flex: none; }
.locked-note { display: inline-flex; align-items: center; gap: 0.35rem; }
.badge-featured {
    background: var(--accent-amber);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    align-self: flex-start;
}

/* ============================================================
   Analytics (premium)
   ============================================================ */
.stat { display: flex; flex-direction: column; gap: 0.15rem; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.delta { font-size: 0.8rem; font-weight: 600; }
.delta.up { color: var(--accent); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-secondary); }
.analytics-table { width: 100%; border-collapse: collapse; }
.analytics-table th, .analytics-table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border-color); }
.analytics-table th { font-size: 0.8rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.analytics-chart { width: 100%; height: auto; color: var(--text-secondary); }
.analytics-chart .bar { fill: var(--accent); }
.analytics-chart .lbl { font-size: 9px; fill: currentColor; opacity: 0.6; }
.analytics-chart .val { font-size: 9px; fill: currentColor; opacity: 0.85; }
.cmp-row { margin: 0.75rem 0; }
.cmp-label { font-weight: 600; margin-bottom: 0.25rem; }
.cmp-bars { display: flex; flex-direction: column; gap: 0.3rem; }
.cmp-bar { position: relative; background: var(--bg-dominant); border-radius: 6px; height: 1.4rem; overflow: hidden; }
.cmp-fill { position: absolute; inset: 0 auto 0 0; height: 100%; border-radius: 6px; }
.cmp-fill.you { background: var(--accent); }
.cmp-fill.peer { background: var(--text-secondary); opacity: 0.5; }
.cmp-num { position: absolute; left: 0.5rem; top: 50%; transform: translateY(-50%); font-size: 0.78rem; font-weight: 600; color: var(--text-primary); }

/* Booking status accents */
.booking-pending { border-left: 3px solid var(--accent-amber); }
.status-confirmed { color: var(--accent); font-weight: 600; }
.status-rejected,
.status-cancelled { color: var(--danger); }
.status-completed { color: var(--text-secondary); }

/* ============================================================
   Media (portfolio images / videos / embeds)
   ============================================================ */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.media-cell { display: flex; flex-direction: column; gap: 0.4rem; }
.media-item { margin: 0; }
.media-item img,
.media-item video {
    width: 100%; border-radius: var(--radius);
    background: #000; display: block;
}
.media-item video { aspect-ratio: 16/9; object-fit: cover; }
.media-caption { font-size: 0.85rem; margin-top: 0.25rem; }
/* Script-based social embeds (X/Twitter, Instagram, TikTok) have their own
   fixed/min widths, so let them span the grid rather than be squished. */
.media-social { grid-column: 1 / -1; justify-self: center; width: 100%; max-width: 560px; }
.media-social .twitter-tweet,
.media-social .instagram-media,
.media-social .tiktok-embed { margin: 0 auto !important; }
/* Responsive 16:9 iframe wrapper for embeds */
.media-embed {
    position: relative; width: 100%; aspect-ratio: 16/9;
    border-radius: var(--radius); overflow: hidden; background: #000;
}
.media-embed iframe {
    position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
/* Uniform thumbnail gallery (consultant profile) + lightbox modal */
.media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
}
.media-tile {
    position: relative; aspect-ratio: 1 / 1;
    padding: 0; border: 1px solid var(--border-color);
    border-radius: var(--radius); overflow: hidden; cursor: pointer;
    background: #000; transition: transform 0.12s, box-shadow 0.12s;
}
.media-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.media-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb-generic {
    width: 100%; height: 100%;
    background: linear-gradient(135deg, var(--structural), var(--structural-soft));
}
.media-tile .media-badge {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(0, 0, 0, 0.55); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; pointer-events: none;
}
.media-tile .media-prov {
    position: absolute; bottom: 6px; left: 0; right: 0; text-align: center;
    font-size: 0.72rem; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.6); pointer-events: none;
}

.media-modal {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.82);
    display: none; align-items: center; justify-content: center; padding: 1.5rem;
}
.media-modal.open { display: flex; }
.media-modal-content {
    position: relative; width: 100%; max-width: 900px; max-height: 90vh; overflow: auto;
}
.media-modal-content .media-item { display: flex; flex-direction: column; align-items: center; }
.media-modal-content .media-item img,
.media-modal-content .media-item video {
    max-height: 80vh; width: auto; max-width: 100%; border-radius: var(--radius);
}
.media-modal-content .media-embed { width: min(82vw, 800px); }
.media-modal-content .media-social { max-width: 560px; margin: 0 auto; }
.media-modal-content .media-caption { color: #ddd; text-align: center; margin-top: 0.5rem; }
.media-modal-close {
    position: absolute; top: 1rem; right: 1.25rem;
    background: none; border: none; color: #fff; font-size: 1.6rem; cursor: pointer; line-height: 1;
}

/* Collapsible card (work experience, add-media) */
.collapse-card > summary {
    cursor: pointer; list-style: none; padding: 0.25rem 0;
}
.collapse-card > summary::-webkit-details-marker { display: none; }
.collapse-card > summary::before { content: '▸ '; color: var(--text-secondary); }
.collapse-card[open] > summary::before { content: '▾ '; }

/* ============================================================
   Messaging
   ============================================================ */
.badge-unread {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem;
    background: var(--accent); color: #fff;
    font-size: 0.7rem; font-weight: 700; line-height: 1;
    border-radius: 999px;
}
.msg-tabs { display: flex; gap: 0.25rem; margin: 0.5rem 0 1rem; flex-wrap: wrap; }
.msg-tabs a {
    padding: 0.4rem 0.85rem; border-radius: 999px;
    color: var(--text-secondary); text-decoration: none;
    border: 1px solid var(--border-color); background: var(--bg-surface);
}
.msg-tabs a:hover { border-color: var(--accent); color: var(--accent); }
.msg-tabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.messaging {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    align-items: start;
}
/* Per-message delete affordance, revealed on hover */
.msg-del { display: inline; margin-left: 0.4rem; }
.msg-del button {
    background: none; border: none; cursor: pointer; padding: 0;
    font-size: 0.75rem; opacity: 0; transition: opacity 0.15s;
}
.message-bubble:hover .msg-del button { opacity: 0.7; }
.msg-del button:hover { opacity: 1; }
/* Bin rows */
.bin-row {
    display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
    padding: 0.5rem 0; border-bottom: 1px solid var(--border-color);
}
.bin-row a { text-decoration: none; color: var(--text-primary); }
.bin-actions { display: flex; gap: 0.4rem; flex: none; }
.conversation-list {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    max-height: 70vh; overflow-y: auto;
}
.conversation-item {
    display: block;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
}
.conversation-item:hover { background: var(--bg-dominant); }
.conversation-item.active { background: var(--bg-dominant); border-left: 3px solid var(--accent); }
.conversation-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.conversation-item .preview {
    display: block; font-size: 0.85rem; margin-top: 0.2rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conversation-pane {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    display: flex; flex-direction: column;
    min-height: 50vh;
}
.conversation-header {
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
}
.message-thread {
    flex: 1; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem;
    max-height: 55vh; overflow-y: auto;
}
.message-bubble { max-width: 75%; padding: 0.5rem 0.75rem; border-radius: var(--radius); }
.message-bubble.theirs { align-self: flex-start; background: var(--bg-dominant); border: 1px solid var(--border-color); }
.message-bubble.mine { align-self: flex-end; background: var(--accent); color: #fff; }
.message-bubble.mine .muted { color: rgba(255,255,255,0.8); }
.message-meta { font-size: 0.72rem; margin-top: 0.25rem; }
.message-composer {
    display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--border-color);
}
.message-composer textarea { flex: 1; resize: vertical; }
@media (max-width: 639px) {
    .messaging { grid-template-columns: 1fr; }
}

/* ============================================================
   Responsive tweaks
   ============================================================ */
@media (max-width: 639px) {
    .calendar-grid { grid-template-columns: repeat(1, 1fr); }
    .auth-card { padding: 1.5rem; }
    .topnav nav { width: 100%; justify-content: space-between; }
}

@media (min-width: 640px) and (max-width: 899px) {
    .calendar-grid { grid-template-columns: repeat(3, 1fr); }
}
