/* =========================================================================
   VSS LEAD CENTER — THEME
   One stylesheet, organized in clear sections, replacing the old pile of
   templatemo-style.css / index.css / main.css / message.css / leads.css /
   normalize.css / bootstrap.min.css.

   Sections:
     1. Design tokens (colors, type, spacing)
     2. Reset & base elements
     3. Layout helpers
     4. Header / navigation
     5. Buttons & links
     6. Forms
     7. Auth split-screen (signin / register / verify)
     8. Landing page hero
     9. Dashboard shell (leads + admin)
     10. Cards & tables (link directory, admin panels)
     11. Utility banners (config / error messages)
     12. Responsive
   ========================================================================= */

/* ---------- 1. Design tokens ------------------------------------------- */
:root {
  /* Brand palette — drawn from the VSS logo (charcoal wordmark, ember-red swirl) */
  --ink:        #1c2127;   /* near-black navy, primary text & dark surfaces */
  --ink-soft:   #2b323b;   /* secondary dark surface (header/nav) */
  --paper:      #f3f4f6;   /* app background, cool light gray (not warm cream) */
  --surface:    #ffffff;   /* card / input surfaces */
  --line:       #e2e4e8;   /* borders & dividers */
  --slate:      #5b6472;   /* muted body text */
  --ember:      #c4432b;   /* primary accent, from the logo swirl */
  --ember-dark: #9e3220;   /* hover/active state of accent */
  --success:    #2f8f5b;   /* fresh / good state (recent listings) */
  --warn:       #b8862f;   /* aging state */
  --danger:     #b3261e;   /* errors */

  /* Type */
  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  --radius: 8px;
  --radius-sm: 4px;
  --shadow-card: 0 1px 2px rgba(28, 33, 39, 0.06), 0 1px 8px rgba(28, 33, 39, 0.06);
}

/* ---------- 2. Reset & base elements ------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0 0 var(--sp-3);
  color: var(--ink);
}
h1 { font-size: clamp(2.2rem, 4vw, 3.6rem); text-transform: uppercase; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); text-transform: uppercase; }
p { margin: 0 0 var(--sp-3); color: var(--slate); }
a { color: var(--ember); text-decoration: none; }
a:hover { color: var(--ember-dark); text-decoration: underline; }
:focus-visible { outline: 3px solid var(--ember); outline-offset: 2px; }
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--slate); margin-bottom: var(--sp-1); }

/* ---------- 3. Layout helpers ------------------------------------------- */
.container { max-width: 1180px; margin: 0 auto; padding: 0 var(--sp-5); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 4. Header / navigation -------------------------------------- */
.app-header {
  background: var(--ink);
  color: var(--surface);
  border-bottom: 3px solid var(--ember);
}
.app-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: var(--sp-4);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.03em;
  color: var(--surface);
}
.brand span { color: var(--ember); }
.app-nav { display: flex; align-items: center; gap: var(--sp-5); }
.app-nav a {
  color: rgba(255,255,255,0.82);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.app-nav a:hover, .app-nav a.active { color: var(--surface); text-decoration: none; }
.app-nav .pill {
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 4px 14px;
}
.app-nav .pill:hover { border-color: var(--ember); background: rgba(196,67,43,0.15); }
.user-email {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  font-family: var(--font-mono);
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--surface);
  cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; display: block; }

/* ---------- 5. Buttons & links ------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--ember); color: var(--surface); }
.btn-primary:hover { background: var(--ember-dark); text-decoration: none; color: var(--surface); }
.btn-outline { background: transparent; border-color: currentColor; color: var(--surface); }
.btn-outline:hover { background: rgba(255,255,255,0.12); text-decoration: none; }
/* Same shape, for use on light backgrounds (e.g. the landing-page hero) */
.btn-outline-dark { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-outline-dark:hover { background: rgba(28,33,39,0.06); color: var(--ink); text-decoration: none; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- 6. Forms ----------------------------------------------------- */
.field { margin-bottom: var(--sp-4); }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select,
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { font-family: var(--font-mono); font-size: 0.85rem; }
input:focus, select:focus, textarea:focus {
  border-color: var(--ember);
  box-shadow: 0 0 0 3px rgba(196,67,43,0.15);
  outline: none;
}
.hint { font-size: 0.8rem; color: var(--slate); margin-top: var(--sp-1); }
.form-message {
  display: none;
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.9rem;
  margin-bottom: var(--sp-4);
}
.form-message.is-visible { display: block; }
.form-message.is-error { background: #fdeceb; color: var(--danger); border: 1px solid #f3c6c2; }
.form-message.is-success { background: #eaf6ef; color: var(--success); border: 1px solid #bfe6cf; }

/* ---------- 7. Auth split-screen ----------------------------------------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-brand-panel {
  position: relative;
  background: var(--ink);
  color: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-8);
  overflow: hidden;
}
.auth-brand-panel .swirl {
  position: absolute;
  right: -120px;
  bottom: -120px;
  width: 480px;
  height: 480px;
  opacity: 0.18;
}
.auth-brand-panel .logo-mark { width: 220px; margin-bottom: var(--sp-6); filter: brightness(0) invert(1); }
.auth-brand-panel h1 { font-size: 2rem; max-width: 380px; }
.auth-brand-panel .tagline {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ember);
  font-size: 1.1rem;
}
.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
}
.auth-form-card { width: 100%; max-width: 380px; }
.auth-form-card h2 { font-size: 1.6rem; margin-bottom: var(--sp-2); }
.auth-form-card .subhead { margin-bottom: var(--sp-6); }
.auth-switch { margin-top: var(--sp-5); font-size: 0.9rem; text-align: center; }

/* ---------- 8. Landing page hero ----------------------------------------- */
.hero {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: stretch;
}
.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-8);
}
.hero-copy h1 { max-width: 640px; }
.hero-copy .lede { font-size: 1.15rem; max-width: 520px; }
.hero-actions { display: flex; gap: var(--sp-4); margin-top: var(--sp-6); }
.hero-panel {
  position: relative;
  background: var(--ink);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-panel .swirl { position: absolute; width: 620px; height: 620px; opacity: 0.22; }
.hero-panel .rotator {
  position: relative;
  font-family: var(--font-display);
  text-transform: uppercase;
  color: var(--surface);
  font-size: 2.6rem;
  letter-spacing: 0.03em;
  height: 1.3em;
  overflow: hidden;
}
.hero-panel .rotator span {
  position: absolute;
  inset: 0;
  opacity: 0;
  color: var(--ember);
  animation: rotate-word 6s infinite;
}
.hero-panel .rotator span:nth-child(2) { animation-delay: 2s; }
.hero-panel .rotator span:nth-child(3) { animation-delay: 4s; }
@keyframes rotate-word {
  0%, 5% { opacity: 0; transform: translateY(12px); }
  10%, 28% { opacity: 1; transform: translateY(0); }
  33%, 100% { opacity: 0; transform: translateY(-12px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-panel .rotator span { animation: none; opacity: 1; position: static; display: block; }
  .hero-panel .rotator span:not(:first-child) { display: none; }
}

/* ---------- 9. Dashboard shell (leads + admin) --------------------------- */
.page-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: var(--sp-6) 0 var(--sp-4);
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.segmented { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px; }
.segmented button {
  border: none;
  background: transparent;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85rem;
  padding: 8px 20px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--slate);
}
.segmented button.active { background: var(--ink); color: var(--surface); }
.table-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: var(--sp-3); margin-bottom: var(--sp-7); }
.country-view { display: none; }
.country-view.active { display: block; }

/* ---------- 10. Cards & tables (links directory, admin panels) ----------- */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}
.link-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-4);
  box-shadow: var(--shadow-card);
}
.link-card h3 { font-size: 1rem; margin-bottom: var(--sp-1); text-transform: none; }
.link-card p { font-size: 0.85rem; margin-bottom: var(--sp-2); }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); margin: var(--sp-6) 0 var(--sp-8); }
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: var(--sp-5); }
.panel-card h3 { font-size: 1rem; letter-spacing: 0.06em; color: var(--slate); margin-bottom: var(--sp-4); }

/* Generic tab panel toggle, used by the admin page's Leads Tools / Team tabs */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Team-management lookup result */
.lookup-result { display: none; margin: var(--sp-4) 0; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-4); background: var(--paper); }
.lookup-result.is-visible { display: block; }
.lookup-result dl { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-4); margin: 0; font-size: 0.9rem; }
.lookup-result dt { color: var(--slate); font-weight: 600; }
.lookup-result dd { margin: 0; font-family: var(--font-mono); }

/* Destructive-action area, visually separated from the safe actions above it */
.danger-zone { display: none; margin-top: var(--sp-5); border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-4); background: var(--paper); }
.danger-zone h4 { margin: 0 0 var(--sp-2); font-size: 0.85rem; letter-spacing: 0.04em; color: var(--slate); text-transform: uppercase; }
.danger-zone p { font-size: 0.85rem; margin-bottom: var(--sp-3); }
.danger-zone code { font-family: var(--font-mono); background: var(--surface); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--line); }
.btn-danger { background: var(--danger); color: var(--surface); }
.btn-danger:hover { background: #8f1e18; color: var(--surface); }
.btn-danger[disabled] { background: #e2b3af; }

/* ---------- 11. Utility banners ------------------------------------------ */
.banner {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(28,33,39,0.55);
  align-items: center;
  justify-content: center;
}
.banner.is-visible { display: flex; }
.banner-box {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 420px;
  padding: var(--sp-6);
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.banner-box h3 { margin-bottom: var(--sp-2); }

/* ---------- 12. Responsive ------------------------------------------------ */
@media (max-width: 900px) {
  .hero, .auth-shell { grid-template-columns: 1fr; }
  .hero-panel { min-height: 260px; }
  .auth-brand-panel { padding: var(--sp-6); }
  .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .app-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--ink-soft);
    flex-direction: column;
    align-items: flex-start;
    padding: var(--sp-4) var(--sp-5);
    gap: var(--sp-3);
    display: none;
  }
  .app-nav.is-open { display: flex; }
}
