:root {
  --navy: #0b1f3a;
  --navy-deep: #061833;
  --blue: #1d4ed8;
  --blue-hover: #1e40af;
  --blue-soft: #eff6ff;
  --teal: #0099a8;
  --gold: #c59b27;
  --gold-soft: #fef9e7;
  --green: #047857;
  --green-bg: #ecfdf5;
  --green-border: #a7f3d0;
  --red: #b91c1c;
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --surface: #ffffff;
  --bg: #f4f7fb;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #dbe3ef;
  --shadow-lg: 0 22px 50px -12px rgba(11, 31, 58, 0.14);
  --shadow-sm: 0 2px 8px rgba(11, 31, 58, 0.06);
  --radius-lg: 20px;
  --radius-md: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* Background Atmosphere */
.bg-backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.45;
}

.bg-orb-top {
  width: 560px;
  height: 560px;
  top: -220px;
  right: -120px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.25), rgba(197, 155, 39, 0.12) 60%, transparent 75%);
}

.bg-orb-bottom {
  width: 500px;
  height: 500px;
  bottom: -200px;
  left: -140px;
  background: radial-gradient(circle, rgba(11, 31, 58, 0.16), transparent 72%);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(11, 31, 58, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 31, 58, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at center, black 35%, transparent 80%);
}

/* Main Page Shell */
.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 28px;
}

/* Brand Header & Dual Crest Lockup */
.brand-header {
  width: 100%;
  max-width: 680px;
  margin-bottom: 24px;
}

.brand-lockup {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
}

.brand-center {
  text-align: center;
  min-width: 0;
}

.crest-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.brand-logo {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(11, 31, 58, 0.08));
}

.brand-logo-pu {
  height: 78px;
}

.brand-logo-society {
  height: 66px;
}

.event-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  box-shadow: 0 6px 16px rgba(11, 31, 58, 0.2);
}

.event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.28);
}

.event-tagline {
  margin: 10px 0 5px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--teal);
  text-transform: uppercase;
}

.org-title {
  margin: 0;
  font-size: clamp(1.38rem, 3vw, 1.95rem);
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1.18;
}

.org-subtitle {
  margin: 4px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Portal Card */
.portal-main {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.portal-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border-top: 4px solid var(--navy);
}

/* Demo Mode Banner */
.demo-banner {
  background: var(--gold-soft);
  border-bottom: 1px solid #f0dc98;
  padding: 12px 24px;
  font-size: 0.84rem;
  color: #715209;
}

.demo-banner-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.45;
}

.demo-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--gold);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.demo-banner code {
  background: rgba(113, 82, 9, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
}

.demo-chips {
  margin-top: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.demo-chips-label {
  font-weight: 700;
  font-size: 0.78rem;
  margin-right: 2px;
}

.demo-chip {
  appearance: none;
  border: 1px solid #e0c36a;
  background: #ffffff;
  color: #5c4306;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.demo-chip:hover {
  background: #fffbeb;
  transform: translateY(-1px);
}

/* Card Sections */
.card-section {
  padding: 32px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
}

.card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

.card-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.card-subtitle {
  margin: 4px 0 0;
  font-size: 0.94rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Form Elements */
.portal-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy);
}

.form-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: #fbfcfe;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--blue);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

.form-input::placeholder {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.9rem;
  color: #94a3b8;
}

.mono-input {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

/* Alerts */
.alert-error {
  padding: 12px 15px;
  border-radius: var(--radius-md);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  font-size: 0.89rem;
  font-weight: 600;
  line-height: 1.45;
}

/* Buttons */
.btn-primary,
.btn-download,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  padding: 13px 20px;
  border: none;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  color: #ffffff;
  box-shadow: 0 10px 22px -8px rgba(29, 78, 216, 0.45);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -8px rgba(29, 78, 216, 0.55);
}

.btn-primary:disabled,
.btn-download:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.btn-download {
  padding: 13px 20px;
  border: none;
  background: var(--green);
  color: #ffffff;
  box-shadow: 0 10px 22px -8px rgba(4, 120, 87, 0.45);
}

.btn-download:hover:not(:disabled) {
  background: #065f46;
  transform: translateY(-1px);
}

.btn-download svg {
  width: 20px;
  height: 20px;
}

.btn-secondary {
  padding: 12px 18px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  color: var(--navy);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Result State */
.result-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  margin-bottom: 20px;
}

.result-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.status-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-icon svg {
  width: 19px;
  height: 19px;
}

.result-heading {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: #064e3b;
}

.student-identity {
  margin: 3px 0 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--navy);
}

.certificate-category {
  margin: 2px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.verified-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--green-border);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
}

.verified-badge svg {
  width: 15px;
  height: 15px;
}

/* Preview Frame */
.preview-frame {
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fafc;
  padding: 12px;
  margin-bottom: 20px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-loading {
  width: 100%;
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.preview-shimmer {
  width: 100%;
  height: 180px;
  border-radius: 10px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.certificate-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.certificate-pdf {
  width: 100%;
  height: 420px;
  border: none;
  border-radius: 8px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Trust Strip & Footer */
.trust-strip {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.trust-item svg {
  width: 14px;
  height: 14px;
  color: var(--navy);
}

.trust-sep {
  color: #94a3b8;
}

.portal-footer {
  margin-top: 26px;
  text-align: center;
}

.footer-brand {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 0.02em;
}

.footer-note {
  margin: 5px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Mobile Layout (clear dual-crest arrangement + crisp readability on 360px+ phones) */
@media (max-width: 600px) {
  .page-shell {
    padding: 20px 14px 24px;
    justify-content: flex-start;
  }

  .brand-header {
    margin-bottom: 18px;
  }

  .brand-lockup {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 12px 14px;
    justify-items: center;
  }

  .crest-pu {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
  }

  .crest-society {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
  }

  .brand-center {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .brand-logo-pu {
    height: 60px;
  }

  .brand-logo-society {
    height: 52px;
  }

  .event-tagline {
    font-size: 0.7rem;
    letter-spacing: 0.16em;
  }

  .org-title {
    font-size: 1.38rem;
  }

  .org-subtitle {
    font-size: 0.88rem;
  }

  .card-section {
    padding: 20px 16px;
  }

  .card-head {
    gap: 12px;
    margin-bottom: 18px;
  }

  .card-title {
    font-size: 1.18rem;
  }

  .card-subtitle {
    font-size: 0.88rem;
  }

  .demo-banner {
    padding: 12px 16px;
  }

  .result-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
  }

  .preview-frame {
    padding: 8px;
    min-height: 160px;
  }

  .trust-sep {
    display: none;
  }

  .trust-strip {
    gap: 8px 14px;
    font-size: 0.76rem;
  }
}
