/* Instrument Sans é auto-hospedada via @fontsource (importada em main.tsx),
   nos pesos 400 (Regular), 500 (Medium) e 600 (SemiBold). Os @font-face
   antigos apontavam para URLs do Lovable (/__l5e/...) que não existem fora
   do Lovable e por isso não carregavam neste deploy. */


html, body {
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Garante que containers de carrossel possam mostrar itens fora da área visível */
.overflow-visible {
  overflow: visible !important;
}

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 18% 38%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --success: 142 76% 36%;
    --success-foreground: 210 40% 98%;
    --border: 214.3 28% 86%;
    --input: 214.3 22% 74%;
    --ring: 222.2 84% 4.9%;
    --radius: 0.5rem;
    color-scheme: light;
    --add-leg: 197 75% 52%;
    --add-leg-foreground: 0 0% 100%;
    --simulator-box: 216 33% 25%;
    --sidebar-background: 0 0% 98%;
    --sidebar-foreground: 240 5.3% 26.1%;
    --sidebar-primary: 240 5.9% 10%;
    --sidebar-primary-foreground: 0 0% 98%;
    --sidebar-accent: 240 4.8% 95.9%;
    --sidebar-accent-foreground: 240 5.9% 10%;
    --sidebar-border: 220 13% 91%;
    --sidebar-ring: 217.2 91.2% 59.8%;

    /* Portal (educação) tokens — paleta do Research (a mesma do site optionsresearch.com.br).
       accent = destaque da marca no fundo claro (#0071AC); o ciano #82E5FF é o destaque no
       fundo escuro. Verde é cor de DADO (alta, ganho, linha da carteira): use portal-gain. */
    --portal-ink: 220 15% 10%;
    --portal-ink-mid: 220 13% 14%;
    --portal-ink-light: 220 12% 18%;
    --portal-accent: 201 100% 34%;
    --portal-accent-light: 201 70% 46%;
    --portal-gain: 159 66% 44%;
    --portal-paper: 0 0% 100%;
    --portal-paper-muted: 214 33% 96%;
    --portal-text: 222.2 84% 4.9%;
    --portal-text-muted: 215.4 18% 34%;
    --portal-success: 159 66% 44%;
  }

  /* Tema escuro da área logada = design system do site optionsresearch.com.br no escuro:
     fundo #091127 (pedido do Davi, um tom abaixo do #0B1530 do site), cartões/boxes #1A243D, barras #102043, texto #EEF2F8, apagado #9FAEC6, destaque ciano
     #82E5FF (botão ciano com texto marinho), perda #FF7A8C (o #C0263B some no marinho).
     Ligado pelo useApplyMembersTheme (classe `dark` no <html>). */
  .dark {
    --background: 224 63% 9%;
    --foreground: 216 47% 95%;
    --card: 223 40% 17%;
    --card-foreground: 216 47% 95%;
    --popover: 223 40% 17%;
    --popover-foreground: 216 47% 95%;
    --primary: 193 100% 75%;
    --primary-foreground: 224 63% 12%;
    --secondary: 223 53% 22%;
    --secondary-foreground: 216 47% 95%;
    --muted: 223 38% 22%;
    --muted-foreground: 217 25% 70%;
    --accent: 223 53% 22%;
    --accent-foreground: 216 47% 95%;
    --destructive: 352 100% 74%;
    --destructive-foreground: 224 63% 12%;
    --success: 159 66% 44%;
    --success-foreground: 224 63% 12%;
    --border: 222 45% 26%;
    --input: 222 40% 32%;
    --ring: 193 100% 75%;
    color-scheme: dark;
    --add-leg: 197 75% 52%;
    --add-leg-foreground: 0 0% 100%;
    --simulator-box: 216 33% 25%;
    --sidebar-background: 221 61% 16%;
    --sidebar-foreground: 216 47% 95%;
    --sidebar-primary: 193 100% 75%;
    --sidebar-primary-foreground: 224 63% 12%;
    --sidebar-accent: 223 53% 22%;
    --sidebar-accent-foreground: 216 47% 95%;
    --sidebar-border: 222 45% 26%;
    --sidebar-ring: 193 100% 75%;

    --portal-ink: 224 63% 9%;
    --portal-ink-mid: 221 61% 16%;
    --portal-ink-light: 223 53% 22%;
    --portal-accent: 193 100% 75%;
    --portal-accent-light: 193 100% 84%;
    --portal-gain: 159 66% 46%;
    --portal-paper: 223 40% 17%;
    --portal-paper-muted: 224 63% 9%;
    --portal-text: 216 47% 95%;
    --portal-text-muted: 217 25% 70%;
    --portal-success: 159 66% 46%;
  }
}

@layer base {
  * {
    @apply border-border;
    max-width: 100%;
  }

  body {
    @apply bg-background text-foreground font-sans;
  }

  html {
    scroll-behavior: smooth;
  }

  /* Custom scrollbar styles */
  .legs-table-container::-webkit-scrollbar {
    height: 8px;
  }

  .legs-table-container::-webkit-scrollbar-track {
    background: rgba(43, 60, 86, 0.5);
    border-radius: 4px;
  }

  .legs-table-container::-webkit-scrollbar-thumb {
    background: rgba(156, 176, 206, 0.5);
    border-radius: 4px;
  }

  .legs-table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 176, 206, 0.7);
  }

  /* Transparent number input arrows with white color */
  .number-input-transparent-arrows::-webkit-inner-spin-button,
  .number-input-transparent-arrows::-webkit-outer-spin-button {
    opacity: 1;
    background: transparent !important;
    cursor: pointer;
    width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
  }

  .number-input-transparent-arrows::-webkit-inner-spin-button:hover,
  .number-input-transparent-arrows::-webkit-outer-spin-button:hover {
    background: transparent !important;
  }

  .number-input-transparent-arrows {
    -moz-appearance: textfield;
  }

  /* Remove default styling from number input spin buttons */
  input[type="number"]::-webkit-inner-spin-button,
  input[type="number"]::-webkit-outer-spin-button {
    background: transparent !important;
  }
}

@layer utilities {
  .hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  .hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  }

  .scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }
}

/* Responsive font scaling */
@media (max-width: 640px) {
  html {
    font-size: 14px;
  }
}

@media (min-width: 1024px) {
  html {
    font-size: 16px;
  }
}

/* Improved scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: hsl(220 15% 15%);
}

::-webkit-scrollbar-thumb {
  background: hsl(220 15% 25%);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(220 15% 35%);
}

/* HubSpot Form Overrides */
.hs-form-frame form,
.hs-form-frame .hs-form {
  padding-top: 0 !important;
  margin-top: -24px;
}

/* Onboarding selection animation */
@keyframes onboarding-pulse {
  0% { transform: scale(1); opacity: 1; }
  30% { transform: scale(1.02); opacity: 0.7; }
  60% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════
   ÁREA LOGADA — Instrument Sans obrigatória
   Garante que NENHUMA outra fonte (Poppins, Inter, Georgia/serif)
   seja usada dentro da área de membros, independente de classes locais.
═══════════════════════════════════════ */
.members-area,
.members-area * {
  font-family: 'Instrument Sans', system-ui, sans-serif !important;
}

/* Exceção: título do banner do Research (painel do University), no estilo do site do
   Research — Noto Serif negrito, como as aberturas do site. */
.members-area .font-noto-research {
  font-family: 'Noto Serif JP', Georgia, serif !important;
}

/* ═══════════════════════════════════════
   PORTAL THEME (educação)
═══════════════════════════════════════ */
.portal-shell {
  background-color: hsl(var(--portal-paper-muted));
  color: hsl(var(--portal-text));
  font-family: 'Instrument Sans', system-ui, sans-serif;
}

.portal-shell .portal-sidebar {
  background-color: hsl(var(--portal-paper));
  border-right: 1px solid hsl(var(--border));
}

.portal-shell .portal-card {
  background-color: hsl(var(--portal-paper));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
}

.portal-shell .portal-topbar {
  background-color: hsl(var(--portal-paper) / 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border));
}

@keyframes portalFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.portal-page-enter {
  animation: portalFadeIn 0.3s ease;
}

/* ═══════════════════════════════════════
   REPORT PROSE (html_reports rendered content)
═══════════════════════════════════════ */
.report-prose {
  color: hsl(var(--foreground));
  font-size: 1.0625rem;
  line-height: 1.5;
}
.report-prose h1 { font-size: 2rem; font-weight: 700; margin: 2rem 0 1rem; line-height: 1.2; }
.report-prose h2 { font-size: 1.5rem; font-weight: 700; margin: 1.75rem 0 0.75rem; line-height: 1.3; }
.report-prose h3 { font-size: 1.25rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.report-prose p { margin: 0.4rem 0; }
.report-prose ul, .report-prose ol { margin: 0.4rem 0; padding-left: 1.5rem; }
.report-prose ul { list-style: disc; }
.report-prose ol { list-style: decimal; }
.report-prose li { margin: 0.25rem 0; }
.report-prose p:empty { display: none; }
.report-prose p:has(> br:only-child) { margin: 0; line-height: 0.6; }
.report-prose a { color: hsl(var(--primary)); text-decoration: underline; text-underline-offset: 2px; }
.report-prose blockquote {
  border-left: 4px solid hsl(var(--primary));
  padding: 0.25rem 0 0.25rem 1rem;
  margin: 1rem 0;
  color: hsl(var(--muted-foreground));
  font-style: italic;
}
.report-prose pre {
  background: hsl(var(--muted));
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-size: 0.875rem;
}
.report-prose code {
  background: hsl(var(--muted));
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}
.report-prose pre code { background: transparent; padding: 0; }
.report-prose img { max-width: 100%; height: auto; border-radius: 0.5rem; margin: 1rem 0; }
.report-prose hr { border: 0; border-top: 1px solid hsl(var(--border)); margin: 2rem 0; }
.report-prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9375rem; }
.report-prose th, .report-prose td { border: 1px solid hsl(var(--border)); padding: 0.5rem 0.75rem; text-align: left; }
.report-prose th { background: hsl(var(--muted)); font-weight: 600; }

/* ═══════════════════════════════════════
   TEMA ESCURO — cores fixas de tema claro usadas na área logada
   (fundos brancos, selos claros, textos escuros). Fora de @layer para vencer os utilitários.
═══════════════════════════════════════ */
.dark .bg-white, .dark .hover\:bg-white:hover { background-color: hsl(var(--card)); }
/* #f5f5f5 é o fundo das páginas no claro: no escuro vira o fundo #0B1530, não a cor dos boxes. */
.dark .bg-\[\#f5f5f5\] { background-color: hsl(var(--background)); }
.dark .bg-gray-50, .dark .bg-gray-100 { background-color: hsl(var(--muted)); }
.dark .text-gray-900, .dark .text-gray-800, .dark .text-gray-700, .dark .text-\[\#12213F\] { color: hsl(var(--foreground)); }
.dark .text-gray-600, .dark .text-gray-500 { color: hsl(var(--muted-foreground)); }
/* Destaque: azul do claro (#0071AC) vira o ciano do escuro; botão em destaque com texto marinho. */
.dark .text-\[\#0071AC\] { color: #82E5FF; }
.dark .bg-portal-accent.text-white, .dark .bg-portal-accent .text-white { color: #0B1530; }
/* Selos e fundos claros viram translúcidos sobre o marinho. */
.dark .bg-sky-50, .dark .bg-sky-100, .dark .bg-blue-50 { background-color: rgba(130, 229, 255, 0.12); }
.dark .ring-sky-200, .dark .border-sky-200 { --tw-ring-color: rgba(130, 229, 255, 0.3); border-color: rgba(130, 229, 255, 0.3); }
.dark .bg-rose-50, .dark .bg-rose-100, .dark .bg-red-50 { background-color: rgba(255, 122, 140, 0.12); }
.dark .ring-rose-200, .dark .border-red-200 { --tw-ring-color: rgba(255, 122, 140, 0.3); border-color: rgba(255, 122, 140, 0.3); }
.dark .bg-emerald-50 { background-color: rgba(38, 186, 134, 0.14); }
.dark .bg-amber-50, .dark .bg-amber-100 { background-color: rgba(251, 191, 36, 0.12); }
.dark .bg-purple-50, .dark .bg-indigo-50 { background-color: rgba(167, 139, 250, 0.14); }
/* Positivo e negativo legíveis no escuro: verde #26BA86 e rosa #FF7A8C. */
.dark .text-rose-700, .dark .text-rose-600, .dark .text-red-700, .dark .text-red-600 { color: #FF7A8C; }
.dark .text-emerald-700, .dark .text-emerald-600 { color: #3DD6A0; }
.dark .text-blue-700, .dark .text-indigo-700, .dark .text-purple-700 { color: #A9C8FF; }
.dark .text-amber-700, .dark .text-amber-800, .dark .text-yellow-700 { color: #FBBF24; }
/* Tooltip dos gráficos (o recharts põe fundo branco inline). */
.dark .recharts-default-tooltip { background-color: hsl(var(--popover)) !important; border-color: hsl(var(--border)) !important; color: hsl(var(--foreground)); }
