/* =============================================
   Validar CDA — Sucata Pereira
   ============================================= */

:root {
  --green-dark: #1b3022;
  --green-olive: #6b7d3f;
  --green-cert: #00401a;
  --gold: #b8860b;
  --gold-light: #d4af37;
  --white: #ffffff;
  --black: #1a1a1a;
  --text: #2d3436;
  --text-muted: #5a5a5a;
  --font: 'Montserrat', sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sign: 'Great Vibes', cursive;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: #eef1ee;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--green-dark);
  text-decoration: none;
}

a:hover {
  color: var(--green-olive);
}

/* ---- Página de validação (cartão) ---- */
.cda-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(27, 48, 34, 0.1);
  padding: 0.875rem 1.25rem;
}

.cda-topbar__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green-dark);
}

.cda-topbar__back svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.75;
}

.validar-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5rem 1rem 3rem;
}

.validar-card {
  width: 100%;
  max-width: 720px;
  background: var(--white);
  box-shadow: 0 12px 40px rgba(27, 48, 34, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

/* Header do cartão */
.card-header {
  text-align: center;
  padding: 2rem 2rem 1.25rem;
}

.card-header__logo {
  max-width: 220px;
  margin: 0 auto 0.5rem;
}

.card-header__slogan {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green-dark);
  padding-top: 0.75rem;
  border-top: 1px solid rgba(27, 48, 34, 0.2);
  margin-top: 0.75rem;
}

/* Ação de validação — formulário */
.validar-action {
  padding: 1.75rem 2rem;
  background: #f8faf8;
  border-top: 1px solid rgba(27, 48, 34, 0.08);
  border-bottom: 1px solid rgba(27, 48, 34, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.validar-action__title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green-dark);
  margin-bottom: 0.375rem;
  text-align: center;
}

.validar-action__desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.25rem;
}

.validar-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.validar-form input[type="text"] {
  flex: 1 1 200px;
  padding: 0.875rem 1rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 2px solid rgba(27, 48, 34, 0.15);
  border-radius: 8px;
  transition: border-color 0.2s;
}

.validar-form input[type="text"]:focus {
  outline: none;
  border-color: var(--green-olive);
}

.btn-verificar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--white);
  background: var(--green-dark);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  white-space: nowrap;
}

.btn-verificar svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.btn-verificar:hover {
  background: var(--green-olive);
  transform: translateY(-1px);
}

.alert {
  width: 100%;
  max-width: 480px;
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

.alert--success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.alert--error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

/* Colunas de contato */
.card-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  padding: 1.75rem 2rem;
}

.card-divider-v {
  width: 1px;
  background: rgba(27, 48, 34, 0.2);
  margin: 0 1.5rem;
}

.card-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.info-row__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 48, 34, 0.07);
  color: var(--green-dark);
  border-radius: 10px;
}

.info-row__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.75;
}

.info-row__text strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--green-dark);
  margin-bottom: 0.125rem;
}

.info-row__text span,
.info-row__text a {
  font-size: 0.8125rem;
  color: var(--text);
  line-height: 1.45;
}

.info-row__text a:hover {
  color: var(--green-olive);
}

.info-row__maps {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.card-divider-h {
  height: 1px;
  background: rgba(27, 48, 34, 0.15);
  margin: 0.5rem 0;
}

/* Banner de serviços */
.card-services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--green-dark);
  color: var(--white);
}

.service-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.35;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.service-item:last-child {
  border-right: none;
}

.service-item__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
}

.service-item__icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 1.75;
}

/* Rodapé do cartão */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green-dark);
}

.card-footer__leaf {
  display: flex;
  align-items: center;
  color: var(--green-olive);
}

.card-footer__leaf svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.75;
}

.back-link {
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Certificado CDA ---- */
.certificado-wrapper {
  display: none;
  width: 100%;
  max-width: 900px;
  margin: 2.5rem auto 0;
  animation: fadeIn 0.5s ease;
}

.certificado-wrapper.is-visible {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.certificado-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 2px solid var(--green-dark);
  border-radius: 6px;
  background: var(--white);
  color: var(--green-dark);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.btn-action:hover {
  background: var(--green-dark);
  color: var(--white);
}

.btn-action--print {
  background: var(--green-dark);
  color: var(--white);
}

.btn-action--print:hover {
  background: var(--green-olive);
  border-color: var(--green-olive);
}

.btn-action--back {
  text-decoration: none;
}

/* Certificado — imagem real */
.certificado {
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
  line-height: 0;
}

.certificado__img {
  width: 100%;
  height: auto;
  display: block;
}

.certificado__frame {
  position: relative;
  border: 2px solid var(--green-cert);
  padding: 2rem 1.75rem 0;
}

/* Cantos decorativos */
.certificado__frame::before,
.certificado__frame::after {
  content: '';
  position: absolute;
  width: 80px;
  height: 80px;
  pointer-events: none;
}

.certificado__frame::before {
  top: -2px;
  left: -2px;
  border-top: 6px solid var(--gold);
  border-left: 6px solid var(--gold);
}

.certificado__frame::after {
  bottom: -2px;
  right: -2px;
  border-bottom: 6px solid var(--gold);
  border-right: 6px solid var(--gold);
}

.corner-tr,
.corner-bl {
  position: absolute;
  width: 80px;
  height: 80px;
  pointer-events: none;
}

.corner-tr {
  top: -2px;
  right: -2px;
  border-top: 6px solid var(--green-cert);
  border-right: 6px solid var(--green-cert);
}

.corner-bl {
  bottom: -2px;
  left: -2px;
  border-bottom: 6px solid var(--green-cert);
  border-left: 6px solid var(--green-cert);
}

/* Header certificado */
.cert-header {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 64, 26, 0.12);
}

.cert-header__logo img {
  max-width: 130px;
}

.cert-header__logo small {
  display: block;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--green-cert);
  margin-top: 0.375rem;
  line-height: 1.35;
}

.cert-header__title {
  text-align: center;
}

.cert-header__title h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-cert);
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.cert-header__title h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text);
  margin-top: 0.25rem;
}

.cert-header__title .divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.cert-header__title .divider::before,
.cert-header__title .divider::after {
  content: '';
  width: 40px;
  height: 1px;
  background: var(--gold);
}

.cert-header__title .divider span {
  width: 8px;
  height: 8px;
  background: var(--gold);
  transform: rotate(45deg);
}

.cert-header__seal {
  text-align: right;
}

.seal {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.seal__circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: linear-gradient(145deg, #fff9e6, #f5e6b8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: inset 0 0 0 2px var(--gold-light);
  position: relative;
}

.seal__circle svg {
  width: 36px;
  height: 36px;
  stroke: var(--green-cert);
  stroke-width: 1.75;
}

.seal__circle::before {
  display: none;
}

.seal__ribbons {
  display: flex;
  gap: 4px;
  margin-top: -4px;
}

.seal__ribbons span {
  width: 14px;
  height: 20px;
  background: var(--green-cert);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
}

.cert-number-box {
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--black);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 800;
  text-align: center;
  display: inline-block;
}

.cert-emissao {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.375rem;
  color: var(--text-muted);
}

/* Texto introdutório */
.cert-intro {
  font-size: 0.78rem;
  line-height: 1.65;
  text-align: justify;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.cert-intro strong {
  color: var(--green-cert);
}

/* Box dados empresa */
.cert-box {
  border: 2px solid var(--green-cert);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.cert-box__header {
  background: var(--green-cert);
  color: var(--white);
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}

.cert-box__body {
  display: grid;
  grid-template-columns: 1.4fr auto 1fr;
  gap: 0;
  padding: 1rem 1.25rem;
}

.cert-box__divider {
  width: 2px;
  background: linear-gradient(180deg, var(--gold), var(--gold-light));
  margin: 0 1rem;
}

.cert-field {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}

.cert-field:last-child {
  margin-bottom: 0;
}

.cert-field__icon {
  flex-shrink: 0;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-cert);
}

.cert-field__icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.75;
}

.cert-field__label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.125rem;
}

.cert-field__value {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.cert-box__right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
}

.cert-box__right p {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.45;
}

.idema-badge {
  padding: 0.5rem 1rem;
  border: 2px solid var(--green-olive);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--green-cert);
  letter-spacing: 0.05em;
}

/* Tabela de materiais */
.cert-table-wrap {
  margin-bottom: 1rem;
  overflow-x: auto;
}

.cert-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.cert-table thead {
  background: var(--green-cert);
  color: var(--white);
}

.cert-table th {
  padding: 0.625rem 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.cert-table td {
  padding: 0.75rem 0.5rem;
  text-align: center;
  border: 1px solid rgba(0, 64, 26, 0.15);
  vertical-align: middle;
}

.cert-table tbody tr:nth-child(even) {
  background: #f5f8f5;
}

.cert-declaration {
  font-size: 0.68rem;
  line-height: 1.6;
  text-align: justify;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

/* Rodapé certificado */
.cert-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 1.5rem;
  align-items: end;
  padding-bottom: 1.5rem;
  border-bottom: none;
}

.cert-qr {
  text-align: center;
}

.cert-qr h4 {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green-cert);
  margin-bottom: 0.5rem;
}

.cert-qr img {
  width: 100px;
  height: 100px;
  margin: 0 auto 0.375rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.cert-qr small {
  font-size: 0.55rem;
  color: var(--text-muted);
  word-break: break-all;
}

.cert-assinatura {
  text-align: center;
}

.cert-assinatura__sign {
  font-family: var(--font-sign);
  font-size: 2rem;
  color: #1a4d8c;
  line-height: 1;
  margin-bottom: 0.25rem;
  min-height: 40px;
}

.cert-assinatura__line {
  width: 80%;
  max-width: 220px;
  height: 1px;
  background: var(--black);
  margin: 0 auto 0.375rem;
}

.cert-assinatura__name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.cert-assinatura__role {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.cert-assinatura__cpf {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.cert-stamp {
  display: flex;
  justify-content: center;
}

.stamp-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px double var(--green-cert);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  transform: rotate(-8deg);
  opacity: 0.85;
}

.stamp-circle span {
  font-size: 0.5rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--green-cert);
  line-height: 1.3;
}

.stamp-circle__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.125rem 0;
}

.stamp-circle__icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--green-cert);
  stroke-width: 1.75;
}

.stamp-circle .leaf {
  display: none;
}

/* Barra final */
.cert-bottom-bar {
  background: var(--green-cert);
  color: var(--white);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  margin: 0 -1.75rem;
  font-size: 0.6rem;
  line-height: 1.45;
}

.cert-bottom-bar__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cert-bottom-bar__icon {
  display: flex;
  flex-shrink: 0;
}

.cert-bottom-bar__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.75;
}

.cert-bottom-bar__left .leaf {
  display: none;
}

.cert-disclaimer {
  text-align: center;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 1rem 1.25rem;
  margin: 0 -1.75rem;
}

/* Print */
@media print {
  body {
    background: white;
  }

  .validar-page > .validar-card,
  .validar-action,
  .cda-topbar,
  .certificado-actions {
    display: none !important;
  }

  .certificado-wrapper {
    display: block !important;
    margin: 0;
    max-width: 100%;
  }

  .certificado {
    box-shadow: none;
    border-radius: 0;
  }

  .certificado__img {
    max-width: 100%;
  }
}

/* Responsivo */
@media (max-width: 768px) {
  .validar-action {
    padding: 1.5rem 1.25rem;
  }

  .card-body {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }

  .card-divider-v {
    width: 100%;
    height: 1px;
    margin: 0.5rem 0;
  }

  .card-services {
    grid-template-columns: 1fr;
  }

  .service-item {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .cert-header {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .cert-header__seal {
    text-align: center;
  }

  .cert-box__body {
    grid-template-columns: 1fr;
  }

  .cert-box__divider {
    width: 100%;
    height: 2px;
    margin: 1rem 0;
  }

  .cert-footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .cert-bottom-bar {
    grid-template-columns: 1fr;
    margin: 0 -2rem;
  }

  .certificado__frame {
    padding: 1.25rem 1rem 0;
  }
}
