/* ============================
   Design System
============================ */

:root {
  /* Cores base */
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;

  --positive: #166534;
  --negative: #991b1b;

  /* Header */
  --bg-header: #ffffff;
  --text-header: #111827;

  /* Inputs */
  --input-bg: var(--card);
  --input-text: var(--text);
  --input-border: var(--border);

  /* Tipografia */
  --font-base: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Layout */
  --radius: 12px;
  --max-width: 1100px;
  --tool-width: 720px;
  --header-height: 72px;

  /* Espaçamentos */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;

  /* Utilitários */
  --bg-soft: color-mix(in srgb, var(--card) 92%, var(--bg));
  --text-muted: var(--muted);
  --border-color: var(--border);

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* Transições */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
}

/* ============================
   Separador
============================ */

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-md) 0;
}

/* ============================
   Dark Mode
============================ */

html.dark {
  --bg: #0f172a;
  --card: #020617;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #1e293b;

  --bg-header: #020617;
  --text-header: #e5e7eb;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ============================
   Reset / Base
============================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ============================
   Layout
============================ */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding-top: var(--space-xl);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ============================
   Header Global
============================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;

  background: color-mix(in srgb, var(--bg-header) 95%, transparent);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-lg);
  height: var(--header-height);
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text-header);
  text-decoration: none;

  padding: 8px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));

  transition: all var(--transition-base);
}

.logo:hover {
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ============================
   Tipografia
============================ */

h1 {
  font-size: 1.8rem;
  margin: 0 0 var(--space-sm);
  font-weight: 700;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

/* ============================
   Cards
============================ */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
  width: 100%;
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card p {
  margin-bottom: 0.75rem;
}

.card p:last-child {
  margin-bottom: 0;
}

/* Páginas de conteúdo (Sobre, Termos, etc) */
.about-card p,
.tool.placeholder-card p {
  max-width: 60ch;
  margin: 0 auto 0.75rem;
  text-align: left;
}

.about-card p:last-child,
.tool.placeholder-card p:last-child {
  margin-bottom: 0;
}

/* Listas dentro de cards */
.tool.placeholder-card ul {
  list-style-position: outside;
  padding-left: 1.25rem;
  text-align: left;
  max-width: 60ch;
  margin: 0.75rem auto;
}

.tool.placeholder-card li {
  margin-bottom: 0.4rem;
  color: var(--muted);
  text-align: left;
}

.tool.placeholder-card li:last-child {
  margin-bottom: 0;
}

/* Subtítulos dentro de cards */
.tool.placeholder-card h2,
.tool.placeholder-card h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 600;
  text-align: left;
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}

.tool.placeholder-card h2:first-of-type,
.tool.placeholder-card h3:first-of-type {
  margin-top: 0;
}

.tool.placeholder-card h3 + p,
.tool.placeholder-card h3 + ul,
.tool.placeholder-card h2 + p,
.tool.placeholder-card h2 + ul {
  margin-top: 0;
}

/* Badge de placeholder */
.placeholder-badge {
  display: inline-block;
  margin-bottom: 14px;
  padding: 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

/* ============================
   Tool – Layout
============================ */

.tool-wrap,
.tool-container {
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.tool-wrap.xlarge { max-width: 898px; }
.tool-wrap.large  { max-width: 838px; }
.tool-wrap.medium { max-width: 720px; }
.tool-wrap.small  { max-width: 638px; }
.tool-wrap.xsmall { max-width: 578px; }

/* Container padrão para páginas placeholder */
.tool-container {
  max-width: 640px;
}

.tool-header {
  margin: 0 auto var(--space-lg);
  text-align: center;
}

.tool-description {
  max-width: 60ch;
  font-size: 0.95rem;
  margin: 0 auto;
}

.tool {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);

  display: flex;
  flex-direction: column;
  gap: var(--space-lg);

  transition: box-shadow var(--transition-base);
}

.tool:hover {
  box-shadow: var(--shadow-md);
}

/* Placeholder cards (Sobre, Contato, etc) */
.tool.placeholder-card {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}

.tool.placeholder-card .tool-title,
.tool.placeholder-card h1 {
  text-align: center;
  margin-bottom: var(--space-md);
}

.tool.placeholder-card .tool-description {
  text-align: center;
  margin: 0 auto;
}

/* ============================
   Inputs
============================ */

input,
select,
textarea {
  background: var(--input-bg);
  color: var(--input-text);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

input:hover,
select:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--input-border));
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

/* ============================
   Botões – Sistema Completo
============================ */

/* Botão base */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  min-height: 42px;
  padding: 0 20px;

  border-radius: 10px;
  border: 1px solid var(--border);

  background: var(--card);
  color: var(--text);

  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;

  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

button:hover,
.btn:hover {
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active,
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Botão primário */
.btn-primary,
button.primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 
    var(--shadow-sm),
    0 0 0 0 color-mix(in srgb, var(--primary) 30%, transparent);
}

.btn-primary:hover,
button.primary:hover {
  background: color-mix(in srgb, var(--primary) 90%, black);
  border-color: color-mix(in srgb, var(--primary) 90%, black);
  box-shadow: 
    0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent),
    0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}

.btn-primary:active,
button.primary:active {
  transform: translateY(0);
  box-shadow: 
    var(--shadow-sm),
    0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}

/* Botão secundário */
.btn-secondary,
button.secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover,
button.secondary:hover {
  background: color-mix(in srgb, var(--text) 4%, var(--card));
  border-color: color-mix(in srgb, var(--text) 20%, var(--border));
}

/* Botão ghost/transparente */
.btn-ghost,
button.ghost {
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
}

.btn-ghost:hover,
button.ghost:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-color: color-mix(in srgb, var(--primary) 20%, transparent);
  box-shadow: none;
}

/* Botão reset */
.reset-btn,
button[type="reset"] {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  box-shadow: none;
  font-weight: 500;
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.85rem;
}

.reset-btn:hover,
button[type="reset"]:hover {
  background: color-mix(in srgb, var(--negative) 6%, var(--card));
  border-color: color-mix(in srgb, var(--negative) 30%, var(--border));
  color: var(--negative);
  box-shadow: none;
}

/* Botões de tamanho */
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.85rem; }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============================
   Footer
============================ */

.site-footer {
  margin-top: var(--space-xl);
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg);

  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);

  font-size: 0.85rem;
  color: var(--muted);
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-nav {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.footer-nav a {
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;

  transition: all var(--transition-fast);
}

.footer-nav a:hover {
  background: color-mix(in srgb, var(--primary) 6%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

/* Link de suporte */
.footer-support {
  display: inline-block;
  margin-top: 0.65rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  opacity: 0.85;
  transition: all 0.2s ease;
}

.footer-support:hover {
  opacity: 1;
  color: var(--positive);
  text-decoration: underline;
}

/* ============================
   Dropdown Menu – Correções
============================ */

/* Remove linha azul de itens inativos */
.nav-dropdown a {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 10px 16px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition-fast);
}

/* Hover mostra fundo sutil */
.nav-dropdown a:hover {
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
  color: var(--primary);
}

/* Item ativo tem linha azul */
.nav-dropdown a.active {
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
  color: var(--primary);
  font-weight: 600;
  border-left: 3px solid var(--primary);
  padding-left: 13px;
}

/* ============================
   Value Proposition
============================ */

section.value-prop > .card {
  background: color-mix(in srgb, var(--card) 75%, var(--bg));
  color: var(--text);
  border: 1px solid var(--border);
}

section.value-prop > .card p {
  color: color-mix(in srgb, var(--text) 85%, var(--muted));
}

/* ============================
   Utility Classes
============================ */

/* Margens */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.ml-0 { margin-left: 0; }
.mr-0 { margin-right: 0; }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.ml-sm { margin-left: var(--space-sm); }
.ml-md { margin-left: var(--space-md); }
.mr-sm { margin-right: var(--space-sm); }
.mr-md { margin-right: var(--space-md); }

/* Paddings */
.p-0 { padding: 0; }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.pt-sm { padding-top: var(--space-sm); }
.pt-md { padding-top: var(--space-md); }
.pt-lg { padding-top: var(--space-lg); }

.pb-sm { padding-bottom: var(--space-sm); }
.pb-md { padding-bottom: var(--space-md); }
.pb-lg { padding-bottom: var(--space-lg); }

/* Texto */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

.text-muted { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-positive { color: var(--positive); }
.text-negative { color: var(--negative); }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flex */
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

/* Gaps */
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Grid */
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }
.max-w-full { max-width: 100%; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Border */
.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-l { border-left: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }
.border-0 { border: none; }

.rounded { border-radius: var(--radius); }
.rounded-sm { border-radius: 6px; }
.rounded-lg { border-radius: 16px; }
.rounded-full { border-radius: 9999px; }

/* Background */
.bg-card { background: var(--card); }
.bg-primary { background: var(--primary); }
.bg-transparent { background: transparent; }

/* Sombras */
.shadow-none { box-shadow: none; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Opacity */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Transições */
.transition { transition: all var(--transition-base); }
.transition-fast { transition: all var(--transition-fast); }

/* ============================
   Dark Mode – Ajustes Específicos
============================ */

html.dark button,
html.dark .btn {
  background: color-mix(in srgb, var(--card) 90%, white);
  color: var(--text);
  border-color: var(--border);
}

html.dark button:hover,
html.dark .btn:hover {
  background: color-mix(in srgb, var(--primary) 15%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

html.dark .btn-primary,
html.dark button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

html.dark .btn-primary:hover,
html.dark button.primary:hover {
  background: color-mix(in srgb, var(--primary) 85%, black);
}

html.dark .btn-secondary,
html.dark button.secondary {
  background: color-mix(in srgb, var(--bg) 95%, white);
}

html.dark .reset-btn:hover,
html.dark button[type="reset"]:hover {
  background: color-mix(in srgb, var(--negative) 10%, var(--card));
}

/* ============================
   Mobile
============================ */

@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .container,
  .tool-wrap,
  .tool-container {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .tool-wrap {
    width: 100%; /* Prevent overflow */
  }

  .tool {
    padding: var(--space-lg);
  }

  .logo {
    font-size: 1rem;
    padding: 10px 14px; /* Better touch target */
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    max-width: 160px;
  }

  .header-inner {
    gap: var(--space-md);
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-nav {
    justify-content: center;
  }

  .footer-nav a {
    padding: 12px 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  input, select, textarea {
    font-size: 16px;
  }
}

/* ============================
   Scrollbar Customizada
============================ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Extra small screens */
@media (max-width: 380px) {
  :root {
    --space-lg: 16px;
    --space-xl: 24px;
  }
  
  h1 {
    font-size: 1.25rem;
  }
  
  .tool {
    padding: var(--space-md);
  }
}