/* 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 */
    --portal-ink: 220 15% 10%;
    --portal-ink-mid: 220 13% 14%;
    --portal-ink-light: 220 12% 18%;
    --portal-accent: 159 66% 44%;
    --portal-accent-light: 159 55% 54%;
    --portal-paper: 0 0% 100%;
    --portal-paper-muted: 220 14% 96%;
    --portal-text: 222.2 84% 4.9%;
    --portal-text-muted: 215.4 18% 34%;
    --portal-success: 159 66% 44%;
  }

  .dark {
    --background: 220 35% 8%;
    --foreground: 210 40% 98%;
    --card: 220 33% 12%;
    --card-foreground: 210 40% 98%;
    --popover: 220 33% 12%;
    --popover-foreground: 210 40% 98%;
    --primary: 195 100% 50%;
    --primary-foreground: 220 26% 7%;
    --secondary: 220 26% 16%;
    --secondary-foreground: 210 40% 98%;
    --muted: 220 26% 16%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 220 26% 16%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --success: 142 76% 36%;
    --success-foreground: 210 40% 98%;
    --border: 221 16% 20%;
    --input: 221 16% 20%;
    --ring: 195 100% 50%;
    --add-leg: 197 75% 52%;
    --add-leg-foreground: 0 0% 100%;
    --simulator-box: 216 33% 25%;
    --sidebar-background: 220 35% 12%;
    --sidebar-foreground: 210 40% 98%;
    --sidebar-primary: 195 100% 50%;
    --sidebar-primary-foreground: 220 26% 7%;
    --sidebar-accent: 220 32% 18%;
    --sidebar-accent-foreground: 210 40% 98%;
    --sidebar-border: 222 15% 20%;
    --sidebar-ring: 195 100% 50%;
  }
}

@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;
}

/* ═══════════════════════════════════════
   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; }

