/* ============================================================================
   css/global.css
   Sistema de design base do Trezzer. Carregado em todas as páginas internas.
   ============================================================================ */

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

:root {
  /* Paleta base do produto (a Trezzer pública usa a paleta da tabela themes) */
  --bg: #09090b;
  --bg-elevated: #0d0d10;
  --card: #111113;
  --card-hover: #16161a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: #a1a1aa;
  --muted-2: #71717a;
  --primary: #7c3aed;
  --primary-hover: #8b5cf6;
  --primary-soft: rgba(124, 58, 237, 0.12);
  --success: #22c55e;
  --error: #ef4444;
  --info: #38bdf8;

  --font-display: 'Sora', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);

  --nav-w: 264px;
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

button { cursor: pointer; border: none; background: none; }

ul { list-style: none; }

::selection { background: var(--primary); color: #fff; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* ---------------------------- BOTÕES ---------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition), border-color var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35); }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45); }

.btn--secondary { background: var(--card); color: var(--text); border: 1px solid var(--border-strong); }
.btn--secondary:hover:not(:disabled) { background: var(--card-hover); border-color: var(--muted-2); }

.btn--ghost { background: transparent; color: var(--muted); }
.btn--ghost:hover:not(:disabled) { color: var(--text); background: var(--card); }

.btn--danger { background: rgba(239, 68, 68, 0.1); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.btn--danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.18); }

.btn--sm { padding: 7px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn--full { width: 100%; }
.btn--icon { padding: 10px; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------- FORMULÁRIOS ---------------------------- */

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--muted); }

.input, .textarea, select.input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); outline: none; }
.input--error { border-color: var(--error) !important; }
.textarea { resize: vertical; min-height: 90px; }

.input-prefix-group { display: flex; align-items: stretch; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.input-prefix-group .prefix { display: flex; align-items: center; padding: 0 12px; background: var(--bg-elevated); color: var(--muted-2); font-size: 13px; border-right: 1px solid var(--border); }
.input-prefix-group .input { border: none; border-radius: 0; }

.form-error { font-size: 12px; color: #f87171; }
.form-hint { font-size: 12px; color: var(--muted-2); }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--border-strong); border-radius: var(--radius-full);
  transition: background var(--transition); cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform var(--transition);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---------------------------- CARDS ---------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ---------------------------- TOASTS ---------------------------- */

.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 0 16px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: #1a1a1e;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 220ms ease, transform 220ms ease;
  max-width: 420px;
}
.toast--show { opacity: 1; transform: translateY(0); }
.toast__icon { font-weight: 700; flex-shrink: 0; }
.toast--success .toast__icon { color: var(--success); }
.toast--error .toast__icon { color: var(--error); }
.toast--info .toast__icon { color: var(--info); }

/* ---------------------------- SKELETONS ---------------------------- */

.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 37%, var(--card) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------------------- EMPTY STATES ---------------------------- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state__icon {
  width: 48px; height: 48px; margin: 0 auto 16px;
  color: var(--muted-2);
}
.empty-state__title { color: var(--text); font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.empty-state__desc { font-size: 13px; max-width: 320px; margin: 0 auto; }

/* ---------------------------- MODAL ---------------------------- */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.is-open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 26px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.98); transition: transform var(--transition);
}
.modal-overlay.is-open .modal { transform: translateY(0) scale(1); }
.modal h3 { margin-bottom: 10px; }
.modal p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------------------- BADGES ---------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
}
.badge--success { background: rgba(34, 197, 94, 0.12); color: #4ade80; }
.badge--muted { background: var(--border); color: var(--muted); }
.badge--primary { background: var(--primary-soft); color: #a78bfa; }
.badge--admin { background: rgba(239, 68, 68, 0.12); color: #f87171; }

/* ---------------------------- LOGO MARK ---------------------------- */
/* Usado no sidebar/topbar das páginas internas (dashboard, editor, etc.)
   e também no header do site (index.html) — landing.css sobrescreve com
   os mesmos valores lá, então fica consistente nos dois lugares. */
.logo__mark {
  width: 28px; height: 28px;
  object-fit: contain; flex-shrink: 0; display: block;
}

/* ---------------------------- SCROLLBAR ---------------------------- */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ---------------------------- UTILITÁRIOS ---------------------------- */

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
