/* ==========================================================================
   Echo Brand System — Shared CSS
   Single source of truth for all non-React pages.
   Matches the React landing page design system (Manrope + Inter, echo-blue palette).
   ========================================================================== */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Primary */
  --color-primary: #2563EB;
  --color-primary-dark: #1D4ED8;
  --color-primary-darker: #1E40AF;
  --color-primary-light: #EFF6FF;
  --color-primary-tint: #F0F5FF;

  /* Dark palette (hero, headers) */
  --color-dark: #0A0F1E;
  --color-dark-mid: #0F172A;
  --color-dark-secondary: #111827;
  --color-dark-text: #F9FAFB;
  --color-dark-muted: #9CA3AF;

  /* Text */
  --color-text: #111827;
  --color-text-secondary: #374151;
  --color-text-muted: #6B7280;

  /* Surfaces */
  --color-bg: #F3F4F6;
  --color-surface: #FFFFFF;
  --color-border: #E5E7EB;

  /* Status — use ONLY for status indicators */
  --color-success: #22C55E;
  --color-success-bg: #f0fdf4;
  --color-success-border: #bbf7d0;
  --color-danger: #EF4444;
  --color-danger-bg: #fef2f2;
  --color-danger-border: #fecaca;
  --color-warning: #F59E0B;
  --color-warning-bg: #fff7ed;
  --color-warning-border: #fed7aa;
  --color-info-bg: #eef2ff;
  --color-info-border: #c7d2fe;
  --color-info-text: #1e3a8a;

  /* Typography */
  --font-heading: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing & Layout */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --max-width: 1160px;
  --max-width-narrow: 980px;
  --section-padding: 80px 0;
  --card-padding: 24px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.2;
  color: var(--color-text);
}

h1 {
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

h2 {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

h3 {
  font-weight: 600;
  font-size: 1.125rem;
}

h4 {
  font-weight: 600;
  font-size: 1rem;
}

p {
  color: var(--color-text);
  line-height: 1.7;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-primary-dark);
}

ul, ol {
  padding-left: 20px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.9em;
}

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.container-narrow {
  max-width: var(--max-width-narrow);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.section-padding {
  padding: var(--section-padding);
}

/* --- Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-primary);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  text-align: center;
  line-height: 1.5;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--color-text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary--full {
  width: 100%;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--color-primary);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 2px solid var(--color-primary);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  text-align: center;
  line-height: 1.5;
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: #FFFFFF;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-ghost:hover {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.04);
}

/* --- Cards --- */
.echo-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--card-padding);
  transition: box-shadow 0.3s, transform 0.3s;
}

.echo-card:hover {
  box-shadow: var(--shadow-md);
}

.echo-card--interactive:hover {
  transform: translateY(-2px);
}

/* --- Forms --- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.5;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input.error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

/* Select inputs */
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* --- Alerts / Notices --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.alert--error {
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: #DC2626;
}

.alert--success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: #059669;
}

.alert--warning {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: #9A3412;
}

.alert--info {
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  color: var(--color-info-text);
}

/* --- Logo lockup --- */
.echo-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.echo-logo-icon {
  height: 44px;
  width: 44px;
  flex-shrink: 0;
  display: block;
}

.echo-logo-wordmark {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  color: var(--color-text);
  line-height: 1;
}

/* White variant — for dark/colored backgrounds, inverts the blue SVG to white */
.echo-logo--white .echo-logo-icon {
  filter: brightness(0) invert(1);
}

.echo-logo--white .echo-logo-wordmark {
  color: #ffffff;
}

/* Large variant — for auth pages */
.echo-logo--lg .echo-logo-icon {
  height: 52px;
  width: 52px;
}

.echo-logo--lg .echo-logo-wordmark {
  font-size: 2rem;
}

/* --- Auth Layout (login, business-auth) --- */
.auth-page {
  background: var(--color-dark);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Subtle radial glow behind auth card */
.auth-page::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, rgba(37, 99, 235, 0.03) 50%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header .auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.auth-header .auth-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--color-primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-family: var(--font-heading);
  font-size: 1.25rem;
}

.auth-header .auth-logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.75rem;
  color: var(--color-text);
}

.auth-header p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.auth-footer {
  text-align: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.auth-footer a {
  font-weight: 500;
}

.auth-divider {
  text-align: center;
  margin: 20px 0;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: echo-spin 0.8s linear infinite;
}

.spinner--lg {
  width: 30px;
  height: 30px;
  border-width: 3px;
}

@keyframes echo-spin {
  to { transform: rotate(360deg); }
}

.loading-state {
  display: none;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  padding: 12px 0;
}

.loading-state .spinner {
  margin-right: 8px;
  vertical-align: middle;
}

/* --- Page Header (legal pages, content pages) --- */
.page-header {
  background: var(--color-dark);
  color: var(--color-dark-text);
  padding-bottom: 0;
}

.page-header-nav {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
}

.page-header-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--color-dark-text);
}

.page-header-brand:hover {
  color: var(--color-dark-text);
}

.page-header-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(37, 99, 235, 0.2);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-family: var(--font-heading);
  font-size: 1rem;
  color: #fff;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.page-header-brand-name {
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: 0.2px;
  font-size: 1.1rem;
}

.page-header-nav a {
  color: var(--color-dark-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.page-header-nav a:hover {
  color: var(--color-dark-text);
}

.page-header-hero {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 20px 24px 40px 24px;
}

.page-header-hero h1 {
  color: var(--color-dark-text);
  margin: 0 0 8px 0;
  font-size: 2rem;
}

.page-header-hero p {
  color: var(--color-dark-muted);
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 640px;
}

/* Subtle gradient bottom edge on header */
.page-header::after {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(to right, var(--color-primary), var(--color-primary-dark));
}

/* --- Content Card (legal pages main body) --- */
.content-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.content-card section {
  margin-bottom: 8px;
}

.content-card h2 {
  margin: 32px 0 12px 0;
  padding-top: 16px;
}

.content-card h3 {
  margin: 24px 0 8px 0;
}

.content-card p {
  margin-bottom: 12px;
}

.content-card ul, .content-card ol {
  margin-bottom: 12px;
}

.content-card li {
  margin-bottom: 6px;
  line-height: 1.7;
}

/* --- Table of Contents --- */
.toc {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 24px 0;
}

.toc a {
  display: block;
  background: var(--color-primary-light);
  border: 1px solid rgba(37, 99, 235, 0.1);
  padding: 10px 14px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-primary);
  font-weight: 500;
  font-size: 0.875rem;
  transition: background 0.2s, border-color 0.2s;
}

.toc a:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.2);
  color: var(--color-primary-dark);
}

/* --- Notice boxes --- */
.notice {
  padding: 14px 16px;
  border-radius: var(--radius);
  margin: 16px 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.notice--info {
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  color: var(--color-info-text);
}

.notice--warning {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: #9A3412;
}

.notice--success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: #065f46;
}

/* --- Chips / Badges --- */
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--color-primary-light);
  color: var(--color-primary-darker);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.chip--success {
  background: var(--color-success-bg);
  color: #065f46;
}

.chip--warning {
  background: var(--color-warning-bg);
  color: #9A3412;
}

/* --- Flow diagram (sms-consent) --- */
.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0;
}

.flow-step {
  flex: 1 1 140px;
  min-width: 130px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.4;
}

.flow-step .icon {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 4px;
}

.flow-arrow {
  flex: 0 0 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 1.1rem;
}

/* --- Page Footer --- */
.page-footer {
  margin: 48px 0 0 0;
  padding: 24px 0;
  border-top: 1px solid var(--color-border);
}

.page-footer-inner {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 24px;
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.page-footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.page-footer-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s;
  font-size: 0.8rem;
}

.page-footer-links a:hover {
  color: var(--color-primary);
}

/* --- Utility: Text --- */
.text-muted {
  color: var(--color-text-muted);
}

.text-center {
  text-align: center;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

/* --- Utility: Spacing --- */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

/* --- Utility: Display --- */
.hidden { display: none; }

/* --- Status indicators --- */
.status-success { color: var(--color-success); }
.status-danger { color: var(--color-danger); }

/* ==========================================================================
   RESPONSIVE
   Mobile-first approach — base styles are mobile, then scale up.
   ========================================================================== */

@media (min-width: 480px) {
  h1 {
    font-size: 2.25rem;
  }

  .auth-card {
    padding: 48px;
  }

  .page-header-hero h1 {
    font-size: 2.25rem;
  }
}

@media (min-width: 720px) {
  h1 {
    font-size: 2.5rem;
  }

  .toc {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-card {
    padding: 40px;
  }

  .page-header-hero h1 {
    font-size: 2.5rem;
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: 3rem;
  }
}

/* Mobile tweaks */
@media (max-width: 720px) {
  .flow-arrow {
    flex-basis: 100%;
    transform: rotate(90deg);
  }

  .page-header-nav {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .page-footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 20px;
  }

  .content-card {
    padding: 20px;
  }

  .page-header-hero {
    padding: 16px 20px 28px 20px;
  }
}
