/* ==========================================
   FormulárioGrátis — Main Styles
   Palette: Slate 900 bg, Indigo accent, warm whites
   ========================================== */

:root {
  --bg:       #0f1117;
  --bg-card:  #181c27;
  --bg-input: #1e2335;
  --border:   #2a2f45;
  --border-light: #343a55;
  --text:     #e8eaf4;
  --text-muted: #7b82a8;
  --text-dim:  #4e5478;
  --accent:   #6366f1;
  --accent-hover: #5254cc;
  --accent-glow: rgba(99,102,241,0.3);
  --success:  #22c55e;
  --error:    #ef4444;
  --warn:     #f59e0b;
  --radius:   12px;
  --radius-sm: 8px;
  --shadow:   0 4px 24px rgba(0,0,0,0.4);
  --font: 'Sora', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  padding: 0 2rem;
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: rgba(15,17,23,0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-right: auto;
  letter-spacing: -0.02em;
}

.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

.nav-actions { display: flex; gap: 0.75rem; margin-left: 2rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-light);
  background: var(--bg-input);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
}
.btn-danger:hover { background: rgba(239,68,68,0.1); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { opacity: 0.9; }

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-label.required::after { content: ' *'; color: var(--error); }

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.625rem 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-hint { font-size: 0.75rem; color: var(--text-dim); }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card-sm { padding: 1rem; }
.card:hover { border-color: var(--border-light); }

/* ── Container ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 520px; margin: 0 auto; padding: 0 1.5rem; }
.container-md { max-width: 760px; margin: 0 auto; padding: 0 1.5rem; }

main { flex: 1; }

/* ── Alerts ── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.alert-warn {
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.3);
  color: #fcd34d;
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  font-size: 0.85rem;
}

/* ── Auth pages ── */
.auth-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
}

.auth-header { margin-bottom: 2rem; text-align: center; }
.auth-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; }
.auth-header p { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.5rem; }

.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.875rem; color: var(--text-muted); }
.auth-footer a { color: var(--accent); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

.captcha-wrap {
  background: white;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: inline-block;
}
.captcha-wrap img { display: block; }
.captcha-refresh {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  font-family: var(--font);
}

/* ── Hero ── */
.hero {
  padding: 6rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  color: #a5b4fc;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.375rem 1rem;
  border-radius: 100px;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  max-width: 700px;
  margin: 0 auto 1.5rem;
}

.hero h1 span { color: var(--accent); }

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 500px;
  margin: 0 auto 2.5rem;
}

.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.expiry-notice {
  margin-top: 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.25);
  color: #fcd34d;
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  border-radius: 100px;
}

/* ── Features ── */
.features { padding: 5rem 1.5rem; }
.section-title { text-align: center; margin-bottom: 3rem; }
.section-title h2 { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 0.5rem; }
.section-title p { color: var(--text-muted); }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.feature-icon {
  width: 44px;
  height: 44px;
  background: rgba(99,102,241,0.15);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.feature-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.85rem; color: var(--text-muted); }

/* ── Dashboard ── */
.dash-layout { display: flex; min-height: calc(100vh - 64px); }

.sidebar {
  width: 240px;
  min-height: calc(100vh - 64px);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 64px;
  flex-shrink: 0;
}

.sidebar-section { margin-bottom: 1.5rem; }
.sidebar-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s;
}
.sidebar a:hover, .sidebar a.active {
  background: rgba(99,102,241,0.12);
  color: var(--text);
}
.sidebar a.active { color: var(--accent); }

.dash-content { flex: 1; padding: 2rem; overflow-x: hidden; }
.dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.dash-title { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }

/* ── Stats ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.5rem; }
.stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.04em; }
.stat-note { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.25rem; }

/* ── Forms list ── */
.forms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s;
}
.form-card:hover { border-color: var(--border-light); }

.form-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.form-card-title { font-size: 0.95rem; font-weight: 600; }
.form-card-desc { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-active { background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.badge-inactive { background: rgba(107,114,128,0.12); color: #9ca3af; border: 1px solid rgba(107,114,128,0.25); }
.badge-expired { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.badge-lock { background: rgba(245,158,11,0.12); color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }

.form-card-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.form-card-stats { font-size: 0.75rem; color: var(--text-dim); }
.form-card-actions { display: flex; gap: 0.5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

.form-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.75rem;
  width: 100%;
  overflow: hidden;
}
.form-link:hover { border-color: var(--accent); color: var(--text); }
.form-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* ── Form Editor ── */
.editor-layout { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; align-items: start; }

.editor-fields { display: flex; flex-direction: column; gap: 0.75rem; }

.field-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.field-item-handle { cursor: grab; color: var(--text-dim); padding-top: 0.25rem; }
.field-item-body { flex: 1; }
.field-item-actions { display: flex; gap: 0.5rem; }

.add-field-btn {
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.875rem;
  width: 100%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.add-field-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(99,102,241,0.05); }

.settings-panel { position: sticky; top: 80px; }
.settings-section { margin-bottom: 1.5rem; }
.settings-section h3 { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 0.75rem; }

.toggle-wrap { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.toggle-label { font-size: 0.875rem; }

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--border-light);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(18px); }

/* ── Public Form ── */
.public-form-page {
  min-height: 100vh;
  background: var(--bg);
  padding: 2rem 1rem 4rem;
}

.public-form-card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.public-form-logo {
  padding: 1.5rem 2rem 0;
  display: flex;
  justify-content: center;
}
.public-form-logo img { max-height: 80px; max-width: 240px; object-fit: contain; border-radius: 8px; }

.public-form-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}
.public-form-header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.public-form-header p { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.5rem; }

.public-form-body { padding: 2rem; }

.public-field { margin-bottom: 1.5rem; }
.public-field-label { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--text); }
.public-field-label.required::after { content: ' *'; color: var(--error); }

.public-form-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.powered-by { font-size: 0.7rem; color: var(--text-dim); }
.powered-by a { color: var(--text-muted); text-decoration: none; }
.powered-by a:hover { color: var(--accent); }

/* ── Responses ── */
.response-table { width: 100%; border-collapse: collapse; }
.response-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.response-table td {
  padding: 0.875rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.response-table tr:hover td { background: rgba(255,255,255,0.02); }
.response-table td:last-child { white-space: nowrap; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { font-size: 0.875rem; max-width: 300px; margin: 0 auto 1.5rem; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  transform: scale(0.95);
  transition: transform 0.2s;
}
.modal-backdrop.open .modal { transform: scale(1); }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.25rem; }
.modal-close:hover { color: var(--text); }

/* ── Loading ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer-inner a { color: var(--text-muted); text-decoration: none; }
.footer-inner a:hover { color: var(--text); }
.footer-note { color: var(--warn); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .sidebar { display: none; }
  .editor-layout { grid-template-columns: 1fr; }
  .hero { padding: 3rem 1rem 2rem; }
  .dash-content { padding: 1rem; }
  .auth-card { padding: 1.5rem; }
}

/* ── Utilities ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }
.font-mono { font-family: var(--mono); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
