@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@600;700&display=swap");

.certificate-page {
  background:
    radial-gradient(circle at 14% 9%, rgba(245, 158, 11, 0.16), transparent 25rem),
    radial-gradient(circle at 88% 11%, rgba(37, 99, 235, 0.12), transparent 30rem),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 54%, #eff6ff 100%);
}

.certificate-shell {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 64px 18px 80px;
}

.certificate-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  text-align: center;
}

.certificate-hero > div {
  width: 100%;
}

.certificate-hero h1 {
  margin: 8px 0 8px;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: 0;
  color: #020617;
}

.certificate-hero p {
  max-width: 680px;
  margin: 0 auto;
  color: #475569;
  font-size: 1rem;
  line-height: 1.65;
}

.certificate-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.certificate-tab,
.certificate-action {
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.certificate-tab {
  color: #475569;
  background: transparent;
}

.certificate-tab.is-active,
.certificate-action.primary {
  color: #fff;
  background: linear-gradient(135deg, #020617, #1e293b);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.24);
}

.certificate-action.secondary {
  color: #0f172a;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.certificate-action:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.certificate-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.certificate-grid.verify-only {
  grid-template-columns: minmax(280px, 720px);
  justify-content: center;
}

.certificate-grid.has-result {
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  justify-content: initial;
}

.certificate-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.11);
  overflow: hidden;
}

.certificate-card-head {
  padding: 24px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #fff, #f8fafc);
}

.certificate-card-head span {
  display: block;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.certificate-card-head h2 {
  margin: 8px 0 0;
  color: #020617;
  font-size: 1.35rem;
  line-height: 1.15;
}

.certificate-form {
  display: grid;
  gap: 15px;
  padding: 22px 24px 24px;
}

.certificate-field {
  display: grid;
  gap: 7px;
}

.certificate-field label {
  color: #334155;
  font-size: 0.84rem;
  font-weight: 800;
}

.certificate-field input,
.certificate-field select {
  width: 100%;
  min-height: 47px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  color: #0f172a;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.certificate-field input:focus,
.certificate-field select:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.16);
}

.certificate-status {
  min-height: 22px;
  color: #475569;
  font-size: 0.86rem;
  line-height: 1.45;
}

.certificate-status.good {
  color: #047857;
  font-weight: 800;
}

.certificate-status.bad {
  color: #be123c;
  font-weight: 800;
}

.certificate-finder {
  min-height: 390px;
}

.certificate-finder .certificate-card-head {
  text-align: center;
  padding-top: 34px;
  padding-bottom: 18px;
}

.certificate-finder .certificate-card-head h2 {
  font-family: "Fredoka", "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.45rem);
  line-height: 1;
  color: #020617;
}

.certificate-finder .certificate-card-head p {
  margin: 12px auto 0;
  max-width: 520px;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.55;
}

.certificate-finder .certificate-form {
  padding: 28px clamp(20px, 6vw, 54px) 34px;
}

.certificate-search-orbit {
  width: 74px;
  height: 74px;
  margin: 8px auto 18px;
  border-radius: 999px;
  border: 6px solid #e2e8f0;
  border-top-color: #2563eb;
  border-right-color: #f59e0b;
  display: none;
  animation: certificateSpin 0.9s linear infinite;
}

.certificate-searching .certificate-search-orbit {
  display: block;
}

@keyframes certificateSpin {
  to { transform: rotate(360deg); }
}

.certificate-party {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
  overflow: hidden;
}

.certificate-party-piece {
  position: absolute;
  top: -24px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: certificatePartyDrop 1.8s ease-out forwards;
}

@keyframes certificatePartyDrop {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 0; }
}

.certificate-preview-card {
  padding: 18px;
}

.certificate-preview-card.certificate-hidden {
  display: none;
}

.certificate-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.certificate-preview-top p {
  color: #64748b;
  font-weight: 800;
  font-size: 0.9rem;
}

.certificate-stage {
  display: grid;
  place-items: center;
  min-height: 560px;
  padding: clamp(10px, 2vw, 26px);
  border-radius: 20px;
  background:
    linear-gradient(45deg, rgba(226, 232, 240, 0.44) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(226, 232, 240, 0.44) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(226, 232, 240, 0.44) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(226, 232, 240, 0.44) 75%),
    #f8fafc;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  overflow: auto;
}

.summer-certificate-wrap {
  width: min(100%, 1120px);
  filter: drop-shadow(0 28px 42px rgba(15, 23, 42, 0.18));
}

.summer-certificate {
  position: relative;
  aspect-ratio: 1120 / 792;
  width: 100%;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.98), rgba(255,251,235,0.95)),
    #fffdf7;
  color: #172033;
  border-radius: 8px;
  container-type: inline-size;
  isolation: isolate;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.summer-certificate::before {
  content: "";
  position: absolute;
  inset: 3.1%;
  border: 1.5px solid rgba(217, 119, 6, 0.42);
  border-radius: 4px;
  background:
    radial-gradient(ellipse at top, rgba(37, 99, 235, 0.13) 0 16%, transparent 17%) top / 7.2% 4.2% repeat-x,
    radial-gradient(ellipse at bottom, rgba(245, 158, 11, 0.18) 0 16%, transparent 17%) bottom / 7.2% 4.2% repeat-x,
    radial-gradient(ellipse at left, rgba(22, 163, 74, 0.11) 0 16%, transparent 17%) left / 3.6% 8.6% repeat-y,
    radial-gradient(ellipse at right, rgba(217, 119, 6, 0.12) 0 16%, transparent 17%) right / 3.6% 8.6% repeat-y;
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.76),
    inset 0 0 0 6px rgba(37, 99, 235, 0.14),
    inset 0 0 0 13px rgba(245, 158, 11, 0.06);
  z-index: 2;
  pointer-events: none;
}

.summer-certificate::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0 5px, transparent 5px 15px, rgba(37, 99, 235, 0.12) 15px 20px, transparent 20px 31px) top / 100% 4.8% no-repeat,
    repeating-linear-gradient(45deg, rgba(37, 99, 235, 0.11) 0 5px, transparent 5px 15px, rgba(22, 163, 74, 0.1) 15px 20px, transparent 20px 31px) bottom / 100% 4.8% no-repeat,
    repeating-linear-gradient(45deg, rgba(245, 158, 11, 0.13) 0 5px, transparent 5px 15px, rgba(37, 99, 235, 0.09) 15px 20px, transparent 20px 31px) left / 3.8% 100% no-repeat,
    repeating-linear-gradient(135deg, rgba(22, 163, 74, 0.1) 0 5px, transparent 5px 15px, rgba(217, 119, 6, 0.12) 15px 20px, transparent 20px 31px) right / 3.8% 100% no-repeat,
    radial-gradient(circle at 12% 12%, rgba(250, 204, 21, 0.28), transparent 17%),
    radial-gradient(circle at 90% 16%, rgba(37, 99, 235, 0.14), transparent 19%),
    radial-gradient(circle at 83% 87%, rgba(22, 163, 74, 0.12), transparent 20%),
    linear-gradient(90deg, rgba(15, 23, 42, 0.06), transparent 15%, transparent 85%, rgba(15, 23, 42, 0.06));
  z-index: 0;
  pointer-events: none;
}

.summer-inner-paper {
  position: absolute;
  inset: 5.2%;
  z-index: 1;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 4px;
  box-shadow: inset 0 0 34px rgba(245, 158, 11, 0.055);
  pointer-events: none;
}

.summer-cert-bg-mark {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 47%;
  opacity: 0.052;
  transform: translate(-50%, -44%);
  z-index: 2;
}

.summer-corner {
  position: absolute;
  width: 11%;
  aspect-ratio: 1;
  z-index: 2;
  opacity: 0.34;
}

.summer-corner::before,
.summer-corner::after {
  content: "";
  position: absolute;
  background: #f59e0b;
  border-radius: 999px;
}

.summer-corner::before {
  width: 100%;
  height: 3%;
}

.summer-corner::after {
  width: 3%;
  height: 100%;
}

.summer-corner.tl { top: 5.1%; left: 5.1%; }
.summer-corner.tr { top: 5.1%; right: 5.1%; transform: rotate(90deg); }
.summer-corner.bl { bottom: 5.1%; left: 5.1%; transform: rotate(270deg); }
.summer-corner.br { right: 5.1%; bottom: 5.1%; transform: rotate(180deg); }

.summer-cert-content {
  position: relative;
  z-index: 3;
  height: 100%;
  padding: 5.6% 7.4% 5.2%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 2.2%;
  text-align: center;
}

.summer-cert-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.3%;
  min-width: 0;
}

.summer-cert-logo {
  width: 8.6%;
  min-width: 50px;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
}

.summer-school-name {
  font-family: Montserrat, Inter, Arial, sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 3.15cqw, 35px);
  line-height: 1;
  color: #020617;
}

.summer-school-sub {
  margin-top: 0.45em;
  color: #64748b;
  font-size: clamp(8px, 1.08cqw, 12px);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.summer-season-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(22px, 3.2cqw, 36px);
  padding: 0 2.4%;
  border-radius: 999px;
  color: #92400e;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid rgba(245, 158, 11, 0.36);
  font-size: clamp(8px, 1.15cqw, 13px);
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.summer-cert-title h2 {
  margin: 1.1% 0 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(31px, 6.3cqw, 70px);
  line-height: 0.95;
  color: #020617;
}

.summer-cert-title p {
  margin: 0.9% auto 0;
  max-width: none;
  color: #475569;
  font-size: clamp(9px, 1.42cqw, 16px);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.summer-cert-main {
  align-self: center;
  display: grid;
  gap: 4.1%;
}

.summer-student-label {
  color: #64748b;
  font-size: clamp(9px, 1.2cqw, 14px);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.summer-student-name {
  margin: 0 auto;
  width: min(82%, 820px);
  min-height: 1.35em;
  border-bottom: 2px solid rgba(217, 119, 6, 0.45);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(32px, 6.8cqw, 76px);
  font-weight: 700;
  line-height: 1.06;
  color: #111827;
  overflow-wrap: anywhere;
}

.summer-cert-copy {
  margin: 0 auto;
  max-width: 79%;
  color: #334155;
  font-size: clamp(11px, 1.55cqw, 17px);
  font-weight: 500;
  line-height: 1.62;
}

.summer-cert-copy strong {
  color: #020617;
  font-weight: 800;
}

.summer-details-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5%;
  width: 78%;
  margin: 0 auto;
}

.summer-detail-box {
  min-width: 0;
  padding: 3.7% 4%;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(203, 213, 225, 0.78);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.summer-detail-box span {
  display: block;
  color: #64748b;
  font-size: clamp(7px, 0.92cqw, 10px);
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.summer-detail-box strong {
  display: block;
  margin-top: 0.38em;
  color: #020617;
  font-size: clamp(10px, 1.35cqw, 15px);
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.summer-cert-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 4.2%;
  align-items: end;
}

.summer-signature-block {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
}

.summer-signature-img {
  height: clamp(31px, 5.2cqw, 58px);
  width: min(78%, 230px);
  object-fit: contain;
  object-position: center bottom;
  mix-blend-mode: multiply;
}

.summer-coo-signature {
  height: clamp(36px, 6.1cqw, 68px);
  width: min(86%, 250px);
}

.summer-signature-line {
  width: 84%;
  border-top: 1.5px solid #334155;
  padding-top: 0.45em;
  color: #020617;
  font-size: clamp(8px, 1.05cqw, 12px);
  font-weight: 900;
  line-height: 1.2;
}

.summer-cert-center {
  display: grid;
  justify-items: center;
  gap: clamp(3px, 0.55cqw, 6px);
  align-self: end;
  min-width: 0;
}

.summer-edtech-tag {
  min-height: clamp(24px, 3.8cqw, 42px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1cqw, 10px);
  color: #0f172a;
  white-space: nowrap;
  font-size: clamp(8px, 1.15cqw, 13px);
  font-weight: 600;
  letter-spacing: 0.04em;
  transform: translateY(clamp(8px, 1.15cqw, 13px));
}

.summer-edtech-tag strong {
  font-weight: 900;
}

.summer-edtech-tag svg {
  width: clamp(14px, 2.1cqw, 24px);
  height: clamp(14px, 2.1cqw, 24px);
  color: #000;
  flex: 0 0 auto;
}

.summer-address-line {
  width: max-content;
  max-width: 260px;
  color: #64748b;
  font-size: clamp(7px, 0.92cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
}

.certificate-hidden {
  display: none !important;
}

body.certificate-pdf-exporting .summer-certificate-wrap {
  width: 1120px !important;
  max-width: none !important;
  filter: none !important;
}

body.certificate-pdf-exporting .summer-certificate {
  width: 1120px !important;
  height: 792px !important;
  border-radius: 0 !important;
}

.certificate-export-host {
  position: fixed;
  left: -200vw;
  top: 0;
  width: 1120px;
  height: 792px;
  overflow: hidden;
  background: #fff;
  pointer-events: none;
  z-index: -1;
}

.certificate-export-host .summer-certificate {
  width: 1120px !important;
  height: 792px !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: none !important;
}

@container (max-width: 420px) {
  .summer-cert-content { padding: 5.3% 6.3% 6.2%; gap: 1.4%; }
  .summer-cert-logo { min-width: 0; width: 7.4%; }
  .summer-school-name { font-size: 3.35cqw; }
  .summer-school-sub,
  .summer-season-pill,
  .summer-student-label,
  .summer-detail-box span,
  .summer-address-line { font-size: 1.25cqw; }
  .summer-season-pill { min-height: 3.2cqw; padding: 0 2%; }
  .summer-cert-title h2 { font-size: 6.6cqw; }
  .summer-cert-title p { font-size: 1.55cqw; line-height: 1.25; }
  .summer-cert-main { gap: 2.4%; }
  .summer-student-name { width: 78%; font-size: 6.7cqw; }
  .summer-cert-copy { max-width: 84%; font-size: 1.75cqw; line-height: 1.34; }
  .summer-details-row { width: 78%; gap: 0.8%; }
  .summer-detail-box { padding: 2.2% 2%; border-radius: 4px; }
  .summer-detail-box strong { font-size: 1.55cqw; }
  .summer-signature-img { height: 5.6cqw; }
  .summer-coo-signature { height: 6.4cqw; }
  .summer-signature-line { font-size: 1.25cqw; }
  .summer-edtech-tag { min-height: 3.8cqw; gap: 1cqw; font-size: 1.35cqw; }
  .summer-edtech-tag svg { width: 2.1cqw; height: 2.1cqw; }
  .summer-address-line { width: 30cqw; max-width: none; }
}

@media (max-width: 1050px) {
  .certificate-hero {
    align-items: flex-start;
    flex-direction: column;
  }
  .certificate-grid {
    grid-template-columns: 1fr;
  }
  .certificate-stage {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .certificate-page {
    overflow-x: hidden;
  }
  .certificate-shell {
    padding: 38px 14px 58px;
  }
  .certificate-grid,
  .certificate-grid.has-result,
  .certificate-grid.verify-only {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    width: 100%;
    overflow: visible;
  }
  .certificate-finder {
    order: 1;
  }
  .certificate-preview-card {
    order: 2;
    width: 100%;
    min-width: 0;
    padding: 12px;
  }
  .certificate-tabs,
  .certificate-preview-top {
    width: 100%;
  }
  .certificate-tab,
  .certificate-action {
    flex: 1 1 auto;
  }
  .certificate-preview-top {
    align-items: stretch;
    flex-direction: column;
  }
  .certificate-stage {
    padding: 10px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    border-radius: 16px;
  }
  .summer-certificate-wrap {
    width: 100%;
    max-width: calc(100vw - 52px);
    filter: drop-shadow(0 18px 28px rgba(15, 23, 42, 0.16));
  }
  .summer-certificate {
    width: 100%;
  }
}

@media print {
  @page {
    size: letter landscape;
    margin: 0;
  }

  body.certificate-print-mode {
    background: #fff !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  body.certificate-print-mode #navbar,
  body.certificate-print-mode #main-content > .page-section:not(#page-certificate),
  body.certificate-print-mode #page-certificate .certificate-hero,
  body.certificate-print-mode #certificateVerifyPanel,
  body.certificate-print-mode .certificate-preview-top,
  body.certificate-print-mode .chitran-contact-stack,
  body.certificate-print-mode #chitran-ai-chat,
  body.certificate-print-mode #custom-cursor-dot,
  body.certificate-print-mode #custom-cursor-ring,
  body.certificate-print-mode #back-to-top,
  body.certificate-print-mode #loader,
  body.certificate-print-mode > footer {
    display: none !important;
  }

  body.certificate-print-mode #main-content,
  body.certificate-print-mode #page-certificate,
  body.certificate-print-mode .certificate-page,
  body.certificate-print-mode .certificate-shell,
  body.certificate-print-mode .certificate-grid,
  body.certificate-print-mode #certificateResultPanel,
  body.certificate-print-mode #certificatePrintArea {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    min-height: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    overflow: visible !important;
  }

  body.certificate-print-mode #certificatePrintArea {
    width: 100vw !important;
    height: 100vh !important;
    page-break-before: avoid !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  body.certificate-print-mode .summer-certificate-wrap {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    filter: none !important;
    overflow: hidden !important;
    page-break-inside: avoid !important;
  }

  body.certificate-print-mode .summer-certificate {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    page-break-inside: avoid !important;
  }
}
