/**
 * Certificate Styles - Print-optimized professional certificate
 * 
 * Copyright © 2025 Glimbr Pty Ltd and Arn Todal. All Rights Reserved.
 */

/* Certificate Container */
.certificate-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.certificate-modal {
  background: white;
  border-radius: 12px;
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.certificate-actions {
  padding: 20px;
  background: #f8f8f8;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.certificate-actions h3 {
  margin: 0;
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

.certificate-buttons {
  display: flex;
  gap: 12px;
}

.btn-print,
.btn-download,
.btn-close-cert {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-print {
  background: #19c37d;
  color: white;
}

.btn-print:hover {
  background: #17b071;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 195, 125, 0.3);
}

.btn-download {
  background: #2563eb;
  color: white;
}

.btn-download:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-close-cert {
  background: #6b7280;
  color: white;
}

.btn-close-cert:hover {
  background: #4b5563;
}

/* The Actual Certificate */
.certificate {
  width: 210mm; /* A4 width */
  min-height: 297mm; /* A4 height */
  margin: 0 auto;
  padding: 40mm 30mm;
  background: white;
  position: relative;
  box-sizing: border-box;
  
  /* Classic certificate background */
  background-image: 
    linear-gradient(45deg, rgba(25, 195, 125, 0.03) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(25, 195, 125, 0.03) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(25, 195, 125, 0.03) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(25, 195, 125, 0.03) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Decorative Border */
.certificate::before {
  content: '';
  position: absolute;
  top: 15mm;
  left: 15mm;
  right: 15mm;
  bottom: 15mm;
  border: 3px solid #19c37d;
  box-shadow: 
    inset 0 0 0 2px #fff,
    inset 0 0 0 5px #19c37d,
    inset 0 0 0 7px #fff,
    inset 0 0 0 8px #d4af37;
  pointer-events: none;
}

/* Corner Ornaments */
.certificate::after {
  content: '';
  position: absolute;
  top: 15mm;
  left: 15mm;
  right: 15mm;
  bottom: 15mm;
  background-image: 
    radial-gradient(circle at 0 0, #d4af37 2px, transparent 2px),
    radial-gradient(circle at 100% 0, #d4af37 2px, transparent 2px),
    radial-gradient(circle at 0 100%, #d4af37 2px, transparent 2px),
    radial-gradient(circle at 100% 100%, #d4af37 2px, transparent 2px);
  background-size: 20px 20px;
  background-position: 0 0, 100% 0, 0 100%, 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
}

.certificate-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.certificate-header {
  margin-bottom: 30px;
}

.certificate-logo {
  font-size: 48px;
  margin-bottom: 10px;
}

.certificate-title {
  font-size: 24px;
  color: #333;
  font-weight: 300;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin: 0;
}

.certificate-subtitle {
  font-size: 48px;
  color: #19c37d;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 15px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.certificate-body {
  margin: 50px 0;
  padding: 0 40px;
}

.certificate-text {
  font-size: 18px;
  color: #555;
  line-height: 2;
  margin-bottom: 30px;
}

.certificate-recipient {
  font-size: 42px;
  color: #1a1a1a;
  font-weight: 700;
  font-family: 'Georgia', serif;
  font-style: italic;
  margin: 30px 0;
  padding: 20px 0;
  border-bottom: 2px solid #d4af37;
  border-top: 2px solid #d4af37;
  letter-spacing: 1px;
}

.certificate-course {
  font-size: 28px;
  color: #2563eb;
  font-weight: 600;
  margin: 30px 0;
  line-height: 1.4;
}

.certificate-achievement {
  font-size: 16px;
  color: #666;
  margin: 25px 0;
  line-height: 1.8;
}

.certificate-stats {
  display: flex;
  justify-content: center;
  gap: 60px;
  margin: 40px 0;
  padding: 30px;
  background: rgba(25, 195, 125, 0.05);
  border-radius: 12px;
  border: 2px solid rgba(25, 195, 125, 0.2);
}

.cert-stat {
  text-align: center;
}

.cert-stat-value {
  font-size: 32px;
  color: #19c37d;
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
}

.cert-stat-label {
  font-size: 14px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.certificate-footer {
  margin-top: 60px;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 0 60px;
}

.certificate-signature {
  text-align: center;
  flex: 1;
}

.signature-line {
  width: 200px;
  margin: 0 auto 10px;
  border-top: 2px solid #333;
  padding-top: 10px;
}

.signature-name {
  font-size: 16px;
  color: #333;
  font-weight: 600;
  margin-bottom: 4px;
}

.signature-title {
  font-size: 13px;
  color: #666;
  font-style: italic;
}

.certificate-seal {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #19c37d 0%, #17b071 100%);
  border: 5px solid #d4af37;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
}

.certificate-seal::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  border: 2px dashed #d4af37;
  opacity: 0.5;
}

.seal-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.seal-text {
  font-size: 10px;
  color: white;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.certificate-date {
  font-size: 14px;
  color: #666;
  margin-top: 40px;
}

.certificate-id {
  font-size: 11px;
  color: #999;
  margin-top: 20px;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

/* Print Styles */
@media print {
  body {
    margin: 0;
    padding: 0;
  }
  
  .certificate-overlay {
    background: none;
    position: static;
    padding: 0;
  }
  
  .certificate-modal {
    box-shadow: none;
    border-radius: 0;
    max-width: none;
    max-height: none;
  }
  
  .certificate-actions {
    display: none !important;
  }
  
  .certificate {
    width: 210mm;
    height: 297mm;
    margin: 0;
    page-break-after: always;
    box-shadow: none;
  }
  
  /* Ensure colors print properly */
  .certificate,
  .certificate * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color-adjust: exact;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .certificate {
    width: 100%;
    min-height: auto;
    padding: 20mm 15mm;
    transform: scale(0.85);
    transform-origin: top center;
  }
  
  .certificate-subtitle {
    font-size: 32px;
  }
  
  .certificate-recipient {
    font-size: 28px;
  }
  
  .certificate-course {
    font-size: 20px;
  }
  
  .certificate-stats {
    flex-direction: column;
    gap: 20px;
  }
  
  .certificate-footer {
    flex-direction: column;
    gap: 40px;
  }
  
  .certificate-actions {
    flex-direction: column;
  }
  
  .certificate-buttons {
    width: 100%;
    flex-direction: column;
  }
  
  .btn-print,
  .btn-download,
  .btn-close-cert {
    width: 100%;
  }
}

