/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;0,700;1,400&display=swap');

:root {
  /* Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-dark: #047857;
  --success-light: #ecfdf5;
  --bg-gradient-start: #f8fafc;
  --bg-gradient-end: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(255, 255, 255, 0.5);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--text-main);
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  padding: 2rem 1rem;
  line-height: 1.5;
  position: relative;
}

/* Background decorative blur shapes */
body::before, body::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
}
body::before {
  top: 10%;
  left: 10%;
}
body::after {
  bottom: 10%;
  right: 10%;
}

/* Container & Layout */
.container {
  width: 100%;
  max-width: 640px;
  perspective: 1000px;
}

/* Verification Card */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-xl);
  text-align: left;
  transform: translateY(0);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
  animation: slideUpFade 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 40px -15px rgba(0, 0, 0, 0.1);
}

/* Header & Status */
.status-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.badge-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--success-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.1);
  animation: pulseSuccess 2s infinite;
}

.status-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.025em;
}

/* Certificate Info Details */
.student-name {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0.5rem 0 1.75rem 0;
  letter-spacing: -0.03em;
  background: linear-gradient(to right, #1d4ed8, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.salutation {
  font-size: 1.125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.appreciation-lead {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 1.25rem;
}

.recognition-text {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* Certificate Links */
.certificate-links {
  background: var(--primary-light);
  border: 1px dashed rgba(37, 99, 235, 0.2);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cert-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  background: #ffffff;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.cert-link-item:hover {
  border-color: var(--primary);
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.cert-link-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cert-link-icon {
  color: var(--primary);
  display: flex;
}

.cert-link-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--primary);
}

.cert-arrow-icon {
  color: var(--primary);
  opacity: 0.5;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.cert-link-item:hover .cert-arrow-icon {
  transform: translateX(3px);
  opacity: 1;
}

/* Actions Section */
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  padding-top: 1.75rem;
}

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-light);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--text-muted);
}

.btn-outline:hover {
  background: rgba(15, 23, 42, 0.05);
  color: var(--text-main);
  border-color: var(--text-main);
}

/* --- Certificate View Specific Styles --- */
.cert-page-container {
  max-width: 1000px;
  width: 100%;
}

.cert-outer-wrapper {
  background: #ffffff;
  padding: 3rem;
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.8s ease-out;
}

/* Elegant border for certificate */
.cert-border-double {
  border: 8px double #d4af37; /* Gold double border */
  padding: 3rem;
  position: relative;
}

/* Ornate corner flourishes (SVG or generated via CSS) */
.cert-corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 4px solid #d4af37;
  pointer-events: none;
}
.cert-corner-tl { top: 15px; left: 15px; border-right: none; border-bottom: none; }
.cert-corner-tr { top: 15px; right: 15px; border-left: none; border-bottom: none; }
.cert-corner-bl { bottom: 15px; left: 15px; border-right: none; border-top: none; }
.cert-corner-br { bottom: 15px; right: 15px; border-left: none; border-top: none; }

.cert-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cert-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-main);
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
}

.cert-logo span {
  color: var(--primary);
}

.cert-title {
  font-family: var(--font-serif);
  font-size: 3rem;
  color: #0f172a;
  margin-bottom: 1rem;
  font-style: italic;
}

.cert-subtitle {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.cert-recipient-intro {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.cert-recipient-name {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  color: #1e3a8a;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.5rem;
  width: 80%;
  max-width: 600px;
  letter-spacing: -0.02em;
}

.cert-statement {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 650px;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.cert-statement strong {
  color: var(--text-main);
}

/* Certificate Signatures and Badges */
.cert-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
  width: 100%;
  max-width: 800px;
  margin-top: 2rem;
  align-items: flex-end;
}

.cert-sig-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cert-signature {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.75rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
  height: 45px;
  display: flex;
  align-items: flex-end;
}

.cert-sig-line {
  width: 100%;
  height: 1px;
  background: var(--text-muted);
  margin-bottom: 0.5rem;
}

.cert-sig-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.cert-badge-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 120px;
}

/* Gold foil seal */
.gold-seal {
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, #f3e5ab 0%, #d4af37 50%, #aa7c11 100%);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15), inset 0 0 8px rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.gold-seal::before {
  content: '';
  position: absolute;
  width: 90px;
  height: 90px;
  border: 2px dashed #8b6508;
  border-radius: 50%;
}

.gold-seal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8b6508;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
}

.gold-seal-inner svg {
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
  fill: #8b6508;
}

/* Seal ribbons */
.seal-ribbon {
  position: absolute;
  width: 24px;
  height: 70px;
  background: #b91c1c; /* Crimson ribbons */
  bottom: -20px;
  z-index: 1;
  box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.2);
}

.seal-ribbon-left {
  left: 42%;
  transform: rotate(15deg);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 85%, 0 100%);
}

.seal-ribbon-right {
  right: 42%;
  transform: rotate(-15deg);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 85%, 0 100%);
}

/* Verification details footer */
.cert-footer-info {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #f1f5f9;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cert-qr-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cert-qr-image {
  width: 80px;
  height: 80px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 4px;
  border-radius: 6px;
}

.cert-qr-text {
  text-align: left;
  line-height: 1.4;
}

.cert-id {
  font-family: monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Page action container (Back / Print buttons) */
.cert-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Animations */
@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulseSuccess {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Media Queries */
@media (max-width: 768px) {
  body {
    padding: 1rem 0.5rem;
  }
  
  .card {
    padding: 2rem 1.5rem;
    border-radius: 16px;
  }
  
  .status-title {
    font-size: 1.5rem;
  }
  
  .student-name {
    font-size: 1.75rem;
  }
  
  .cert-outer-wrapper {
    padding: 1.5rem;
  }
  
  .cert-border-double {
    padding: 1.5rem 1rem;
  }
  
  .cert-title {
    font-size: 2.25rem;
  }
  
  .cert-recipient-name {
    font-size: 2rem;
    width: 95%;
  }
  
  .cert-meta-row {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    align-items: center;
  }
  
  .cert-sig-box {
    width: 70%;
    margin: 0 auto;
  }
  
  .cert-footer-info {
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    text-align: center;
  }

  .cert-qr-container {
    flex-direction: column;
    text-align: center;
  }
  
  .cert-qr-text {
    text-align: center;
  }
}

/* Sapphire Global Specific Certificate Styles */
.cert-outer-wrapper.cert-sapphire {
  background: #ffffff;
  padding: 4rem 6rem;
  border-radius: 0;
  border: 1px solid #1e293b;
  border-left: 28px solid #ef4444; /* Thick solid red side border */
  border-right: 28px solid #ef4444; /* Thick solid red side border */
  box-shadow: var(--shadow-xl);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.8s ease-out;
}

.cert-sapphire .cert-header {
  margin-top: 1rem;
  margin-bottom: 3.5rem;
  text-align: center;
}

.cert-sapphire .cert-issuer {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.12em;
  color: #000000;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.cert-sapphire .cert-main-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3.75rem;
  color: #000000;
  letter-spacing: 0.05em;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.cert-sapphire .cert-sub-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: 0.35em;
  color: #000000;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.cert-sapphire .cert-recipient-intro {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.cert-sapphire .cert-recipient-name {
  font-family: var(--font-serif);
  font-size: 4.5rem;
  font-weight: 500;
  color: #000000;
  margin-bottom: 2rem;
  border-bottom: none;
  padding-bottom: 0;
  width: 100%;
  max-width: none;
  letter-spacing: 0;
}

.cert-sapphire .cert-statement {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  color: #475569;
  max-width: 760px;
  line-height: 1.8;
  margin-bottom: 3.5rem;
}

.cert-sapphire .cert-statement strong {
  color: #0f172a;
  font-weight: 700;
}

.cert-sapphire .cert-meta-row {
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  gap: 2rem;
  width: 100%;
  max-width: 800px;
  margin-top: 1rem;
  align-items: center;
}

.cert-sapphire .cert-sig-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cert-sapphire .cert-signature {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.25rem;
  color: #000000;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  height: auto;
  font-style: normal;
}

.cert-sapphire .cert-sig-line {
  width: 85%;
  height: 2px;
  background: #000000;
  margin-bottom: 0.5rem;
}

.cert-sapphire .cert-sig-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* Top-left absolute QR code placement */
.cert-sapphire .cert-qr-topleft {
  position: absolute;
  top: 3.5rem;
  left: 5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.cert-sapphire .cert-qr-topleft img {
  width: 96px;
  height: 96px;
  border: 1px solid #e2e8f0;
  padding: 4px;
  background: #ffffff;
}

.cert-sapphire .cert-qr-topleft-text {
  font-size: 0.65rem;
  color: var(--text-muted);
  max-width: 110px;
  line-height: 1.3;
}

/* Print CSS Styles */
@media print {
  body {
    background: #ffffff;
    color: #000000;
    padding: 0;
    margin: 0;
    justify-content: flex-start;
  }
  
  body::before, body::after {
    display: none;
  }
  
  .cert-page-container {
    max-width: 100%;
    margin: 0;
  }
  
  .cert-outer-wrapper {
    box-shadow: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
    background: transparent;
  }

  .cert-outer-wrapper.cert-sapphire {
    border: none !important;
    border-left: 28px solid #ef4444 !important;
    border-right: 28px solid #ef4444 !important;
    padding: 2rem 4rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .cert-border-double {
    border-width: 6px;
    padding: 2rem;
  }
  
  .cert-actions {
    display: none !important; /* Hide print/back buttons on actual printout */
  }

  .seal-ribbon {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .cert-sapphire .cert-qr-topleft {
    top: 1.5rem;
    left: 2rem;
  }
}
