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

@layer base {
  :root {
    --background: 222 47% 3%;
    --foreground: 0 0% 96%;

    --card: 222 47% 4%;
    --card-foreground: 0 0% 96%;

    --popover: 222 47% 4%;
    --popover-foreground: 0 0% 96%;

    --primary: 217 91% 55%;
    --primary-foreground: 0 0% 100%;

    --secondary: 217 33% 10%;
    --secondary-foreground: 220 13% 91%;

    --muted: 217 33% 10%;
    --muted-foreground: 220 9% 64%;

    --accent: 217 33% 13%;
    --accent-foreground: 220 13% 91%;

    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 100%;

    --border: 217 33% 12%;
    --input: 217 33% 12%;
    --ring: 217 91% 55%;

    --radius: 0.75rem;

    --gold: 43 74% 49%;
    --gold-foreground: 43 74% 10%;
    --blue: 217 91% 60%;
    --blue-foreground: 0 0% 100%;

    --sidebar-background: 222 47% 4%;
    --sidebar-foreground: 220 13% 91%;
    --sidebar-primary: 217 91% 55%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 217 33% 13%;
    --sidebar-accent-foreground: 220 13% 91%;
    --sidebar-border: 217 33% 12%;
    --sidebar-ring: 217 91% 55%;
  }
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  /* Custom Dark Mode Scrollbars Universais */
  * {
    scrollbar-width: thin;
    scrollbar-color: hsl(217 33% 22%) transparent;
  }

  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: hsl(217 33% 22%);
    border-radius: 9999px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: hsl(217 91% 55% / 0.6);
  }
}

/* Scanner-specific styles */
.scanner-table th,
.scanner-table td {
  @apply px-3 py-2.5 text-left whitespace-nowrap text-xs;
}

.scanner-table th {
  @apply sticky top-0 z-10 bg-card font-bold text-foreground;
}

.scanner-table tr:hover td {
  @apply bg-accent;
}

.dir-buy { @apply text-primary font-black; }
.dir-sell { @apply text-destructive font-black; }

.cls-s { color: hsl(262, 83%, 74%); @apply font-black; }
.cls-a { @apply text-primary font-black; }
.cls-b { color: hsl(45, 93%, 56%); @apply font-black; }
.cls-c { @apply text-muted-foreground font-black; }

.st-open { color: hsl(213, 94%, 78%); @apply font-black; }
.st-hit { @apply text-primary font-black; }
.st-stop { @apply text-destructive font-black; }
.st-amb { color: hsl(45, 93%, 56%); @apply font-black; }

.pnl-pos { @apply text-primary font-black; }
.pnl-neg { @apply text-destructive font-black; }

.scanner-log {
  @apply w-full resize-none overflow-auto whitespace-pre bg-card border border-border rounded-xl p-2 text-foreground;
  font-family: ui-monospace, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 11px;
  min-height: 110px;
  max-height: 180px;
}

.scanner-log-lg {
  font-size: 12px;
  min-height: 260px;
  max-height: 320px;
}


/* Scanning visual indicator */
.scanning-ticker-container {
  height: 120px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.scanning-ticker-container::before,
.scanning-ticker-container::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 24px;
  z-index: 1;
  pointer-events: none;
}

.scanning-ticker-container::before {
  top: 0;
  background: linear-gradient(to bottom, hsl(var(--accent)), transparent);
}

.scanning-ticker-container::after {
  bottom: 0;
  background: linear-gradient(to top, hsl(var(--accent)), transparent);
}

.scanning-ticker-track {
  display: flex;
  flex-direction: column;
}

.scanning-active .scanning-ticker-track {
  animation: ticker-scroll 3s linear infinite;
}

@keyframes ticker-scroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.scanning-ticker-container.is-paused .scanning-ticker-track {
  animation-play-state: paused !important;
  opacity: 0.55;
  filter: grayscale(0.5);
}

/* ===== Sistema de Notificações Toast Neon ===== */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-14px) scale(0.95);
  }
}

.toast-animate-in {
  animation: toastIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-animate-out {
  animation: toastOut 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Feedback tátil nos botões */
.btn-tactile {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-tactile:active:not(:disabled) {
  transform: scale(0.95);
}


/* ===== Tabelas do motor V28 (portado do HTML original) ===== */
.v28 { color: #e5e7eb; }
.v28 table { width:100%; border-collapse:collapse; font-size:12px; }
.v28 th, .v28 td { padding: 9px 10px; border-bottom:1px solid #0f172a; text-align:left; white-space:nowrap; }
.v28 th { position:sticky; top:0; z-index:1; background:#020617; font-size:11px; color:#e5e7eb; }
.v28 tr:hover td { background:#0b1220; }
.v28-wrap, .v28-recs, .custom-scrollbar { 
  border: 1px solid #1f2937; 
  background: #020617; 
  border-radius: 12px; 
  overflow-x: auto; 
  scrollbar-width: thin;
  scrollbar-color: hsl(217 33% 25%) hsl(222 47% 4%);
}
.v28-wrap::-webkit-scrollbar, .v28-recs::-webkit-scrollbar, .custom-scrollbar::-webkit-scrollbar {
  height: 5px;
  width: 5px;
}
.v28-wrap::-webkit-scrollbar-track, .v28-recs::-webkit-scrollbar-track, .custom-scrollbar::-webkit-scrollbar-track {
  background: hsl(222 47% 4%);
}
.v28-wrap::-webkit-scrollbar-thumb, .v28-recs::-webkit-scrollbar-thumb, .custom-scrollbar::-webkit-scrollbar-thumb {
  background: hsl(217 33% 25%);
  border-radius: 9999px;
}
.v28-wrap::-webkit-scrollbar-thumb:hover, .v28-recs::-webkit-scrollbar-thumb:hover, .custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: hsl(217 91% 55% / 0.8);
}
.v28 .primary { background:#2563eb; color:#fff; }
.v28 .primary:hover { background:#1d4ed8; }
.v28 .neutral { background:#111827; color:#e5e7eb; border:1px solid #1f2937; }
.v28 .neutral:hover { background:#0b1220; }
.v28 .danger { background:#dc2626; color:#fff; }
.v28 .danger:hover { background:#b91c1c; }
.v28 .blue { background:#3b82f6; color:#fff; }
.v28 .blue:hover { background:#2563eb; }
.v28 .pnlPos { color:#22c55e; font-weight:900; }
.v28 .pnlNeg { color:#ef4444; font-weight:900; }
.v28 .stEntrada { color:#ef4444; font-weight:900; }
.v28 .stContinuidade { color:#22c55e; font-weight:900; }
.v28 .stPerdida { color:#fbbf24; font-weight:900; }
.v28 .stAttention { color:#f59e0b; font-weight:900; }
.v28 .stClosed { color:#9ca3af; font-weight:900; }
.v28 .rowExplosivo td {
  background: rgba(37, 99, 235, 0.22) !important;
  border-top: 1px solid rgba(59, 130, 246, 0.65);
  border-bottom: 1px solid rgba(59, 130, 246, 0.65);
  animation: v28-exp-pulse 3.2s ease-in-out infinite;
}
@keyframes v28-exp-pulse {
  0%, 100% { box-shadow: inset 0 0 0 rgba(59,130,246,0); }
  50% { box-shadow: inset 0 0 22px rgba(59,130,246,0.28); }
}
@media (prefers-reduced-motion: reduce) {
  .v28 .rowExplosivo td { animation: none; }
}

/* Recomendações — leitura mais ampla */
.v28-recs table { font-size: 13px; }
.v28-recs th, .v28-recs td { padding: 12px 14px; }
.v28-recs th { text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; color: hsl(var(--muted-foreground)); }
.v28-recs tbody tr:hover td { background: hsl(var(--accent)); }

.v28 .scoreEngolfo { color: #fff;
      background: linear-gradient(90deg, #7c3aed, #db2777);
      padding: 2px 7px;
      border-radius: 5px;
      font-weight: 900;
      font-size: 12px;
      letter-spacing: 0.5px;
      text-shadow: 0 0 8px rgba(255,255,255,0.4);
      box-shadow: 0 0 10px rgba(124,58,237,0.6); }
.v28 .histRowWin td { background: rgba(34,197,94,0.06); }
.v28 .histRowLoss td { background: rgba(239,68,68,0.06); }
.v28 .perfTable th, .v28 .perfTable td { padding: 8px 10px; }
.v28 .perfTable .perfWinRateGood { color:#22c55e; font-weight:900; }
.v28 .perfTable .perfWinRateMed { color:#fbbf24; font-weight:900; }
.v28 .perfTable .perfWinRateBad { color:#ef4444; font-weight:900; }
.v28 0%, .v28 100% { opacity:1; }
.v28 50% { opacity:0.55; }
.v28 .alertWaiting { color:#9ca3af; font-size:11px; }
.v28 .alertTime { font-size:10px; color:#c2c2c2; margin-top:2px; }
.v28 code { color:#93c5fd; }
.v28 .histToggle { cursor:pointer; user-select:none; }

/* ===== Landing (Cross Mine) ===== */
.cm-hero::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 70%;
  background: radial-gradient(50% 60% at 50% 40%, hsl(var(--primary) / 0.18), transparent 70%);
  pointer-events: none;
}

@keyframes cm-stage-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.cm-flow-stage {
  opacity: 0;
  animation: cm-stage-in 0.6s ease-out forwards;
}

@keyframes cm-dot-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  45% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px hsl(var(--primary) / 0.7); }
}
.cm-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: hsl(var(--primary));
  display: inline-block;
  animation: cm-dot-pulse 2.6s ease-in-out infinite;
}

@keyframes cm-arrow-move {
  0% { opacity: 0.15; transform: translateY(-4px); }
  50% { opacity: 1; transform: translateY(2px); }
  100% { opacity: 0.15; transform: translateY(-4px); }
}
.cm-arrow {
  color: hsl(var(--primary));
  font-size: 1.1rem;
  line-height: 1;
  animation: cm-arrow-move 1.8s ease-in-out infinite;
}

@keyframes cm-explosive-glow {
  0%, 100% { box-shadow: 0 0 0 hsl(var(--primary) / 0); transform: scale(1); }
  50% { box-shadow: 0 0 32px hsl(var(--primary) / 0.45); transform: scale(1.03); }
}
.cm-explosive { animation: cm-explosive-glow 2.8s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .cm-dot, .cm-arrow, .cm-explosive, .cm-flow-stage { animation: none; opacity: 1; }
}
#lovable-bagde {
  display: none !important;
}

/* ===== Mobile & Tablet Ergonomic Responsive Enhancements ===== */
button, a, input, select, label {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

/* Safe Area Insets for iOS & Modern Android */
.pb-safe {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.pt-safe {
  padding-top: env(safe-area-inset-top, 0px);
}

/* Mobile Signal Cards Styling */
.signal-card {
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.signal-card:active {
  transform: scale(0.985);
}
.signal-card.is-explosive {
  border-color: rgba(59, 130, 246, 0.6) !important;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.25) 0%, rgba(15, 23, 42, 0.6) 100%) !important;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
}

/* Mobile Touch Sliders */
input[type="range"] {
  touch-action: pan-y;
}
input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  cursor: pointer;
}

/* Layout & Long Token Protection from UI-UX-Pro-Max Guidelines */
.token, .signal-card, .btn-tactile {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .signal-card {
    border-radius: 1rem;
    padding: 0.875rem;
  }
}

