/*
 * FlowConversas Theme — Dark SaaS Premium v2
 * Baseado em Flow Design Kit (flow-design-kit.tar.gz, 2026-04-15)
 * Estratégia: redefinir CSS variables nativas do Chatwoot (slate/gray/blue/iris)
 * + adicionar mesh gradient, noise overlay, tipografia Inter e utility classes.
 *
 * Para reverter: comentar o <link> em app/views/layouts/vueapp.html.erb
 * Backup do tema anterior: /public/flowconversas-theme.css.backup-20260415
 *
 * Tokens canônicos (do kit):
 *   bg-root    #0a0a0f  (10 10 15)    — fundo raiz
 *   bg-sidebar #0b0b14  (11 11 20)
 *   bg-panel   #0f0f18  (15 15 24)
 *   bg-surface #141420  (20 20 32)    — cards, inputs
 *   bg-elev    #1c1c2a  (28 28 42)    — hover
 *   purple     #8b5cf6  (139 92 246)  — accent
 *   purple-h   #7c3aed  (124 58 237)  — hover
 *   text-pri   #f4f4f8  (244 244 248) — cold white
 *   text-sec   #a3a3b2  (163 163 178)
 *   text-mut   #6e6e7e  (110 110 126)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

/* ═══════════════════════════════════════════════════
   CHATWOOT DESIGN TOKENS (redefinidos para dark premium)
   Aplica tanto no modo claro quanto no dark — força premium dark
   ═══════════════════════════════════════════════════ */

body,
body.dark,
body:not(.dark) {
  color-scheme: dark;

  /* --- Slate (text + surfaces) --- */
  --slate-1:  10 10 15;
  --slate-2:  11 11 20;
  --slate-3:  15 15 24;
  --slate-4:  20 20 32;
  --slate-5:  28 28 42;
  --slate-6:  36 36 52;
  --slate-7:  52 52 70;
  --slate-8:  80 80 100;
  --slate-9:  110 110 126;
  --slate-10: 140 140 160;
  --slate-11: 163 163 178;
  --slate-12: 244 244 248;

  /* --- Gray (Chatwoot usa como fallback) --- */
  --gray-1:  10 10 15;
  --gray-2:  11 11 20;
  --gray-3:  15 15 24;
  --gray-4:  20 20 32;
  --gray-5:  28 28 42;
  --gray-6:  36 36 52;
  --gray-7:  52 52 70;
  --gray-8:  80 80 100;
  --gray-9:  110 110 126;
  --gray-10: 140 140 160;
  --gray-11: 163 163 178;
  --gray-12: 244 244 248;

  /* --- Blue = accent roxo (Chatwoot usa --blue-9 como brand) --- */
  --blue-1:  16 12 28;
  --blue-2:  22 16 38;
  --blue-3:  34 22 62;
  --blue-4:  48 28 88;
  --blue-5:  62 36 112;
  --blue-6:  78 46 138;
  --blue-7:  96 60 168;
  --blue-8:  116 74 200;
  --blue-9:  139 92 246;   /* #8b5cf6 — purple accent */
  --blue-10: 124 58 237;   /* #7c3aed — hover */
  --blue-11: 175 140 255;  /* link text / light accent */
  --blue-12: 235 222 255;

  /* --- Iris (Radix alias roxo) --- */
  --iris-1:  16 12 28;
  --iris-2:  22 16 38;
  --iris-3:  34 22 62;
  --iris-4:  48 28 88;
  --iris-5:  62 36 112;
  --iris-6:  78 46 138;
  --iris-7:  96 60 168;
  --iris-8:  116 74 200;
  --iris-9:  109 40 217;
  --iris-10: 139 92 246;
  --iris-11: 175 140 255;
  --iris-12: 235 222 255;

  /* --- Background e solids --- */
  --background-color: 10 10 15;
  --solid-1: 11 11 20;
  --solid-2: 20 20 32;
  --solid-3: 28 28 42;
  --solid-active: 36 36 52;
  --solid-blue: 48 28 88;
  --solid-iris: 48 28 88;
  --solid-amber: 42 37 30;

  /* --- Borders (matiz violeta sutil) --- */
  --border-container: 50 42 75;
  --border-strong: 62 52 88;
  --border-weak: 36 30 58;
  --border-blue: 139, 92, 246, 0.5;
  --text-blue: 175 140 255;

  /* --- Alphas --- */
  --alpha-1: 80, 60, 130, 0.2;
  --alpha-2: 130, 110, 180, 0.18;
  --alpha-3: 10, 10, 15, 0.95;
  --black-alpha-1: 0, 0, 0, 0.4;
  --black-alpha-2: 0, 0, 0, 0.25;
  --white-alpha: 255, 255, 255, 0.06;

  /* --- Design kit tokens (pro uso direto via var()) --- */
  --bg-root: #0a0a0f;
  --bg-deep: #060610;
  --bg-sidebar: #0b0b14;
  --bg-panel: #0f0f18;
  --bg-surface: #141420;
  --bg-elevated: #1c1c2a;

  --purple: #8b5cf6;
  --purple-hover: #7c3aed;
  --purple-dark: #6d28d9;
  --purple-glow: rgba(139, 92, 246, 0.15);

  --text-primary: #f4f4f8;
  --text-secondary: #a3a3b2;
  --text-muted: #6e6e7e;
  --text-dim: #3d3d4a;

  --shadow-card: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-elevated: 0 4px 16px rgba(0,0,0,.4);
  --shadow-panel: 0 24px 48px rgba(0,0,0,.5);
  --shadow-glow: 0 0 30px rgba(139,92,246,.15);

  --font-base: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
}

/* ═══════════════════════════════════════════════════
   BODY — background, fonte, mesh gradient, noise
   ═══════════════════════════════════════════════════ */

body {
  background-color: #0a0a0f !important;
  color: rgb(var(--slate-12)) !important;
  font-family: var(--font-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

#app {
  background-color: transparent !important;
  position: relative;
  z-index: 1;
}

/* Mesh gradient ambiente — 3 radial-gradients assimétricos roxos.
   pointer-events:none garante que NÃO bloqueia clicks em nada.
   z-index:0 fica atrás de #app (z:1). */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 20% 15%, rgba(139, 92, 246, 0.13) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 25%, rgba(99, 102, 241, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 50% 110%, rgba(139, 92, 246, 0.08) 0%, transparent 65%);
  animation: fc-mesh-float 24s ease-in-out infinite;
}

@keyframes fc-mesh-float {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(1.5%, -1%); }
}

/* Mobile: desativa animação pra evitar jank */
@media (max-width: 768px) {
  body::after { animation: none; }
}

/* Noise overlay 2% — textura premium sem pesar.
   z-index alto mas pointer-events:none; */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
}

/* ═══════════════════════════════════════════════════
   SCROLLBARS — finas, matiz violeta
   ═══════════════════════════════════════════════════ */

* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.08) transparent; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.35);
}

/* ═══════════════════════════════════════════════════
   SELECTION
   ═══════════════════════════════════════════════════ */

::selection {
  background: rgba(139, 92, 246, 0.35);
  color: #f4f4f8;
}

/* ═══════════════════════════════════════════════════
   TARGETED OVERRIDES (Chatwoot Tailwind — conscientes)
   Evita tocar em visibility/display/width/height.
   ═══════════════════════════════════════════════════ */

/* Fundos hardcoded em branco → surface roxo escuro */
.bg-white {
  background-color: #141420 !important;
}

/* Conversation ativa */
.conversation.active {
  background-color: rgba(139, 92, 246, 0.08) !important;
}

/* Chat bubbles */
.agent .chat-bubble--agent {
  background-color: #1c1c2a !important;
  color: #f4f4f8 !important;
}
.customer .chat-bubble--customer {
  background-color: rgba(139, 92, 246, 0.15) !important;
  color: #f4f4f8 !important;
  border: 1px solid rgba(139, 92, 246, 0.25) !important;
}

/* Modal backdrop mais premium */
.modal-mask {
  background-color: rgba(6, 6, 16, 0.85) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ═══════════════════════════════════════════════════
   UTILITY CLASSES (do kit) — CSS puro, opt-in via classe
   Use onde quiser sem afetar elementos existentes
   ═══════════════════════════════════════════════════ */

/* Glassmorphism — card premium */
.glass,
.glass-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.glass-card {
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color .3s ease-out, box-shadow .3s ease-out;
}
.glass-card:hover {
  border-color: rgba(139, 92, 246, 0.2);
  box-shadow: var(--shadow-elevated);
}

/* Text gradient (headings de destaque) */
.text-gradient {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* Text shimmer — sweep roxo a cada 3s */
.text-shimmer {
  background: linear-gradient(
    110deg,
    #f4f4f8 0%,
    #f4f4f8 40%,
    rgba(139, 92, 246, 0.8) 50%,
    #f4f4f8 60%,
    #f4f4f8 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: fc-shimmer 3s ease-in-out infinite;
}
@keyframes fc-shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* Glows */
.glow-purple  { box-shadow: 0 0 60px rgba(139, 92, 246, 0.15); }
.glow-success { box-shadow: 0 0 30px rgba(52, 211, 153, 0.15); }
.glow-warning { box-shadow: 0 0 30px rgba(251, 191, 36, 0.15); }
.glow-danger  { box-shadow: 0 0 30px rgba(248, 113, 113, 0.15); }

/* Badge pill roxo */
.badge-purple {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
  border-radius: 9999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}

/* Headings */
.heading-xl {
  font-size: 48px; font-weight: 700; letter-spacing: -2px;
  line-height: 1.1; color: #f4f4f8;
}
.heading-lg {
  font-size: 32px; font-weight: 700; letter-spacing: -1.5px;
  line-height: 1.15; color: #f4f4f8;
}
.heading-md {
  font-size: 24px; font-weight: 600; letter-spacing: -1px;
  line-height: 1.2; color: #f4f4f8;
}

/* Stat number */
.stat-number {
  font-size: 36px; font-weight: 700; letter-spacing: -2px; color: #f4f4f8;
}

/* Icon container */
.icon-container {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

/* Primary / Secondary button (opt-in) */
.btn-primary {
  background: #8b5cf6;
  color: #fff;
  border: none;
  border-radius: 9999px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease-out;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}
.btn-primary:hover {
  background: #7c3aed;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
  transform: translateY(-1px);
}
.btn-secondary {
  background: transparent;
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 9999px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease-out;
}
.btn-secondary:hover {
  background: rgba(139, 92, 246, 0.05);
  border-color: #8b5cf6;
}

/* Fade in up entrance */
.fade-in-up {
  opacity: 0;
  transform: translateY(16px);
  animation: fc-fade-in-up .5s ease-out forwards;
}
@keyframes fc-fade-in-up {
  to { opacity: 1; transform: translateY(0); }
}

/* Grid background (decorativo) */
.grid-bg {
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.03) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* Panel highlight line */
.panel-highlight {
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.08), transparent);
  height: 1px;
}
