/* Sid Plus — identidade visual própria (site público + painel do dono), separada do
   painel interno do achados-promotrends de propósito: público e tom são diferentes. */

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

:root {
  --bg: #F2F8FC;
  --surface: #FFFFFF;
  --surface-2: #E6F1FA;
  --text: #132438;
  --text-muted: #64768D;
  --border: rgba(19, 36, 56, 0.10);
  --accent: #1298D6;
  --accent-rgb: 18, 152, 214;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCEFFA;
  --teal: #12A594;
  --teal-soft: #D8F3EF;
  --warn: #E0A13A;
  --danger: #E5484D;
  --shadow: 0 12px 32px rgba(19, 36, 56, 0.09);
  --radius: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1420;
    --surface: #121D2E;
    --surface-2: #182742;
    --text: #EAF2FB;
    --text-muted: #8FA1BB;
    --border: rgba(255, 255, 255, 0.08);
    --accent-soft: #163449;
    --teal-soft: #163832;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0B1420;
  --surface: #121D2E;
  --surface-2: #182742;
  --text: #EAF2FB;
  --text-muted: #8FA1BB;
  --border: rgba(255, 255, 255, 0.08);
  --accent-soft: #163449;
  --teal-soft: #163832;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
:root[data-theme="light"] {
  --bg: #F2F8FC;
  --surface: #FFFFFF;
  --surface-2: #E6F1FA;
  --text: #132438;
  --text-muted: #64768D;
  --border: rgba(19, 36, 56, 0.10);
  --accent-soft: #DCEFFA;
  --teal-soft: #D8F3EF;
  --shadow: 0 12px 32px rgba(19, 36, 56, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Fredoka', 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--text);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(var(--accent-rgb), 0.42); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-2); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill-ativo { background: var(--teal-soft); color: var(--teal); }
.pill-trial { background: var(--surface-2); color: var(--text-muted); }
.pill-inadimplente { background: #FBEEDC; color: var(--warn); }
.pill-cancelado { background: #FBE2E2; color: var(--danger); }

.brand { display: flex; align-items: center; gap: 0.6rem; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent-soft); }

::selection { background: var(--accent-soft); }

.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}
.input-field, .select-field {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
}
.input-field:focus, .select-field:focus { outline: none; border-color: var(--accent); }

.tabular { font-variant-numeric: tabular-nums; }
.text-muted { color: var(--text-muted); }

/* Compatibilidade com as páginas do cliente (cadastro/painel/mini-apps) - mesmas classes que o
   painel antigo (public/style.css) usava, só que nos tokens de cor do Sid Plus. */
.glass-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }

header { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 100; }
.navbar { display: flex; justify-content: space-between; align-items: center; height: 70px; padding: 0 1.5rem; max-width: 1400px; margin: 0 auto; }
.logo { font-size: 1.35rem; font-family: 'Fredoka', sans-serif; font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 0.5rem; }
.logo-icon { font-size: 1.6rem; }
.nav-link { font-weight: 600; color: var(--text-muted); padding: 0.5rem 1rem; border-radius: 8px; text-decoration: none; }
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface-2); }
.user-info { display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; color: var(--text-muted); }
.user-role-badge { background: var(--accent); color: #fff; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

.auth-wrapper { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 70px); padding: 2rem; }
.auth-card { width: 100%; max-width: 450px; padding: 2.5rem; }
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-header h1 { font-size: 1.6rem; margin-bottom: 0.5rem; }

.platform-checkbox-label {
  display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer;
  padding: 0.3rem 0.8rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
}
.platform-checkbox-label:hover { background: var(--accent-soft); }
.platform-checkbox-label input { cursor: pointer; }

.checkbox-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 220px; overflow-y: auto; }
.checkbox-list label {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; margin: 0;
  padding: 0.4rem 0.8rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
}
.checkbox-list label:hover { background: var(--accent-soft); }
.checkbox-list input { cursor: pointer; width: auto; }

#toastContainer {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  box-shadow: var(--shadow);
  transition: opacity 0.3s ease;
}
.toast-success { background: var(--teal); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--text); }

/* Chat de atendimento com IA (2026-08-11) - widget flutuante, injetado por atendimento-widget.js.
   Usa só variáveis já definidas em :root - dark mode funciona sozinho, sem regra condicional extra. */
#sidChatWidget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
}
#sidChatFab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  box-shadow: var(--shadow);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#sidChatFab img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#sidChatPainel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 120px);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* #sidChatPainel[hidden] precisa vir DEPOIS e com seletor mais específico (ID + atributo) que a
   regra acima - achado real 2026-08-11: o display:flex fixo tinha mais especificidade que a regra
   nativa do navegador pra [hidden] (que é só um seletor de atributo), então o atributo hidden não
   escondia nada de verdade - o botão de fechar mexia no atributo mas o painel continuava visível. */
#sidChatPainel[hidden] {
  display: none;
}
#sidChatHeader {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.9rem 1rem;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#sidChatHeader button {
  background: none;
  border: none;
  color: var(--accent-ink);
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.85;
}
#sidChatMensagens {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.sidChatBolha {
  max-width: 80%;
  padding: 0.6rem 0.85rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.4;
  white-space: pre-wrap;
}
.sidChatBolha-usuario {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
  border-bottom-right-radius: 4px;
}
.sidChatBolha-bot {
  align-self: flex-start;
  background: var(--bg);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.sidChatRetry {
  margin-top: 0.4rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.sidChatTelegramLink {
  background: var(--teal) !important;
  color: #fff !important;
  text-decoration: none;
  font-weight: 600;
  text-align: center;
  align-self: center !important;
}
.sidChatDigitando {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0.7rem 0.9rem;
}
.sidChatDigitando span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: sidChatPulso 1.2s infinite ease-in-out;
}
.sidChatDigitando span:nth-child(2) { animation-delay: 0.2s; }
.sidChatDigitando span:nth-child(3) { animation-delay: 0.4s; }
@keyframes sidChatPulso {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}
#sidChatForm {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}
#sidChatForm input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  background: var(--surface);
  color: var(--text);
}
#sidChatForm button {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 10px;
  width: 40px;
  cursor: pointer;
  font-size: 1rem;
}
@media (max-width: 480px) {
  #sidChatPainel { right: -8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
