:root {
  color-scheme: dark;
  --sa-black: #04060d;
  --sa-dark: #0b1220;
  --sa-blue: #1e5eff;
  --sa-blue-light: #60a5ff;
  --sa-gray: #94a3b8;
  --sa-white: #f8fafc;
  --sa-card: rgba(15, 23, 42, 0.85);
  --sa-border: rgba(148, 163, 184, 0.2);
  --sa-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);

  /* Aliases usadas nas páginas internas */
  --bg: #04060d;
  --card-bg: rgba(15, 23, 42, 0.85);
  --border: rgba(148, 163, 184, 0.2);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;

  /* Efeitos */
  --glow: 0 0 20px rgba(59, 130, 246, 0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --gradient-border: linear-gradient(135deg, #3b82f6, #60a5ff, #3b82f6);
}

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

body {
  background: radial-gradient(circle at top, rgba(30, 94, 255, 0.2), transparent),
    var(--sa-black);
  color: var(--sa-white);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

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

a:hover {
  opacity: 0.88;
}

button:hover {
  opacity: 1;
}

/* ============ Animações ============ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes sa-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ Classes de animação ============ */

.animate-fade-in-up {
  animation: fadeInUp 0.5s ease-out both;
}

.animate-fade-in-up:nth-child(1) { animation-delay: 0s; }
.animate-fade-in-up:nth-child(2) { animation-delay: 0.1s; }
.animate-fade-in-up:nth-child(3) { animation-delay: 0.2s; }
.animate-fade-in-up:nth-child(4) { animation-delay: 0.3s; }
.animate-fade-in-up:nth-child(5) { animation-delay: 0.4s; }
.animate-fade-in-up:nth-child(6) { animation-delay: 0.5s; }

/* ============ Header ============ */

.sa-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 4rem;
  background: rgba(4, 6, 13, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sa-border);
}

.sa-logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sa-logo span {
  color: var(--sa-blue);
}

.sa-nav {
  display: flex;
  gap: 1.5rem;
  font-weight: 500;
  color: var(--sa-gray);
}

.sa-cta {
  display: flex;
  gap: 1rem;
}

/* ============ Botões ============ */

.sa-btn {
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.8rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--sa-blue), var(--sa-blue-light));
  color: var(--sa-white);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 10px 30px rgba(30, 94, 255, 0.35);
}

.sa-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 35px rgba(30, 94, 255, 0.5);
}

.sa-btn:active {
  transform: translateY(1px) scale(0.99);
}

.sa-btn--ghost {
  background: transparent;
  border: 1px solid var(--sa-border);
  color: var(--sa-white);
  box-shadow: none;
}

.sa-btn--ghost:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: none;
  transform: scale(1.02);
}

/* ============ Hero ============ */

main {
  padding: 0 4rem 6rem;
}

.sa-hero {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 4rem;
  padding: 5rem 0 6rem;
}

.sa-hero__copy {
  animation: fadeInUp 0.7s ease-out;
}

.sa-hero__copy h1 {
  font-size: clamp(2.8rem, 3.5vw, 4.2rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.sa-hero__copy p {
  color: var(--sa-gray);
  font-size: 1.05rem;
  max-width: 520px;
}

.sa-badge {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 255, 0.4);
  color: var(--sa-blue-light);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.sa-hero__actions {
  margin: 2rem 0 2.5rem;
  display: flex;
  gap: 1rem;
}

.sa-hero__stats {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sa-stat__value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--sa-blue-light);
}

.sa-stat__label {
  color: var(--sa-gray);
  font-size: 0.95rem;
}

.sa-hero__preview {
  position: relative;
  animation: fadeInUp 0.7s ease-out 0.2s both;
}

/* ============ Window (chat preview) ============ */

.sa-window {
  border-radius: 1.5rem;
  background: rgba(8, 13, 23, 0.95);
  border: 1px solid rgba(96, 165, 255, 0.2);
  box-shadow: var(--sa-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.sa-window header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: rgba(15, 23, 42, 0.95);
  font-weight: 600;
  color: var(--sa-gray);
  border-bottom: 1px solid rgba(96, 165, 255, 0.25);
}

.sa-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.sa-dot--red {
  background: #ef4444;
}

.sa-dot--yellow {
  background: #f59e0b;
}

.sa-dot--green {
  background: #22c55e;
}

.sa-window__body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  overflow-y: auto;
}

.sa-message {
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  max-width: 85%;
  font-size: 0.95rem;
  line-height: 1.5;
  position: relative;
}

.sa-message--bot {
  background: rgba(30, 94, 255, 0.08);
  border: 1px solid rgba(30, 94, 255, 0.3);
  align-self: flex-start;
}

.sa-message--user {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  align-self: flex-end;
}

.sa-window footer {
  display: flex;
  padding: 1rem 1.5rem;
  gap: 1rem;
  border-top: 1px solid rgba(96, 165, 255, 0.25);
}

.sa-window footer input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.9);
  color: var(--sa-white);
}

.sa-window footer button {
  border: none;
  background: rgba(96, 165, 255, 0.15);
  color: var(--sa-blue-light);
  padding: 0.75rem 1.25rem;
  border-radius: 0.8rem;
}

/* ============ Sections ============ */

.sa-section {
  padding: 4.5rem 0;
}

.sa-section--alt {
  background: rgba(10, 15, 28, 0.75);
  border-radius: 1.5rem;
  padding: 4.5rem 3rem;
  border: 1px solid rgba(30, 64, 175, 0.35);
}

.sa-section h2 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

.sa-section__subtitle {
  color: var(--sa-gray);
  margin-bottom: 2.5rem;
  max-width: 560px;
}

.sa-grid {
  display: grid;
  gap: 2rem;
}

.sa-grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ============ Cards com efeitos ============ */

.sa-card {
  padding: 2rem;
  border-radius: 1.25rem;
  background: var(--sa-card);
  border: 1px solid var(--sa-border);
  box-shadow: 0 15px 40px rgba(2, 6, 23, 0.35);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition);
}

.sa-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow), 0 20px 50px rgba(2, 6, 23, 0.45);
  border-color: rgba(59, 130, 246, 0.4);
}

.sa-card--pricing ul {
  list-style: none;
  color: var(--sa-gray);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sa-card--highlight {
  background: linear-gradient(160deg, rgba(30, 94, 255, 0.25), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(96, 165, 255, 0.5);
  transform: translateY(-10px);
}

.sa-card--highlight:hover {
  transform: translateY(-14px);
}

/* ============ Timeline ============ */

.sa-timeline {
  display: grid;
  gap: 2rem;
}

.sa-timeline__item {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.sa-step {
  display: inline-flex;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  background: rgba(30, 94, 255, 0.18);
  color: var(--sa-blue-light);
  border: 1px solid rgba(30, 64, 175, 0.5);
}

/* ============ Accordion ============ */

.sa-accordion details {
  background: rgba(15, 23, 42, 0.85);
  border-radius: 1rem;
  padding: 1.2rem 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  transition: var(--transition);
}

.sa-accordion details:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

.sa-accordion details + details {
  margin-top: 1rem;
}

.sa-accordion summary {
  cursor: pointer;
  font-weight: 600;
}

.sa-accordion p {
  margin-top: 0.75rem;
  color: var(--sa-gray);
}

/* ============ Footer ============ */

.sa-footer {
  margin-top: 5rem;
  padding: 3rem 4rem;
  border-top: 1px solid var(--sa-border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  align-items: center;
}

.sa-footer__links,
.sa-footer__social {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  color: var(--sa-gray);
}

/* ============ Chat widget ============ */

.sa-chat {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: min(380px, 90vw);
  border-radius: 1.5rem;
  background: rgba(8, 13, 23, 0.95);
  border: 1px solid rgba(30, 64, 175, 0.45);
  box-shadow: var(--sa-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sa-fade-in 0.3s ease;
}

.sa-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(30, 64, 175, 0.35);
}

.sa-chat__messages {
  max-height: 360px;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sa-chat__form {
  display: flex;
  gap: 0.8rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(30, 64, 175, 0.35);
}

.sa-chat__form input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.9);
  color: var(--sa-white);
  padding: 0.75rem 1.1rem;
}

.sa-chat__form button {
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--sa-blue), var(--sa-blue-light));
  color: var(--sa-white);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
}

/* ============ Efeitos para páginas internas ============ */

.stat-card {
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-border);
  background-size: 200% 100%;
  animation: gradient-shift 3s ease infinite;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow);
  border-color: rgba(59, 130, 246, 0.3);
}

.agent-card {
  transition: var(--transition);
}

.agent-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow);
}

.agent-status::before {
  animation: pulse-glow 2s ease-in-out infinite;
  border-radius: 50%;
}

/* Auth card animation */
.auth-card {
  animation: fadeInUp 0.5s ease-out;
}

/* Glassmorphism para cards */
.glass-card {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

/* ============ Custom scrollbar (dark theme) ============ */

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

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

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
}

/* ============ Selection ============ */

::selection {
  background: rgba(59, 130, 246, 0.35);
  color: var(--sa-white);
}

/* ============ Focus-visible ============ */

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* ============ Shared Sidebar ============ */

.dashboard { min-height: 100vh; display: flex; }
.sidebar { width: 260px; background: var(--card-bg); border-right: 1px solid var(--border); padding: 1.5rem; display: flex; flex-direction: column; backdrop-filter: blur(16px); }
.sidebar-logo { margin-bottom: 2rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: 0.5rem; color: var(--text-muted); text-decoration: none; transition: all 0.2s; }
.sidebar-nav a:hover,
.sidebar-nav a.active { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.sidebar-nav a svg { width: 20px; height: 20px; }
.sidebar-footer { padding-top: 1rem; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border-radius: 0.5rem; }
.user-avatar { width: 36px; height: 36px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.875rem; }
.user-details { flex: 1; min-width: 0; }
.user-name { font-weight: 500; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan { font-size: 0.75rem; color: var(--text-muted); }
.main-content { flex: 1; padding: 2rem; overflow-y: auto; }
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.page-header p { color: var(--text-muted); }
.logout-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.5rem; border-radius: 0.25rem; }
.logout-btn:hover { color: #ef4444; }

/* ============ Shared Toast ============ */

.toast { position: fixed; top: 1rem; right: 1rem; padding: 1rem 1.5rem; border-radius: 0.5rem; z-index: 1001; display: none; }
.toast.show { display: block; animation: fadeInUp 0.3s ease-out; }
.toast.error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #ef4444; }
.toast.success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: #22c55e; }

/* ============ Shared Modal ============ */

.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.7); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: var(--card-bg); border: 1px solid var(--border); border-radius: 1rem; padding: 2rem; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal::before { content: ''; position: absolute; inset: -1px; border-radius: 1rem; background: var(--gradient-border); background-size: 300% 300%; animation: gradient-shift 4s ease infinite; z-index: -1; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h2 { font-size: 1.25rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.modal-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-size: 0.875rem; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select { padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--bg); color: var(--text); font-size: 1rem; font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s; }
.form-group textarea { min-height: 100px; resize: vertical; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }
.form-actions { display: flex; gap: 1rem; margin-top: 1rem; }
.form-actions button { flex: 1; }

/* ============ Shared Internal Sections ============ */

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.agents-section { margin-top: 2rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.section-header h2 { font-size: 1.25rem; }
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.empty-state { text-align: center; padding: 3rem; background: var(--card-bg); border: 1px dashed var(--border); border-radius: 0.75rem; }
.empty-state h3 { margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-muted); margin-bottom: 1.5rem; }
.agent-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.agent-actions button { padding: 0.5rem 1rem; font-size: 0.75rem; }

/* ============ Responsivo ============ */

@media (max-width: 1024px) {
  .sa-header {
    padding: 1.25rem 2rem;
  }

  main {
    padding: 0 2rem 4rem;
  }

  .sa-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .sa-hero__actions {
    justify-content: center;
  }

  .sa-hero__stats {
    justify-items: center;
  }

  .sa-hero__copy p {
    margin: 0 auto;
  }
}

@media (max-width: 720px) {
  .sa-header {
    flex-direction: column;
    gap: 1rem;
  }

  .sa-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .sa-cta {
    width: 100%;
    justify-content: center;
  }

  .sa-footer {
    padding: 2.5rem 1.5rem;
  }
}
