/* ==========================================================================
   TableSide Media — Shared baseline for creator-facing pages
   Imports tokens.css for design variables, then defines the body/nav/card/
   button/input/footer/loading/error/success primitives that were previously
   copy-pasted across portal.html, visit.html, submit.html, and apply-creator.
   Page-specific overrides in inline <style> blocks cascade on top of these.
   ========================================================================== */

@import url('tokens.css');
@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@400;500;600&family=Playfair+Display:ital,wght@0,500;0,600;1,500&display=swap');

/* ─── Reset ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Page entrance ─── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Base document ─── */
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  animation: fadeIn 0.25s ease forwards;
}

h1, h2, h3 { font-family: var(--font-display); }

/* ─── Nav (simple inline variant — portal/visit/submit) ─── */
nav { background: rgba(31, 67, 61, 0.97); }

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  color: var(--cream);
  font-size: 1.2rem;
  text-decoration: none;
  font-weight: 500;
}

.nav-back {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(232, 224, 208, 0.6);
  text-decoration: none;
  text-transform: uppercase;
}
.nav-back:hover { color: var(--cream); }

/* ─── Page layout ─── */
.page-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}
.page {
  max-width: 460px;
  width: 100%;
}

/* ─── Brand header (portal / submit) ─── */
.brand { text-align: center; margin-bottom: 1.5rem; }
.brand-eyebrow {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(31, 67, 61, 0.45);
  margin-bottom: 0.25rem;
}
.brand-title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  color: var(--deep-green);
  font-style: italic;
  font-weight: 500;
}

/* ─── Card primitive ─── */
.card {
  background: var(--cream);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
}
.card + .card { margin-top: 0.75rem; }
.card-body { padding: 1.25rem 1.5rem; }

/* ─── Utility ─── */
.hidden { display: none !important; }

/* ─── Loading / skeleton states ─── */
.loading-wrap {
  text-align: center;
  padding: 3rem 1.5rem;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(31, 67, 61, 0.15);
  border-top-color: var(--deep-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skel {
  background: rgba(31, 67, 61, 0.08);
  border-radius: 6px;
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { opacity: 0.6; }
  50%  { opacity: 1;   }
  100% { opacity: 0.6; }
}

/* ─── Error state ─── */
.error-wrap {
  text-align: center;
  padding: 2.5rem 1.5rem;
}
.error-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(180, 60, 40, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.error-icon svg {
  width: 22px;
  height: 22px;
  color: #993C1D;
}

/* ─── Success state (visit / submit) ─── */
.success-wrap {
  text-align: center;
  padding: 2.5rem 1.5rem;
}
.check-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(31, 67, 61, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}
.check-icon svg {
  width: 24px;
  height: 24px;
  color: var(--deep-green);
}
.success-eyebrow {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(31, 67, 61, 0.45);
  margin-bottom: 0.5rem;
}
.success-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--deep-green);
  margin-bottom: 0.5rem;
  font-weight: 500;
}
.success-title em {
  font-style: italic;
  color: rgba(31, 67, 61, 0.55);
}
.success-text {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

/* ─── Shared hero ─── */
.page-hero {
  background: #172E2A;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(35, 75, 67, 0.7) 0%, transparent 70%);
  z-index: 0;
}
.page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.03;
  z-index: 0;
}
.page-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 2.5rem;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(232, 224, 208, 0.5);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.hero-eyebrow::before,
.hero-eyebrow::after {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: rgba(232, 224, 208, 0.25);
}
.page-hero h1,
.hero-title {
  font-family: var(--font-display);
  color: var(--cream);
  font-size: var(--fs-2xl);
  font-weight: 500;
  font-style: italic;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}
.page-hero h1 em { font-style: italic; color: rgba(232, 224, 208, 0.65); }
.page-hero p,
.hero-sub {
  color: rgba(248, 245, 239, 0.5);
  font-size: var(--fs-sm);
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto;
}
.page-hero.hero-lg .page-hero-inner { padding: 10rem 1.5rem 5rem; }
.page-hero.hero-lg h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.08; letter-spacing: -0.01em; margin-bottom: 1.5rem; }
.page-hero.hero-lg .hero-eyebrow { margin-bottom: 2rem; font-size: 0.68rem; }
.page-hero.hero-lg .hero-eyebrow::before,
.page-hero.hero-lg .hero-eyebrow::after { width: 32px; }
.page-hero.hero-lg p { font-size: 0.95rem; margin-bottom: 2.5rem; }
.page-hero.hero-md .page-hero-inner { padding: 8rem 1.5rem 4rem; }
.page-hero.hero-md h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.1; margin-bottom: 1rem; }
.page-hero.hero-md .hero-eyebrow { margin-bottom: 1.25rem; }
.page-hero.hero-sm .page-hero-inner { padding: 1.75rem 1.5rem 1.5rem; }
.page-hero.hero-sm h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.page-hero.hero-sm .hero-eyebrow { margin-bottom: 0.4rem; }

@media (max-width: 428px) {
  .page-hero-inner { padding: 2.5rem 1rem 2rem; }
  .page-hero.hero-lg .page-hero-inner { padding: 7rem 1.25rem 3rem; }
  .page-hero.hero-md .page-hero-inner { padding: 7rem 1.25rem 3rem; }
  .page-hero.hero-sm .page-hero-inner { padding: 1.5rem 1rem 1.25rem; }
  .page-hero.hero-sm h1 { font-size: 1.35rem; }
}

/* ─── Primary button (visit / submit) ─── */
.btn {
  display: block;
  width: 100%;
  padding: 0.85rem;
  background: var(--deep-green);
  color: var(--cream);
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  text-align: center;
}
.btn:hover { background: var(--deep-green-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-link {
  display: inline-block;
  width: auto;
  padding: 0.85rem 2rem;
  text-decoration: none;
}

/* Button modifiers */
.btn-sm { display: inline-flex; align-items: center; justify-content: center; width: auto; padding: 0.5rem 1.25rem; font-size: 0.72rem; }
.btn-ghost { background: rgba(31, 67, 61, 0.08); color: var(--muted-light, #5C5C5C); text-transform: none; font-weight: 500; }
.btn-ghost:hover { background: rgba(31, 67, 61, 0.14); }
.btn-inline { display: inline-flex; align-items: center; width: auto; }

/* Button loading state */
.btn-loading { pointer-events: none; opacity: 0.7; color: transparent !important; position: relative; }
.btn-loading::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(237, 230, 214, 0.4); border-top-color: var(--cream, #EDE6D6); border-radius: 50%; animation: spin 0.7s linear infinite; top: 50%; left: 50%; margin: -8px 0 0 -8px; }
.btn-ghost.btn-loading::after { border-color: rgba(31, 67, 61, 0.15); border-top-color: var(--deep-green, #1F433D); }

/* ─── Bottom info block (visit / submit) ─── */
.bottom-text {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
}
.bottom-divider {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid rgba(31, 67, 61, 0.08);
}
.bottom-closing {
  margin-top: 0.875rem;
  font-size: 0.875rem;
  color: var(--deep-green);
  font-style: italic;
  font-family: var(--font-display);
}
.contact-strong {
  color: var(--deep-green);
  font-weight: 600;
}

/* ─── Footer ─── */
footer {
  background: var(--deep-green);
  padding: 1.5rem;
  text-align: center;
}
.footer-copy {
  font-size: 0.75rem;
  color: rgba(232, 224, 208, 0.35);
  font-family: var(--font-body);
}

/* ─── Empty state ─── */
.ts-empty {
  text-align: center;
  padding: 2rem 1.5rem;
}
.ts-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 0.75rem;
  color: var(--deep-green);
  opacity: 0.3;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ts-empty-icon svg { width: 100%; height: 100%; display: block; }
/* Safety net: any stray SVG directly inside .ts-empty (no icon wrapper) must
   still render at icon scale, not container width. */
.ts-empty svg { width: 56px; height: 56px; }
.ts-empty .ts-empty-icon svg { width: 100%; height: 100%; }
.ts-empty-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--deep-green);
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.ts-empty-desc {
  font-size: 0.82rem;
  color: var(--muted-light);
  line-height: 1.5;
}

/* ==========================================================================
   Toast + Modal notification system
   ========================================================================== */

/* ─── Toast container ─── */
#ts-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99999;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 380px;
  width: 100%;
}
.ts-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm, 8px);
  font-family: var(--font-body, 'Libre Franklin', sans-serif);
  font-size: 0.82rem;
  line-height: 1.5;
  box-shadow: var(--shadow, 0 2px 16px rgba(31, 67, 61, 0.08));
  opacity: 0;
  transform: translateX(1rem);
  transition: opacity 0.25s, transform 0.25s;
  border-left: 3px solid transparent;
}
.ts-toast-in { opacity: 1; transform: translateX(0); }
.ts-toast-out { opacity: 0; transform: translateX(1rem); }

.ts-toast-success { background: var(--cream, #EDE6D6); color: var(--deep-green, #1F433D); border-left-color: #4f8a5a; }
.ts-toast-error   { background: var(--cream, #EDE6D6); color: var(--deep-green, #1F433D); border-left-color: var(--orange, #E8913A); }
.ts-toast-info    { background: var(--cream, #EDE6D6); color: var(--deep-green, #1F433D); border-left-color: var(--deep-green, #1F433D); }

.ts-toast-msg { flex: 1; }
.ts-toast-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; line-height: 1; color: inherit; opacity: 0.4;
  padding: 0; flex-shrink: 0;
}
.ts-toast-close:hover { opacity: 0.8; }

/* ─── Modal overlay ─── */
.ts-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(31, 67, 61, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 99998;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 1rem;
}
.ts-modal-in  { opacity: 1; }
.ts-modal-out { opacity: 0; }

.ts-modal-card {
  background: var(--cream, #EDE6D6);
  border-radius: var(--radius, 14px);
  padding: 1.75rem 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-elevated, 0 8px 32px rgba(31, 67, 61, 0.12));
  font-family: var(--font-body, 'Libre Franklin', sans-serif);
}
.ts-modal-title {
  font-family: var(--font-display, 'Playfair Display', serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--deep-green, #1F433D);
  margin-bottom: 0.5rem;
}
.ts-modal-message {
  font-size: 0.85rem;
  color: var(--muted, #3D3D3D);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}
.ts-modal-input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(31, 67, 61, 0.15);
  border-radius: var(--radius-sm, 8px);
  font-family: var(--font-body, 'Libre Franklin', sans-serif);
  font-size: 0.85rem;
  color: var(--text, #1F1F1F);
  background: #fff;
  outline: none;
  margin-bottom: 1.25rem;
}
.ts-modal-input:focus { border-color: var(--deep-green, #1F433D); }
.ts-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.ts-modal-btn {
  font-family: var(--font-body, 'Libre Franklin', sans-serif);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.65rem 1.25rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  border: 1px solid transparent;
  min-height: 44px;
}
.ts-modal-cancel {
  background: rgba(31, 67, 61, 0.08);
  color: var(--muted-light, #5C5C5C);
}
.ts-modal-cancel:hover { background: rgba(31, 67, 61, 0.14); }
.ts-modal-confirm {
  background: var(--deep-green, #1F433D);
  color: var(--cream, #EDE6D6);
  border-color: var(--deep-green, #1F433D);
}
.ts-modal-confirm:hover { background: #172E2A; }

/* ─── Mobile toast + modal ─── */
@media (max-width: 428px) {
  #ts-toast-container {
    bottom: 0;
    right: 0;
    left: 0;
    max-width: 100%;
    padding: 0 0.5rem 0.75rem;
  }
  .ts-toast { transform: translateY(1rem); }
  .ts-toast-in { transform: translateY(0); }
  .ts-toast-out { transform: translateY(1rem); }
  .ts-modal-card { padding: 1.5rem 1.25rem; }
  .ts-modal-actions { flex-direction: column-reverse; }
  .ts-modal-btn { width: 100%; text-align: center; }
}
