/* Shared dark-mode overrides for iframe pages embedded in Chatwoot.
   Bootstrap script (iframe-theme.js) toggles body.theme-dark based on the
   `?theme=` URL param + postMessage from parent + prefers-color-scheme. */

/* Tokens reused across pages — light defaults are the page's own inline CSS. */
body.theme-dark {
  background: #1c1d20 !important;
  color: #e2e8f0 !important;
}

/* Light: match Chatwoot's main column white-ish bg */
body:not(.theme-dark) {
  background: #f7f7f7 !important;
}

/* Dark mode: card text colors — fix stat-card values which had #111 hardcoded */
body.theme-dark .stat-card .value,
body.theme-dark .stat-card h4,
body.theme-dark .stat-card .subtext,
body.theme-dark .stat-card .label,
body.theme-dark .dist-card *,
body.theme-dark .card *,
body.theme-dark .conn-card *,
body.theme-dark h1, body.theme-dark h2, body.theme-dark h3, body.theme-dark h4 {
  color: #e2e8f0 !important;
}
body.theme-dark .stat-card h4,
body.theme-dark .stat-card .subtext {
  color: #94a3b8 !important;
}
body.theme-dark .stat-card .value {
  color: #f8fafc !important;
}
/* Card backgrounds in dark — slightly lighter than body */
body.theme-dark .stat-card {
  background: #2a2b30 !important;
  border-color: #3a3b42 !important;
}

body.theme-dark .topbar,
body.theme-dark .top-nav,
body.theme-dark header,
body.theme-dark .navbar {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

body.theme-dark .stat-card,
body.theme-dark .dist-card,
body.theme-dark .conn-card,
body.theme-dark .add-card,
body.theme-dark .card,
body.theme-dark .settings-section,
body.theme-dark .setting-row,
body.theme-dark .table-wrap,
body.theme-dark .panel,
body.theme-dark .pane {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

body.theme-dark .btn-secondary {
  background: #334155 !important;
  color: #e2e8f0 !important;
  border-color: #475569 !important;
}

body.theme-dark .btn-secondary:hover {
  background: #475569 !important;
}

body.theme-dark .conn-bot {
  background: #0f172a !important;
  color: #cbd5e1 !important;
}

body.theme-dark .conn-bot strong {
  color: #5eead4 !important;
}

body.theme-dark table {
  background: transparent !important;
  color: #e2e8f0 !important;
}

body.theme-dark thead th {
  background: #0f172a !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}

body.theme-dark tbody tr {
  border-color: #334155 !important;
}

body.theme-dark tbody tr:hover {
  background: rgba(255, 255, 255, 0.03) !important;
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

body.theme-dark input::placeholder {
  color: #64748b !important;
}

body.theme-dark .toggle-slider {
  background: #475569 !important;
}

body.theme-dark .toggle input:checked + .toggle-slider {
  background: #16a34a !important;
}

body.theme-dark .hint,
body.theme-dark .empty,
body.theme-dark .help,
body.theme-dark .muted,
body.theme-dark p,
body.theme-dark .text-muted,
body.theme-dark .section-title {
  color: #94a3b8 !important;
}

body.theme-dark .section-title {
  border-color: #334155 !important;
}

body.theme-dark a {
  color: #5eead4 !important;
}

body.theme-dark .pause-pill.live {
  background: #064e3b !important;
  color: #6ee7b7 !important;
}

body.theme-dark .pause-pill.paused {
  background: #422006 !important;
  color: #fdba74 !important;
}

body.theme-dark .pager .btn,
body.theme-dark .pager button,
body.theme-dark .page-btn {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}


/* Bot card (Conexões WzAp) — layered dark scheme matching light contrast */
body.theme-dark .bot-card {
  background: #2a2b30 !important;
  border: 1px solid #3a3b42 !important;
  box-shadow: 0 2px 10px rgba(0,0,0,.3) !important;
}
body.theme-dark .bot-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.4) !important;
}
body.theme-dark .bot-card > div[style*="background:#f8f9fa"],
body.theme-dark .bot-card > div[style*="background: #f8f9fa"] {
  background: #1c1d20 !important;
  border: 1px solid #3a3b42 !important;
}
/* Labels (Número Conectado, Status, Última Mensagem, Último Evento) — inline color:#888 */
body.theme-dark .bot-card div[style*="color:#888"],
body.theme-dark .bot-card div[style*="color: #888"] {
  color: #94a3b8 !important;
}
/* Values: bot-card descendant divs without color: (inherit body color) */
body.theme-dark .bot-card div[style*="font-weight"],
body.theme-dark .bot-card div[style*="font-size:12px"],
body.theme-dark .bot-card div[style*="font-size:11px"]:not([style*="color:#888"]) {
  color: #e2e8f0 !important;
}
/* The state-specific color for Status value should keep its semantic hue but brighten in dark */
body.theme-dark .bot-card div[style*="color:#2e7d32"] { color: #6ee7b7 !important; }
body.theme-dark .bot-card div[style*="color:#f57f17"] { color: #fcd34d !important; }
body.theme-dark .bot-card div[style*="color:#546e7a"] { color: #94a3b8 !important; }
body.theme-dark .bot-card div[style*="color:#c62828"] { color: #fca5a5 !important; }

/* Bot card title (WhatsApp 0303, Atendimento 2 etc) — was washed out in dark */
body.theme-dark .bot-card .bot-name {
  color: #f1f5f9 !important;
}
