/*
 * ARQUIVO COMENTADO: css/base.css
 * FUNÇÃO: Variáveis globais, cores, tipografia, botões, campos e componentes reutilizáveis.
 * As regras originais foram preservadas; foram adicionados comentários para estudo.
 */

:root {
  color-scheme: light;
  --navy: #08051f;
  --navy-2: #15082f;
  --purple: #7c3aed;
  --purple-2: #a855f7;
  --cyan: #20d7d2;
  --orange: #ff8a00;
  --pink: #ec2f73;
  --green: #16c784;
  --yellow: #ffd23f;
  --ink: #111827;
  --muted: #667085;
  --soft: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f7f4ff;
  --app-bg: #fbfbff;
  --line: #e9e7f2;
  --danger: #ef4444;
  --shadow: 0 24px 70px rgba(20, 8, 47, .14);
  --shadow-soft: 0 16px 36px rgba(20, 8, 47, .10);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --container: 1160px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(124, 58, 237, .16), transparent 34rem),
    radial-gradient(circle at 90% 5%, rgba(32, 215, 210, .12), transparent 34rem),
    var(--app-bg);
}

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

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

button, input, select, textarea {
  font: inherit;
}

button { cursor: pointer; }

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.container {
  width: min(var(--container), calc(100% - 32px));
  margin-inline: auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--purple);
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .72rem;
}

.btn {
  border: 0;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 900;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--pink) 55%, var(--orange));
  box-shadow: 0 14px 32px rgba(124, 58, 237, .28);
}

.btn-soft {
  color: var(--navy);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.btn-light {
  color: var(--navy);
  background: rgba(255, 255, 255, .92);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #be123c);
}

.btn-lg {
  min-height: 54px;
  padding-inline: 24px;
  border-radius: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span,
.field label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
  min-height: 46px;
  border-radius: 14px;
  padding: 0 14px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

textarea {
  min-height: 92px;
  padding-top: 12px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(124, 58, 237, .55);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, .12);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.form-grid.one { grid-template-columns: 1fr; padding: 0; }

.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }

.span-2 { grid-column: span 2; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.panel {
  border: 1px solid rgba(233, 231, 242, .95);
  /* Superfície variável: o painel acompanha o tema inteiro. */
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2, .panel-header h1 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: .88rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  display: inline-grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 950;
}

.search-field {
  min-height: 48px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  box-shadow: var(--shadow-soft);
}

.search-field span {
  font-size: 1rem;
}

.search-field input {
  border: 0;
  padding: 0;
  min-height: 44px;
  box-shadow: none;
}

.search-field input:focus {
  box-shadow: none;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 180px;
  border: 1px dashed #d7d2e8;
  color: var(--muted);
  background: var(--surface);
  border-radius: 22px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--safe-bottom));
  transform: translate(-50%, 20px);
  background: var(--navy);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  border-radius: 16px;
  padding: 13px 16px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
  max-width: min(520px, calc(100% - 28px));
  text-align: center;
  font-weight: 800;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 760px) {
  .form-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .btn {
    width: 100%;
  }

  .toast {
    bottom: calc(92px + var(--safe-bottom));
  }
}

/* =====================================================================
   UKIVENDI v3 · Temas e ajustes PWA
   ---------------------------------------------------------------------
   A troca de tema acontece pelo atributo <html data-theme="light|dark">.
   Mantemos variáveis em :root para o app inteiro reagir sem duplicar layout.
===================================================================== */
html,
body {
  min-height: 100%;
  min-height: 100dvh;
}

:root[data-theme="light"] {
  color-scheme: light;
  --app-bg: #fffdf4;
  --surface: #ffffff;
  --surface-2: #faf7ff;
  --ink: #120827;
  --muted: #675f78;
  --line: #ebe4d6;
  --yellow: #ffd23f;
  --shadow: 0 26px 80px rgba(39, 20, 4, .13);
  --shadow-soft: 0 16px 38px rgba(39, 20, 4, .08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --app-bg: #08051f;
  --surface: #15102b;
  --surface-2: #20143f;
  --ink: #fbfaff;
  --muted: #b9b1cb;
  --line: rgba(255, 255, 255, .13);
  --shadow: 0 26px 80px rgba(0, 0, 0, .34);
  --shadow-soft: 0 16px 38px rgba(0, 0, 0, .24);
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 210, 63, .12), transparent 32rem),
    radial-gradient(circle at 90% 5%, rgba(124, 58, 237, .22), transparent 34rem),
    var(--app-bg);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .search-field,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .feature-card,
:root[data-theme="dark"] .trust-row span,
:root[data-theme="dark"] .btn-soft {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: rgba(255, 255, 255, .42);
}

.theme-mini-btn {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  font-weight: 950;
}

/* Quando instalado, evita áreas estranhas no topo/rodapé de celulares com notch. */
@media all and (display-mode: fullscreen), all and (display-mode: standalone) {
  body.app-body {
    padding-top: env(safe-area-inset-top, 0px);
    min-height: 100dvh;
    overscroll-behavior-y: none;
  }
}
