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

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 240 10% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 240 10% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 240 10% 3.9%;
    --primary: 240 5.9% 10%;
    --primary-foreground: 0 0% 98%;
    --secondary: 240 4.8% 95.9%;
    --secondary-foreground: 240 5.9% 10%;
    --muted: 240 4.8% 95.9%;
    --muted-foreground: 240 3.8% 46.1%;
    --accent: 240 4.8% 95.9%;
    --accent-foreground: 240 5.9% 10%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 240 5.9% 90%;
    --input: 240 5.9% 90%;
    --ring: 240 5.9% 64.9%;
    --radius: 0.5rem;
    --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: 240 5.9% 10%;

    /* Acento de marca (white-label por ambiente) — default laranja Exent #FF4D00.
       Sobrescrito por ambiente via <style> injetado no app.blade.php. */
    --brand: 18 100% 50%;

    /* Funil — paleta brand mono (laranja shadcn) */
    --chart-brand: 24 95% 65%;
    --chart-brand-deep: 20 85% 42%;
    --chart-brand-accent: 20 90% 48%;
  }

  .dark {
    --background: 0 0% 3.9%;
    --foreground: 0 0% 98%;
    --card: 0 0% 5.9%;
    --card-foreground: 0 0% 98%;
    --popover: 0 0% 5.9%;
    --popover-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 0 0% 3.9%;
    --secondary: 0 0% 10%;
    --secondary-foreground: 0 0% 98%;
    --muted: 0 0% 10%;
    --muted-foreground: 0 0% 55%;
    --accent: 0 0% 10%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 0% 98%;
    --border: 0 0% 14%;
    --input: 0 0% 14%;
    --ring: 217 91% 60%;
    --sidebar-background: 0 0% 5.9%;
    --sidebar-foreground: 0 0% 95%;
    --sidebar-primary: 217 91% 60%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 217 33% 17%;
    --sidebar-accent-foreground: 0 0% 98%;
    --sidebar-border: 0 0% 14%;
    --sidebar-ring: 217 91% 60%;

    /* Funil — paleta brand mono (laranja shadcn) — dark */
    --chart-brand: 28 95% 62%;
    --chart-brand-deep: 18 80% 38%;
    --chart-brand-accent: 22 92% 58%;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
  }
  /* Previne zoom automático do iOS Safari em inputs com font-size < 16px */
  @media (max-width: 768px) {
    input, select, textarea {
      font-size: 16px;
    }
  }
}

/* ── Custom scrollbar ──────────────────────────────────────── */
@layer components {
  /* Thin, rounded scrollbar that respects light/dark theme */
  *::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  *::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 9999px;
  }
  *::-webkit-scrollbar-thumb {
    background: hsl(var(--muted-foreground) / 0.25);
    border-radius: 9999px;
    transition: background 0.2s;
  }
  *::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / 0.45);
  }
  *::-webkit-scrollbar-corner {
    background: transparent;
  }

  /* Firefox */
  * {
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--muted-foreground) / 0.25) transparent;
  }
}

/* Flip card animation for template preview */
.flip-container {
  perspective: 1200px;
}
.flip-inner {
  position: relative;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}
.flip-inner.flipped {
  transform: rotateY(180deg);
}
.flip-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flip-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateY(180deg);
  position: absolute;
  inset: 0;
  overflow: hidden;
}
