/* =======================================================================
   Design tokens unificados — TeleConsultaPro
   =======================================================================

   Fonte da verdade: o app do médico (ui/app.css). O admin (ui/platform-admin.css)
   e os fluxos públicos consomem estas variáveis para garantir uma única
   identidade visual em toda a plataforma.

   Convenções:
   - Cores e tipografia espelham o app clínico (cabeçalho horizontal com tabs).
   - Espaçamentos seguem múltiplos de 4 px.
   - Tudo aqui é light-mode por padrão; dark-mode é tratado nas folhas
     consumidoras (data-theme="dark") usando os mesmos *nomes* de tokens.
   ======================================================================= */

:root {
  /* -------- Marca / superfícies (espelho do app médico) ------------- */
  --tcp-panel: #ffffff;
  --tcp-surface: #fbfaf8;
  --tcp-surface-strong: #f8f6f0;
  --tcp-bg-gradient: linear-gradient(180deg, #fbfaf8 0%, #f8f6f0 100%);

  --tcp-ink: #2e4827;
  --tcp-ink-strong: #20331c;
  --tcp-muted: #789a70;
  --tcp-line: #e1ebdb;
  --tcp-line-soft: #ebf2e7;

  --tcp-accent: #629b53;
  --tcp-accent-strong: #4d7b42;
  --tcp-accent-hover: #588b4b;
  --tcp-accent-soft: #f9f8f4;
  --tcp-accent-soft-2: #f8f6f1;
  --tcp-accent-ink: #406537;

  --tcp-shadow-card: 0 18px 42px rgba(68, 108, 58, 0.08);
  --tcp-shadow-popover: 0 24px 60px rgba(33, 53, 28, 0.18);
  --tcp-shadow-topbar: 0 1px 0 rgba(224, 234, 217, 0.85);

  /* -------- Estados semânticos (alinhados ao app médico) ------------ */
  --tcp-success: #0f8a74;
  --tcp-success-soft: #e3f6f0;
  --tcp-warning: #a86c08;
  --tcp-warning-soft: #fdf2dd;
  --tcp-danger: #b42318;
  --tcp-danger-soft: #fdecea;
  --tcp-info: #5f9751;
  --tcp-info-soft: #f7f5ef;
  --tcp-violet: #548547;
  --tcp-violet-soft: #f6f5ee;

  /* -------- Tipografia (Segoe UI stack do app médico) --------------- */
  --tcp-font-sans:
    "Segoe UI", Tahoma, Geneva, Verdana, "Helvetica Neue", Arial, sans-serif;

  --tcp-text-xs: 11px;
  --tcp-text-sm: 12px;
  --tcp-text-base: 13px;
  --tcp-text-md: 14px;
  --tcp-text-lg: 16px;
  --tcp-text-xl: 18px;
  --tcp-text-2xl: 22px;
  --tcp-text-3xl: 28px;
  --tcp-text-4xl: 36px;

  --tcp-leading-tight: 1.25;
  --tcp-leading-normal: 1.5;
  --tcp-leading-relaxed: 1.65;

  --tcp-weight-regular: 400;
  --tcp-weight-medium: 500;
  --tcp-weight-semibold: 600;
  --tcp-weight-bold: 700;

  /* -------- Geometria ---------------------------------------------- */
  --tcp-radius-xs: 3px;
  --tcp-radius-sm: 6px;
  --tcp-radius-md: 8px;
  --tcp-radius-lg: 14px;
  --tcp-radius-xl: 18px;
  --tcp-radius-2xl: 26px;
  --tcp-radius-pill: 999px;

  /* -------- Layout da chrome (topbar) ------------------------------ */
  --tcp-topbar-height: 56px;
  --tcp-topbar-bg: rgba(255, 255, 255, 0.995);
  --tcp-topbar-border: #e0ead9;
  --tcp-topbar-brand-col: 300px;
  --tcp-shell-max-width: 1540px;
  --tcp-shell-inline-padding: 12px;

  /* -------- Motion -------------------------------------------------- */
  --tcp-duration-fast: 120ms;
  --tcp-duration-normal: 200ms;
  --tcp-duration-slow: 320ms;
  --tcp-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --tcp-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* -------- Espaçamento (múltiplos de 4) --------------------------- */
  --tcp-space-1: 4px;
  --tcp-space-2: 8px;
  --tcp-space-3: 12px;
  --tcp-space-4: 16px;
  --tcp-space-5: 20px;
  --tcp-space-6: 24px;
  --tcp-space-7: 32px;
  --tcp-space-8: 40px;
  --tcp-space-9: 48px;
  --tcp-space-10: 64px;

  /* -------- Aliases retrocompatíveis com o app médico --------------
     Mantém o ui/app.css funcionando sem reescrever todos os seletores.
     Se você mudar a marca, mude apenas os tokens --tcp-* acima. */
  --panel: var(--tcp-panel);
  --text: var(--tcp-ink);
  --muted: var(--tcp-muted);
  --line: var(--tcp-line);
  --accent: var(--tcp-accent);
  --accent-strong: var(--tcp-accent-strong);
  --accent-soft: var(--tcp-accent-soft);
  --shadow: var(--tcp-shadow-card);
}

/* =======================================================================
   Dark mode unificado
   ======================================================================= */

[data-theme="dark"] {
  --tcp-panel: #182216;
  --tcp-surface: #0f170d;
  --tcp-surface-strong: #131d11;
  --tcp-bg-gradient: linear-gradient(180deg, #0f170d 0%, #0f170d 100%);

  --tcp-ink: #ebf2e7;
  --tcp-ink-strong: #faf9f6;
  --tcp-muted: #91a88b;
  --tcp-line: #2e3d2a;
  --tcp-line-soft: #222f1f;

  --tcp-accent: #8fbd84;
  --tcp-accent-strong: #72ab64;
  --tcp-accent-hover: #aacda1;
  --tcp-accent-soft: rgba(143, 189, 132, 0.16);
  --tcp-accent-soft-2: rgba(143, 189, 132, 0.10);
  --tcp-accent-ink: #d8e5d0;

  --tcp-shadow-card: 0 18px 42px rgba(0, 0, 0, 0.35);
  --tcp-shadow-popover: 0 24px 60px rgba(0, 0, 0, 0.55);
  --tcp-topbar-bg: rgba(24, 34, 22, 0.96);
  --tcp-topbar-border: #2e3d2a;

  --tcp-success: #3fb18a;
  --tcp-success-soft: rgba(63, 177, 138, 0.16);
  --tcp-warning: #d99a26;
  --tcp-warning-soft: rgba(217, 154, 38, 0.18);
  --tcp-danger: #e5605a;
  --tcp-danger-soft: rgba(229, 96, 90, 0.16);
  --tcp-info: #8fbd84;
  --tcp-info-soft: rgba(143, 189, 132, 0.16);
}

/* =======================================================================
   Utilitário: reduced motion (respeita preferência do SO).
   ======================================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
