/* ==========================================================================
   Gerador PIX — tema inspirado em Material Design
   Personalize as cores alterando as variáveis em :root (veja README.md).
   ========================================================================== */

:root {
  --gp-primary: #00a859;
  --gp-primary-dark: #008a49;
  --gp-primary-darker: #006b38;
  --gp-primary-soft: #e4f6ec;
  --gp-accent: #0d6efd;
  --gp-bg: #f2f6f4;
  --gp-surface: #ffffff;
  --gp-text: #18241d;
  --gp-text-muted: #5c6b63;
  --gp-border: #dfe7e2;
  --gp-radius: 18px;
  --gp-radius-sm: 12px;
  --gp-shadow: 0 10px 30px rgba(20, 40, 30, 0.08);
  --gp-shadow-hover: 0 18px 44px rgba(20, 40, 30, 0.14);
  --gp-footer: #0d2119;
  --gp-focus: rgba(0, 168, 89, 0.45);
}

/* ---------- base ---------- */

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 400px at 50% -100px, var(--gp-primary-soft), transparent 70%),
    var(--gp-bg);
  color: var(--gp-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

:focus-visible {
  outline: 3px solid var(--gp-focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 1100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--gp-primary);
  color: #fff;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
  color: #fff;
}

/* ---------- cabeçalho ---------- */

.app-header {
  background: linear-gradient(135deg, var(--gp-primary) 0%, var(--gp-primary-darker) 100%);
  color: #fff;
  padding: 2.4rem 0 2.6rem;
  border-radius: 0 0 28px 28px;
  box-shadow: var(--gp-shadow);
  position: relative;
  overflow: hidden;
}

.app-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.14) 0 90px, transparent 90px),
    radial-gradient(circle at 10% 90%, rgba(255, 255, 255, 0.1) 0 140px, transparent 140px);
  pointer-events: none;
}

.app-header .container {
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  background: #fff;
}

.brand h1 {
  font-size: 1.7rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 0.15rem 0 0;
  opacity: 0.92;
  font-size: 0.95rem;
}

/* ---------- cards ---------- */

.card-material {
  background: var(--gp-surface);
  border: 1px solid var(--gp-border);
  border-radius: var(--gp-radius);
  box-shadow: var(--gp-shadow);
}

.card-material .card-body {
  padding: 1.5rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 1.1rem;
}

.section-title .icon-chip {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--gp-primary-soft);
  color: var(--gp-primary-dark);
  font-size: 1.15rem;
}

/* ---------- formulário ---------- */

.form-label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.form-control {
  border-radius: var(--gp-radius-sm);
  border-color: var(--gp-border);
  padding: 0.7rem 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--gp-primary);
  box-shadow: 0 0 0 0.25rem var(--gp-focus);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--gp-text-muted);
  margin-top: 0.3rem;
}

.key-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.key-badge--muted {
  background: #eef2f0;
  color: var(--gp-text-muted);
}

.key-badge--valid {
  background: var(--gp-primary-soft);
  color: var(--gp-primary-dark);
}

.key-badge--invalid {
  background: #fdecec;
  color: #b02a37;
}

.btn-pill {
  border-radius: 999px;
  padding: 0.7rem 1.5rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--gp-shadow-hover);
}

.btn-primary-pix {
  background: var(--gp-primary);
  border-color: var(--gp-primary);
  color: #fff;
}

.btn-primary-pix:hover,
.btn-primary-pix:focus {
  background: var(--gp-primary-dark);
  border-color: var(--gp-primary-dark);
  color: #fff;
}

/* ---------- resultado ---------- */

.qr-frame {
  background: #fff;
  border: 2px dashed var(--gp-border);
  border-radius: var(--gp-radius);
  padding: 1.1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

#qrcode canvas,
#qrcode img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  image-rendering: pixelated;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.result-meta .meta-chip {
  background: var(--gp-primary-soft);
  color: var(--gp-primary-dark);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
}

#payload {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  word-break: break-all;
  resize: none;
  background: #f8faf9;
  border-radius: var(--gp-radius-sm);
}

/* ---------- histórico ---------- */

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--gp-border);
  border-radius: var(--gp-radius-sm);
  margin-bottom: 0.6rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.history-item:hover {
  border-color: var(--gp-primary);
  box-shadow: var(--gp-shadow);
}

.history-body {
  min-width: 0;
}

.history-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.history-value {
  font-weight: 700;
  color: var(--gp-primary-dark);
}

.history-sub {
  font-size: 0.85rem;
  color: var(--gp-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-date {
  font-size: 0.75rem;
  color: var(--gp-text-muted);
}

.history-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* ---------- anúncios ---------- */

.adsense-top,
.adsense-middle,
.adsense-footer {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.adsense-top::before,
.adsense-middle::before,
.adsense-footer::before {
  content: "Publicidade";
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gp-text-muted);
  opacity: 0.6;
}

/* ---------- rodapé ---------- */

.app-footer {
  background: var(--gp-footer);
  color: rgba(255, 255, 255, 0.85);
  margin-top: 3rem;
  padding: 2.2rem 0 1.4rem;
}

.app-footer a {
  color: #9fe8c2;
  text-decoration: none;
}

.app-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-title {
  color: #fff;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.app-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 1.6rem;
  padding-top: 1.1rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
}

/* ---------- toasts ---------- */

#toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ---------- área de impressão ---------- */

#print-area {
  display: none;
}

/* ---------- páginas internas ---------- */

.page-hero {
  padding: 2.2rem 0 1.4rem;
}

.page-hero h1 {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.prose h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1.8rem 0 0.6rem;
}

.prose h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.4rem 0 0.4rem;
}

.prose p,
.prose li {
  color: #33413a;
  line-height: 1.7;
}

.faq-item {
  border: 1px solid var(--gp-border);
  border-radius: var(--gp-radius-sm);
  margin-bottom: 0.7rem;
  overflow: hidden;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.95rem 1.1rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "\F64D";
  font-family: "bootstrap-icons";
  transition: transform 0.2s ease;
  color: var(--gp-primary-dark);
}

.faq-item[open] summary::after {
  transform: rotate(180deg);
}

.faq-item .faq-body {
  padding: 0 1.1rem 1rem;
  color: #33413a;
}

/* ---------- responsividade ---------- */

@media (max-width: 575.98px) {
  .brand-logo {
    width: 52px;
    height: 52px;
  }

  .brand h1 {
    font-size: 1.35rem;
  }

  .card-material .card-body {
    padding: 1.1rem;
  }

  .history-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- impressão ---------- */

@media print {
  body {
    background: #fff;
  }

  body > *:not(#print-area) {
    display: none !important;
  }

  #print-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
  }

  #print-area .print-meta {
    margin-top: 0.8rem;
    font-size: 14px;
  }

  #print-qr canvas,
  #print-qr img {
    max-width: 70mm;
  }
}

/* ---------- acessibilidade / movimento ---------- */

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