/* ===========================================================
   TLC MARKETPLACE — DESIGN SYSTEM
   Dark theme derived from the TLC logo:
   - Gold  #F2B705 (top arc)   -> primary accent / CTAs
   - Orange #E8821C (bottom arc) -> secondary accent / badges
   - Blue  #2C8FC9 (figures)   -> links / trust / info
   Typography: Sora (headings), Inter (body), Lora italic (tagline)
   =========================================================== */

:root {
  --bg: #0E0E10;
  --surface: #1A1A1E;
  --surface-raised: #232328;
  --surface-hover: #2A2A30;
  --border: #313138;

  --text: #F2F2F0;
  --text-muted: #A0A0A8;
  --text-faint: #6B6B73;

  --gold: #F2B705;
  --gold-hover: #FFC927;
  --orange: #E8821C;
  --orange-hover: #FF9A35;
  --blue: #2C8FC9;
  --blue-hover: #4BA8E0;

  --success: #3CB371;
  --danger: #E0544C;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.35);
  --shadow-elevated: 0 8px 40px rgba(0,0,0,0.5);

  --font-heading: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-tagline: 'Lora', serif;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Belt-and-suspenders: prevent block-level content from forcing page-level
   horizontal scroll (long unbroken text, a slightly-too-wide fixed
   element, etc). Without this, a single overflowing element can make the
   ENTIRE page scrollable sideways into unstyled black space - exactly
   the bug reported when pinch-zooming on mobile. Scoped to block-level
   containers rather than a blanket `*` selector, so it doesn't interfere
   with inline elements, absolutely-positioned icons/badges, or <select>
   sizing.
*/
.container, .card, section, main, header, footer, nav, .grid, .biz-card,
.profile-hero-inner, .dashboard-layout, .onboarding-wrap, .auth-wrap {
  max-width: 100%;
  box-sizing: border-box;
}
img, svg, video { max-width: 100%; height: auto; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

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

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--bg);
  padding: 8px 16px; z-index: 1000; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.tagline {
  font-family: var(--font-tagline);
  font-style: italic;
  color: var(--gold);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(14,14,16,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }

.brand { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }
.brand-mark {
  font-family: var(--font-heading); font-weight: 800; font-size: 1.5rem; color: var(--text);
  letter-spacing: 0.02em;
}
.brand-sub { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }

.main-nav { display: flex; align-items: center; gap: 28px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; transition: color .15s; }
.main-nav a:hover { color: var(--text); }
.main-nav .nav-cta {
  background: var(--gold); color: #1a1304; padding: 9px 18px; border-radius: 999px; font-weight: 600;
}
.main-nav .nav-cta:hover { background: var(--gold-hover); color: #1a1304; }
.main-nav .nav-link-muted { color: var(--text-faint); font-size: 0.85rem; }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.95rem;
  padding: 12px 24px; border-radius: 999px; border: none; cursor: pointer;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--gold); color: #1a1304; }
.btn-primary:hover { background: var(--gold-hover); color: #1a1304; }
.btn-secondary { background: var(--orange); color: #1a1304; }
.btn-secondary:hover { background: var(--orange-hover); }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-ghost { background: var(--surface); color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 24px; box-shadow: var(--shadow-card);
}
.card-hover { transition: transform .18s ease, border-color .18s ease; }
.card-hover:hover { transform: translateY(-3px); border-color: var(--gold); }

/* ---------- Forms ---------- */
.field { margin-bottom: 20px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; color: var(--text); }
.field .hint { color: var(--text-faint); font-size: 0.8rem; margin-top: 6px; }

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url],
input[type=number], input[type=search], textarea, select {
  width: 100%; padding: 12px 14px; background: var(--surface-raised); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font-body); font-size: 0.95rem;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; min-height: 100px; }

.checkbox-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.checkbox-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--gold); }
.checkbox-row label { margin: 0; font-weight: 500; font-size: 0.9rem; color: var(--text-muted); }

.password-field { position: relative; display: block; }
.password-field input { padding-right: 46px !important; width: 100%; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-faint);
  cursor: pointer; padding: 8px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; line-height: 0;
}
.password-toggle:hover { color: var(--gold); background: var(--surface-hover); }
.password-toggle svg { width: 20px; height: 20px; pointer-events: none; }
.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-visible .icon-eye { display: none; }
.password-toggle.is-visible .icon-eye-off { display: block; }

/* Kill the jarring yellow Chrome/Firefox autofill background on password/text inputs */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0px 1000px var(--surface-raised) inset !important;
  transition: background-color 9999s ease-in-out 0s;
}

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.checkbox-grid .checkbox-row { background: var(--surface-raised); padding: 10px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); }

/* ---------- Rich text editor ---------- */
.rich-text-editor { border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-raised); }
.rte-toolbar { display: flex; align-items: center; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.rte-btn {
  background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--text-muted);
  font-family: var(--font-body); font-size: 0.85rem; padding: 6px 10px; cursor: pointer; min-width: 32px;
}
.rte-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border); }
.rte-divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.rte-content {
  min-height: 120px; padding: 12px 14px; color: var(--text); font-family: var(--font-body); font-size: 0.95rem;
  line-height: 1.6; outline: none;
}
.rte-content:empty::before { content: attr(data-placeholder); color: var(--text-faint); }
.rte-content ul, .rte-content ol { padding-left: 24px; margin: 8px 0; }
.rte-content p { margin: 0 0 8px; }
.rte-content mark { padding: 1px 3px; border-radius: 3px; }

/* Read-only rendering of rich text content on public profile pages */
.rich-text-display ul, .rich-text-display ol { padding-left: 24px; margin: 8px 0; }
.rich-text-display p { margin: 0 0 10px; }
.rich-text-display mark { padding: 1px 3px; border-radius: 3px; }

.form-error {
  background: rgba(224,84,76,0.12); border: 1px solid var(--danger); color: #f5a8a3;
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 0.9rem;
}
.form-success {
  background: rgba(60,179,113,0.12); border: 1px solid var(--success); color: #8fe0b3;
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 0.9rem;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
}
.badge-gold { background: rgba(242,183,5,0.15); color: var(--gold); }
.badge-orange { background: rgba(232,130,28,0.15); color: var(--orange); }
.badge-blue { background: rgba(44,143,201,0.15); color: var(--blue); }
.badge-muted { background: var(--surface-raised); color: var(--text-muted); }

/* ---------- Hero ---------- */
.hero {
  padding: 90px 0 70px; text-align: center; position: relative; overflow: hidden;
  background: radial-gradient(circle at 50% 0%, rgba(242,183,5,0.08), transparent 60%);
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: 0.3em; }
.hero .lede { color: var(--text-muted); font-size: 1.15rem; max-width: 640px; margin: 0 auto 2em; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-tagline { font-family: var(--font-tagline); font-style: italic; color: var(--gold); font-size: 1.3rem; margin-bottom: 1em; }

.stats-row { display: flex; justify-content: center; gap: 48px; margin-top: 56px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat .num { font-family: var(--font-heading); font-weight: 800; font-size: 2.2rem; color: var(--gold); }
.stat .label { color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Sections ---------- */
.section { padding: 70px 0; }
.section-header { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section-header h2 { font-size: 2rem; }
.section-header p { color: var(--text-muted); }

.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Business Card ---------- */
.biz-card { display: flex; flex-direction: column; height: 100%; }
.biz-card-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.biz-logo {
  width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover;
  background: var(--surface-raised); border: 1px solid var(--border); flex-shrink: 0;
}
.biz-logo-placeholder {
  width: 56px; height: 56px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gold), var(--orange)); color: #1a1304; font-family: var(--font-heading); font-weight: 800; font-size: 1.3rem;
  flex-shrink: 0;
}
.biz-card h3 { font-size: 1.1rem; margin-bottom: 2px; }
.biz-card .biz-tagline { color: var(--text-muted); font-size: 0.85rem; }
.biz-card .biz-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.biz-card .biz-desc { color: var(--text-muted); font-size: 0.9rem; flex-grow: 1; margin-bottom: 16px; }
.biz-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; border-top: 1px solid var(--border); }

.rating-stars { color: var(--gold); letter-spacing: 1px; }

.star-rating-input { display: inline-flex; gap: 4px; cursor: pointer; }
.star-rating-input .star { color: var(--border); transition: color .1s ease, transform .1s ease; user-select: none; }
.star-rating-input .star.filled { color: var(--gold); }
.star-rating-input .star:hover { transform: scale(1.15); }

.featured-ribbon {
  position: absolute; top: 14px; right: 14px; background: var(--gold); color: #1a1304;
  font-size: 0.7rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}

/* ---------- Filters bar ---------- */
.filters-bar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding: 20px 0; margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.filters-bar select, .filters-bar input[type=search] { width: auto; min-width: 160px; }

/* ---------- Profile page ---------- */
.profile-hero {
  background: linear-gradient(135deg, rgba(242,183,5,0.08), rgba(44,143,201,0.05));
  border-bottom: 1px solid var(--border);
  padding: 56px 0 40px;
}
.profile-hero-inner { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.profile-logo { width: 100px; height: 100px; border-radius: var(--radius-md); object-fit: cover; border: 2px solid var(--border); }
.profile-logo-placeholder {
  width: 100px; height: 100px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gold), var(--orange)); color: #1a1304; font-family: var(--font-heading); font-weight: 800; font-size: 2.2rem;
}
.profile-info h1 { margin-bottom: 4px; }
.profile-contact-locked {
  background: var(--surface-raised); border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 16px; text-align: center; color: var(--text-muted); font-size: 0.9rem;
}

.profile-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; align-items: start; }
@media (max-width: 860px) {
  .profile-layout { grid-template-columns: 1fr; gap: 28px; }
}

.contact-methods { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.review-card { border-bottom: 1px solid var(--border); padding: 18px 0; }
.review-card:last-child { border-bottom: none; }
.review-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.reviewer-name { font-weight: 600; }
.review-date { color: var(--text-faint); font-size: 0.8rem; }

/* ---------- Dashboard layout ---------- */
.dashboard-layout { display: grid; grid-template-columns: 240px 1fr; gap: 32px; padding: 40px 0; }
.dashboard-sidebar { display: flex; flex-direction: column; gap: 4px; }
.dashboard-sidebar a {
  padding: 10px 14px; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 500; font-size: 0.92rem;
}
.dashboard-sidebar a:hover, .dashboard-sidebar a.active { background: var(--surface); color: var(--text); }
.dashboard-main h1 { margin-bottom: 24px; }
@media (max-width: 800px) { .dashboard-layout { grid-template-columns: 1fr; } }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }

table.simple-table { width: 100%; border-collapse: collapse; }
table.simple-table th, table.simple-table td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
table.simple-table th { color: var(--text-faint); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* On narrow screens, let wide tables scroll horizontally WITHIN their own
   card/container rather than squeezing columns unreadably thin or
   forcing the whole page to scroll sideways. Wrap a <table> in
   <div class="table-scroll"> in templates with many-column tables. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Onboarding ---------- */
.onboarding-wrap { max-width: 560px; margin: 60px auto; padding: 0 20px; }
.onboarding-progress { display: flex; gap: 6px; margin-bottom: 32px; }
.onboarding-progress .dot { height: 4px; flex: 1; background: var(--border); border-radius: 2px; }
.onboarding-progress .dot.active { background: var(--gold); }

/* ---------- Auth pages ---------- */
.auth-wrap { max-width: 440px; margin: 60px auto; padding: 0 20px; }
.auth-wrap .card { padding: 36px; }
.auth-switch { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding-top: 56px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; padding-bottom: 40px; }
.footer-blurb { color: var(--text-muted); font-size: 0.9rem; max-width: 360px; margin-top: 10px; }
.footer-tagline { font-family: var(--font-tagline); font-style: italic; color: var(--gold); margin: 6px 0 0; }
.footer-links h4 { color: var(--text-faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 14px; }
.footer-links a { display: block; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 10px; }
.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; color: var(--text-faint); font-size: 0.8rem; text-align: center; }
@media (max-width: 800px) { .footer-inner { grid-template-columns: 1fr; } }

/* ---------- Responsive nav ---------- */
@media (max-width: 960px) {
  .main-nav {
    position: fixed; top: 68px; left: 0; right: 0; bottom: 0;
    height: calc(100vh - 68px); height: calc(100dvh - 68px);
    background: var(--bg); z-index: 99;
    display: flex; flex-direction: column; align-items: flex-start;
    padding: 24px; gap: 8px;
    transform: translateX(100%); transition: transform .25s ease;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav a {
    width: 100%; padding: 16px 4px; border-bottom: 1px solid var(--border); flex-shrink: 0;
    font-size: 1.05rem;
  }
  .main-nav .nav-cta { width: 100%; text-align: center; margin-top: 8px; }
  .nav-toggle { display: block; }
  .brand-sub { display: none; } /* save header space on narrow/zoomed-out viewports */
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-24 { margin-top: 24px; } .mb-24 { margin-bottom: 24px; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
