/* ============================================================
   CERTIFICATE STYLES — Portal Respire Sem Crise
   Elegant completion certificate with screen preview + print
   ============================================================ */

/* ----------------------------------------------------------
   SCREEN STYLES — Certificate Preview
   ---------------------------------------------------------- */

.certificate-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px;
}

/* --- Header --- */
.certificate-header {
  text-align: center;
  padding: 32px 0;
}

.certificate-header-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.8rem;
  color: #1B5E20;
  margin-bottom: 8px;
  line-height: 1.2;
}

.certificate-header-subtitle {
  font-size: 1rem;
  color: #546E7A;
  margin: 0;
}

/* --- Badge --- */
.certificate-badge {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2E7D32, #1B8A3E);
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(46, 125, 50, 0.25);
  position: relative;
}

.certificate-badge::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px dashed #4CAF50;
  animation: rotate 20s linear infinite;
}

.certificate-badge-icon {
  font-size: 3rem;
  color: #ffffff;
  line-height: 1;
}

.certificate-badge-text {
  position: absolute;
  bottom: -12px;
  background: #7CB342;
  color: #ffffff;
  padding: 4px 16px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* --- Card --- */
.certificate-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
  padding: 40px 32px;
  position: relative;
  overflow: hidden;
}

.certificate-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(135deg, #2E7D32, #1565C0);
}

.certificate-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to top, rgba(245, 249, 245, 0.5), transparent);
  pointer-events: none;
}

/* --- Ornaments --- */
.certificate-ornament-top,
.certificate-ornament-bottom {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0.35;
}

.certificate-ornament-top {
  top: 12px;
}

.certificate-ornament-bottom {
  bottom: 12px;
}

.certificate-ornament-top::before,
.certificate-ornament-top::after,
.certificate-ornament-bottom::before,
.certificate-ornament-bottom::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #2E7D32, transparent);
}

.certificate-ornament-top span,
.certificate-ornament-bottom span {
  font-size: 0.7rem;
  color: #2E7D32;
}

/* --- Title & Subtitle --- */
.certificate-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: #1B5E20;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
  line-height: 1.3;
}

.certificate-subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: #90A4AE;
  margin-bottom: 24px;
}

/* --- Label --- */
.certificate-label {
  font-size: 0.8rem;
  color: #90A4AE;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  text-align: center;
}

/* --- Name --- */
.certificate-name-wrapper {
  text-align: center;
}

.certificate-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #1A1A2E;
  text-align: center;
  border-bottom: 2px solid #4CAF50;
  padding-bottom: 8px;
  margin-bottom: 16px;
  display: inline-block;
  line-height: 1.3;
}

/* --- Protocol & Date --- */
.certificate-protocol {
  font-size: 1rem;
  color: #546E7A;
  text-align: center;
  margin-bottom: 8px;
}

.certificate-date {
  font-size: 0.9rem;
  color: #90A4AE;
  text-align: center;
  margin-bottom: 24px;
}

/* --- Seal --- */
.certificate-seal {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #F9A825;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.certificate-seal-text {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #F9A825;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}

/* --- Footer --- */
.certificate-footer {
  text-align: center;
  font-size: 0.75rem;
  color: #90A4AE;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
}

.certificate-id {
  font-size: 0.7rem;
  color: #90A4AE;
  font-family: 'Courier New', Courier, monospace;
}

/* --- Actions --- */
.certificate-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}


/* ----------------------------------------------------------
   ANIMATIONS
   ---------------------------------------------------------- */

/* Badge rotation */
@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Confetti fall */
@keyframes confettiFall {
  0% {
    transform: translateY(-100%) rotate(0deg);
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Confetti sway */
@keyframes confettiSway {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(15px);
  }
  75% {
    transform: translateX(-15px);
  }
}


/* ----------------------------------------------------------
   CONFETTI
   ---------------------------------------------------------- */

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: 9999;
  animation:
    confettiFall linear forwards,
    confettiSway ease-in-out infinite;
}

/* --- Colors --- */
.confetti-piece:nth-child(6n+1) { background: #4CAF50; }
.confetti-piece:nth-child(6n+2) { background: #F9A825; }
.confetti-piece:nth-child(6n+3) { background: #1565C0; }
.confetti-piece:nth-child(6n+4) { background: #E53935; }
.confetti-piece:nth-child(6n+5) { background: #7CB342; }
.confetti-piece:nth-child(6n+6) { background: #AB47BC; }

/* --- Sizes --- */
.confetti-piece:nth-child(3n+1) {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.confetti-piece:nth-child(3n+2) {
  width: 12px;
  height: 6px;
  border-radius: 2px;
}

.confetti-piece:nth-child(3n+3) {
  width: 6px;
  height: 12px;
  border-radius: 2px;
}

/* --- Timing & Position Variation --- */
.confetti-piece:nth-child(1)  { left:  5%; animation-duration: 3.0s, 1.5s; animation-delay: 0.0s; }
.confetti-piece:nth-child(2)  { left: 12%; animation-duration: 3.4s, 1.8s; animation-delay: 0.2s; }
.confetti-piece:nth-child(3)  { left: 20%; animation-duration: 2.8s, 1.3s; animation-delay: 0.4s; }
.confetti-piece:nth-child(4)  { left: 28%; animation-duration: 3.6s, 2.0s; animation-delay: 0.1s; }
.confetti-piece:nth-child(5)  { left: 35%; animation-duration: 3.2s, 1.6s; animation-delay: 0.5s; }
.confetti-piece:nth-child(6)  { left: 42%; animation-duration: 2.9s, 1.4s; animation-delay: 0.3s; }
.confetti-piece:nth-child(7)  { left: 50%; animation-duration: 3.5s, 1.9s; animation-delay: 0.6s; }
.confetti-piece:nth-child(8)  { left: 58%; animation-duration: 3.1s, 1.7s; animation-delay: 0.15s; }
.confetti-piece:nth-child(9)  { left: 65%; animation-duration: 3.3s, 1.2s; animation-delay: 0.45s; }
.confetti-piece:nth-child(10) { left: 72%; animation-duration: 2.7s, 1.5s; animation-delay: 0.25s; }
.confetti-piece:nth-child(11) { left: 80%; animation-duration: 3.7s, 2.1s; animation-delay: 0.55s; }
.confetti-piece:nth-child(12) { left: 88%; animation-duration: 3.0s, 1.6s; animation-delay: 0.35s; }
.confetti-piece:nth-child(13) { left: 95%; animation-duration: 3.4s, 1.8s; animation-delay: 0.7s; }
.confetti-piece:nth-child(14) { left:  8%; animation-duration: 2.6s, 1.3s; animation-delay: 0.8s; }
.confetti-piece:nth-child(15) { left: 48%; animation-duration: 3.8s, 2.2s; animation-delay: 0.9s; }


/* ----------------------------------------------------------
   PRINT STYLES
   ---------------------------------------------------------- */

@media print {

  /* Hide everything on the page */
  body > *,
  nav,
  header,
  footer,
  .nav-bottom,
  .app-container,
  .section,
  .certificate-container,
  .certificate-actions,
  .confetti-container {
    display: none !important;
  }

  /* Reset body */
  body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Show only the print certificate */
  .certificate-print {
    display: block !important;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 60px 50px;
    box-shadow: none !important;
  }

  /* Double border frame */
  .certificate-print-border {
    border: 3px double #2E7D32;
    padding: 40px;
    position: relative;
  }

  .certificate-print-border::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px solid #A5D6A7;
    pointer-events: none;
  }

  /* Print Title */
  .certificate-print-title {
    font-family: 'Outfit', sans-serif;
    font-size: 28pt;
    text-align: center;
    color: #1B5E20;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin: 0 0 8px;
    line-height: 1.2;
  }

  /* Print Subtitle */
  .certificate-print-subtitle {
    font-size: 12pt;
    text-align: center;
    color: #546E7A;
    margin: 0 0 16px;
  }

  /* Print Divider */
  .certificate-print-divider {
    width: 60%;
    height: 2px;
    background: #2E7D32;
    margin: 16px auto;
    border: none;
  }

  /* Print Body */
  .certificate-print-body {
    text-align: center;
    padding: 20px 0;
  }

  /* Print Label */
  .certificate-print-label {
    font-size: 10pt;
    color: #90A4AE;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0 0 8px;
  }

  /* Print Name */
  .certificate-print-name {
    font-family: 'Outfit', sans-serif;
    font-size: 24pt;
    color: #1A1A2E;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 6px;
    display: inline-block;
    margin: 0 0 16px;
    line-height: 1.3;
  }

  /* Print Protocol */
  .certificate-print-protocol {
    font-size: 14pt;
    color: #546E7A;
    margin: 12px 0;
  }

  /* Print Date */
  .certificate-print-date {
    font-size: 11pt;
    color: #90A4AE;
    margin: 0 0 24px;
  }

  /* Print Seal */
  .certificate-print-seal {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #F9A825;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
  }

  .certificate-print-seal-text {
    font-size: 7pt;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #F9A825;
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
  }

  /* Print Footer */
  .certificate-print-footer {
    text-align: center;
    font-size: 8pt;
    color: #90A4AE;
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
  }

  .certificate-print-id {
    font-size: 7pt;
    color: #90A4AE;
    font-family: 'Courier New', Courier, monospace;
  }

  /* Page settings */
  @page {
    size: A4 landscape;
    margin: 20mm;
  }
}
