/*
  Caderno de Campo — design system
  Paleta extraída dos Pantones da identidade do programa (485C, Orange 021C,
  130C, 1225C). Assinatura visual: a "faixa gradiente" (barra da nav, focus
  ring, âncoras de seção) + o "chip branco flutuante" — o mesmo recurso do
  material impresso (cartão branco/QR sobre o gradiente laranja).
*/

:root {
  --red: #E12518;
  --orange: #FF5100;
  --amber: #F5A800;
  --yellow: #FFC844;

  --ink: #211A15;
  --ink-soft: #756A5E;
  --cream: #FFF9F1;
  --paper: #FFFFFF;
  --line: #EFE1CD;

  --status-ok: #1F7A4D;
  --status-ok-bg: #E7F5EC;
  --status-wait: #B4790A;
  --status-wait-bg: #FCF0D9;
  --status-err: #B3241A;
  --status-err-bg: #FBE9E7;

  --gradient-brand: linear-gradient(135deg, var(--red) 0%, var(--orange) 45%, var(--amber) 75%, var(--yellow) 100%);
  --gradient-brand-flat: linear-gradient(90deg, var(--red), var(--orange), var(--amber), var(--yellow));

  --shadow-card: 0 1px 2px rgba(33, 26, 21, 0.04), 0 6px 20px -8px rgba(33, 26, 21, 0.12);
  --shadow-card-hover: 0 2px 4px rgba(33, 26, 21, 0.06), 0 12px 28px -8px rgba(33, 26, 21, 0.18);
  --shadow-focus: 0 0 0 4px rgba(255, 81, 0, 0.15);

  --radius-lg: 1.1rem;
  --radius-md: 0.65rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  background-color: var(--cream);
  color: var(--ink);
  font-family: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
}

.font-display {
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
}

.font-mono-brand {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---------- Nav / chrome ---------- */

.app-nav {
  background: var(--gradient-brand-flat);
  background-size: 200% 100%;
  position: relative;
}

.app-nav::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 6px;
  background: linear-gradient(180deg, rgba(33,26,21,0.08), transparent);
}

.brand-chip {
  background: var(--paper);
  border-radius: var(--radius-md);
  padding: 0.3rem 0.65rem;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.brand-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}

.nav-link {
  position: relative;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
  padding: 0.35rem 0.15rem;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: -2px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: right 200ms ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  right: 0;
}

.nav-link.active {
  color: #fff;
  font-weight: 600;
}

.nav-toggle {
  color: #fff;
  padding: 0.4rem;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 150ms ease;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu .nav-link {
  display: block;
  padding: 0.6rem 0.2rem;
}

/* ---------- Layout primitives ---------- */

.page-title {
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.eyebrow {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 0.2rem;
  display: block;
}

.section-title {
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
  margin-bottom: 0.9rem;
}

.card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
}

.card-hover {
  transition: transform 180ms ease, box-shadow 180ms ease;
}

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

/* Stagger reveal for stacked section cards on load */
.rise-in {
  animation: rise-in 480ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.rise-in:nth-of-type(1) { animation-delay: 0ms; }
.rise-in:nth-of-type(2) { animation-delay: 70ms; }
.rise-in:nth-of-type(3) { animation-delay: 140ms; }
.rise-in:nth-of-type(4) { animation-delay: 210ms; }
.rise-in:nth-of-type(5) { animation-delay: 280ms; }
.rise-in:nth-of-type(n+6) { animation-delay: 320ms; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--amber));
  color: #fff;
  box-shadow: 0 4px 14px -4px rgba(255, 81, 0, 0.55);
}

.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 20px -4px rgba(255, 81, 0, 0.65);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  border-color: var(--orange);
  color: var(--orange);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--ink-soft);
  font-weight: 500;
}

.btn-ghost:hover {
  color: var(--orange);
}

/* ---------- Forms ---------- */

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.3rem;
  display: block;
}

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.select {
  background-image: none;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: var(--shadow-focus);
}

/* ---------- Eixos (grade de codificação) — numeração real, não decorativa ---------- */

.eixos-grade {
  counter-reset: eixo;
}

.eixo-title {
  counter-increment: eixo;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  margin-top: 1.15rem;
  margin-bottom: 0.35rem;
}

.eixo-title::before {
  content: counter(eixo);
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--gradient-brand-flat);
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Tables ---------- */

.table-head {
  background: #FBF2E6;
  color: var(--ink-soft);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.table-row {
  transition: background-color 120ms ease;
}

.table-row:hover {
  background-color: #FFF6EA;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

.badge-ok { background: var(--status-ok-bg); color: var(--status-ok); }
.badge-ok .badge-dot { background: var(--status-ok); }

.badge-wait { background: var(--status-wait-bg); color: var(--status-wait); }
.badge-wait .badge-dot {
  background: var(--status-wait);
  animation: pulse-dot 1.6s ease-in-out infinite;
}

.badge-err { background: var(--status-err-bg); color: var(--status-err); }
.badge-err .badge-dot { background: var(--status-err); }

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.55; }
}

/* ---------- Messages ---------- */

.message {
  border-radius: var(--radius-md);
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  border-left: 3px solid transparent;
}

.message-success { background: var(--status-ok-bg); color: var(--status-ok); border-color: var(--status-ok); }
.message-error { background: var(--status-err-bg); color: var(--status-err); border-color: var(--status-err); }
.message-warning { background: var(--status-wait-bg); color: var(--status-wait); border-color: var(--status-wait); }

/* ---------- Login hero ---------- */

.login-hero {
  min-height: calc(100vh - 84px);
  background: var(--gradient-brand);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-hero::before {
  content: '';
  position: absolute;
  top: -12%;
  right: -8%;
  width: 46vw;
  height: 46vw;
  max-width: 620px;
  max-height: 620px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 200, 68, 0.55), rgba(255, 200, 68, 0));
  filter: blur(2px);
  animation: drift 14s ease-in-out infinite;
}

.login-hero::after {
  content: '';
  position: absolute;
  bottom: -18%;
  left: -10%;
  width: 38vw;
  height: 38vw;
  max-width: 480px;
  max-height: 480px;
  border-radius: 999px;
  background: radial-gradient(circle at 60% 60%, rgba(255, 249, 241, 0.25), rgba(255, 249, 241, 0));
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-2%, 3%); }
}

.login-card {
  position: relative;
  z-index: 1;
  animation: rise-in 560ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
