:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --navy: #0f172a;
  --blue-soft: #dbeafe;
  --muted: #64748b;
  --soft: #f8fafc;
  --danger: #b91c1c;
  --success: #047857;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--navy);
  background: #f4f8ff;
}

.landing-body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .22), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(147, 197, 253, .28), transparent 26rem),
    linear-gradient(135deg, #eff6ff 0%, #ffffff 50%, #eaf2ff 100%);
}

.orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(18px);
  opacity: .6;
  z-index: 0;
  animation: float 8s ease-in-out infinite;
}
.orb-1 { width: 180px; height: 180px; background: rgba(37,99,235,.24); top: 8%; left: 7%; }
.orb-2 { width: 240px; height: 240px; background: rgba(96,165,250,.22); right: 6%; bottom: 8%; animation-delay: 1.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

.graduation-wrapper {
  min-height: 100vh;
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 34px 18px;
}

.hero-card {
  width: min(960px, 100%);
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(255,255,255,.88);
  box-shadow: 0 32px 90px rgba(15, 23, 42, .16);
  backdrop-filter: blur(18px);
  border-radius: 34px;
  padding: clamp(22px, 4vw, 54px);
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--primary), #60a5fa, var(--primary-dark));
}

.school-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 34px;
}
.school-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  background: white;
  border-radius: 24px;
  padding: 10px;
  box-shadow: 0 14px 36px rgba(37,99,235,.14);
}
.school-brand h1 {
  font-size: clamp(1.25rem, 3vw, 2rem);
  margin: 0;
  font-weight: 800;
}

.hero-content {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 32px;
}
.badge-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: rgba(37,99,235,.10);
  font-weight: 800;
  font-size: .86rem;
  margin-bottom: 16px;
}
.hero-content h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: 1.05;
  margin: 0 0 12px;
  color: #0b1220;
}
.academic-year-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  margin: 0 auto 18px;
  border-radius: 999px;
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-weight: 900;
  letter-spacing: .02em;
}
.hero-content p {
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.12rem);
  line-height: 1.8;
  margin: 0;
}

.check-form {
  width: min(680px, 100%);
  margin: 0 auto;
  background: rgba(248,250,252,.86);
  border: 1px solid #e2e8f0;
  border-radius: 26px;
  padding: 18px;
}
.form-label { font-weight: 800; color: var(--navy); }
.custom-input-group .form-control {
  border: 0;
  background: white;
  min-height: 60px;
  border-radius: 18px 0 0 18px !important;
  box-shadow: inset 0 0 0 1px #e2e8f0;
  font-weight: 700;
}
.custom-input-group .form-control:focus { box-shadow: inset 0 0 0 2px rgba(37,99,235,.45); }
.btn-submit {
  border: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 0 18px 18px 0 !important;
  padding-inline: 24px;
  font-weight: 800;
}
.form-hint { display: block; color: var(--muted); margin-top: 10px; }

.result-box {
  width: min(740px, 100%);
  margin: 26px auto 0;
  border-radius: 28px;
  padding: 26px;
  border: 1px solid #e2e8f0;
  animation: popIn .45s ease both;
}
.result-success {
  background: linear-gradient(135deg, rgba(239,246,255,.98), rgba(255,255,255,.96));
  border-color: rgba(37,99,235,.30);
}
.result-failed {
  background: linear-gradient(135deg, rgba(254,242,242,.96), rgba(248,250,252,.94));
  border-color: rgba(239,68,68,.32);
}
.result-warning {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.result-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 900;
  font-size: clamp(1.28rem, 3vw, 1.85rem);
}
.result-title .icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: white;
  box-shadow: 0 10px 30px rgba(15,23,42,.1);
}
.result-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.meta-card {
  background: white;
  border-radius: 18px;
  padding: 14px;
  border: 1px solid #e2e8f0;
}
.meta-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.meta-value { font-weight: 900; margin-top: 4px; }
.note-box { margin-top: 18px; color: #334155; line-height: 1.7; }

@keyframes popIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.footer-note {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .9rem;
  gap: 16px;
}
.footer-note a { color: var(--primary-dark); font-weight: 800; text-decoration: none; }
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.admin-body { background: #f1f5f9; min-height: 100vh; }
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #0f172a, #1d4ed8);
  color: white;
  padding: 24px;
  position: fixed;
  inset: 0 auto 0 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.sidebar-brand img { width: 52px; height: 52px; object-fit: contain; background: white; border-radius: 16px; padding: 7px; }
.sidebar-brand strong { display: block; line-height: 1.25; }
.sidebar-menu { display: grid; gap: 9px; }
.sidebar-menu a {
  color: rgba(255,255,255,.84);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
}
.sidebar-menu a:hover, .sidebar-menu a.active { background: rgba(255,255,255,.12); color: white; }
.admin-main { margin-left: 280px; width: calc(100% - 280px); padding: 28px; }
.admin-topbar {
  background: white;
  border-radius: 24px;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 14px 40px rgba(15,23,42,.06);
  margin-bottom: 22px;
}
.admin-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 14px 40px rgba(15,23,42,.05);
}
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { background: white; border-radius: 22px; padding: 22px; border: 1px solid #e2e8f0; box-shadow: 0 14px 40px rgba(15,23,42,.05); }
.stat-card small { color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.stat-card h3 { margin: 8px 0 0; font-weight: 900; }
.table td, .table th { vertical-align: middle; }
.badge-lulus { background: #dcfce7; color: #166534; }
.badge-tidak { background: #fee2e2; color: #991b1b; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0f172a, #2563eb); padding: 18px; }
.login-card { width: min(420px, 100%); background: white; border-radius: 28px; padding: 30px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.login-logo { width: 82px; height: 82px; object-fit: contain; display: block; margin: 0 auto 16px; border-radius: 22px; background: #f8fafc; padding: 10px; }

@media (max-width: 860px) {
  .school-brand { align-items: flex-start; }
  .custom-input-group { display: grid; gap: 12px; }
  .custom-input-group .form-control,
  .btn-submit { width: 100%; border-radius: 18px !important; }
  .result-meta { grid-template-columns: 1fr; }
  .footer-note { flex-direction: column; align-items: center; text-align: center; }
  .sidebar { position: static; width: 100%; border-radius: 0 0 28px 28px; }
  .admin-shell { display: block; }
  .admin-main { margin-left: 0; width: 100%; padding: 18px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .graduation-wrapper { padding: 16px 12px; align-items: start; }
  .hero-card { border-radius: 26px; padding: 22px 16px; }
  .school-brand { flex-direction: column; align-items: center; text-align: center; margin-bottom: 24px; }
  .school-logo { width: 74px; height: 74px; }
  .check-form { padding: 14px; border-radius: 22px; }
  .result-box { padding: 18px; }
  .stat-grid { grid-template-columns: 1fr; }
  .admin-topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* Upgrade identitas peserta didik */
.result-pending {
  background: linear-gradient(135deg, rgba(255,247,237,.96), rgba(248,250,252,.94));
  border-color: rgba(239,68,68,.32);
}
.status-announcement {
  width: fit-content;
  max-width: 100%;
  margin: 16px auto 22px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: clamp(1.25rem, 4vw, 2.15rem);
  letter-spacing: .08em;
  font-weight: 1000;
  text-align: center;
  animation: calmBlink 1.8s ease-in-out infinite;
  box-shadow: 0 14px 34px rgba(15,23,42,.08);
}
.status-lulus {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.status-danger {
  color: #dc2626;
  background: #fff1f2;
  border: 1px solid #fecdd3;
}
@keyframes calmBlink {
  0%, 100% { opacity: 1; transform: translateY(0) scale(1); }
  50% { opacity: .62; transform: translateY(-1px) scale(1.015); }
}
.student-result-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  align-items: stretch;
  margin-top: 12px;
}
.student-photo-frame {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 28px;
  padding: 10px;
  box-shadow: 0 16px 38px rgba(37,99,235,.12);
  min-height: 220px;
  display: grid;
  place-items: center;
}
.student-photo {
  width: 100%;
  height: 100%;
  min-height: 196px;
  object-fit: cover;
  border-radius: 22px;
  background: #eff6ff;
}
.student-identity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.student-identity-grid .meta-card {
  min-height: 88px;
}
.identity-wide {
  grid-column: 1 / -1;
}
.badge-belum { background: #ffedd5; color: #c2410c; }
.admin-thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
}
.import-tips {
  background: #eff6ff;
  border: 1px dashed #93c5fd;
  color: #1e3a8a;
  border-radius: 18px;
  padding: 12px 14px;
}
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

@media (max-width: 860px) {
  .student-result-card { grid-template-columns: 1fr; }
  .student-photo-frame { width: min(220px, 100%); margin: 0 auto; }
  .student-identity-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .status-announcement { width: 100%; font-size: 1.35rem; }
  .student-photo-frame { min-height: 190px; }
  .student-photo { min-height: 170px; }
}


/* Popup hasil cek status */
.kelulusan-popup {
  border-radius: 30px !important;
  padding: 1.25rem 1.2rem 1.45rem !important;
  border: 1px solid #dbeafe;
  box-shadow: 0 28px 90px rgba(37,99,235,.16) !important;
}
.kelulusan-popup .swal2-title {
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 900;
  color: #0f172a;
}
.kelulusan-popup-html {
  margin: .35rem 0 0 !important;
}
.popup-result-wrap {
  text-align: center;
}
.popup-school-name {
  color: #1d4ed8;
  font-weight: 800;
  letter-spacing: .02em;
  margin-bottom: 10px;
}
.popup-result-title {
  font-size: clamp(1rem, 2.8vw, 1.3rem);
  font-weight: 800;
  line-height: 1.65;
  color: #0f172a;
  margin-bottom: 6px;
}
.popup-student-result-card {
  margin-top: 14px;
  text-align: left;
}
.popup-student-photo-frame {
  min-height: 240px;
}
.popup-note-box {
  margin-top: 18px;
  color: #334155;
  line-height: 1.7;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 14px 16px;
  text-align: left;
}
.kelulusan-confirm-btn {
  border-radius: 14px !important;
  padding: .85rem 1.6rem !important;
  font-weight: 800 !important;
}

@media (max-width: 640px) {
  .kelulusan-popup {
    width: calc(100% - 20px) !important;
    padding: 1rem .65rem 1.2rem !important;
    border-radius: 24px !important;
  }
  .kelulusan-popup .swal2-image {
    width: 74px !important;
    height: 74px !important;
    margin: 0 auto .8rem !important;
  }
  .popup-result-title {
    font-size: 1rem;
    line-height: 1.55;
  }
  .popup-student-photo-frame {
    min-height: 205px;
  }
}


/* Penyempurnaan khusus popup mobile: gaya kartu identitas/KTP */
.mobile-id-card-title {
  display: none;
}

@media (max-width: 640px) {
  .swal2-container {
    padding: 8px !important;
  }
  .kelulusan-popup {
    width: min(100%, 390px) !important;
    max-width: calc(100vw - 16px) !important;
    padding: .95rem .55rem 1.05rem !important;
    border-radius: 22px !important;
  }
  .kelulusan-popup .swal2-title {
    font-size: 1.15rem !important;
    line-height: 1.3 !important;
    padding: 0 .35rem !important;
  }
  .kelulusan-popup-html {
    width: 100% !important;
    overflow-x: hidden !important;
  }
  .popup-school-name {
    font-size: .88rem;
    margin-bottom: 6px;
  }
  .popup-result-title {
    font-size: .92rem;
    line-height: 1.45;
    padding: 0 4px;
    margin-bottom: 8px;
  }
  .status-announcement {
    width: auto;
    min-width: 170px;
    max-width: 100%;
    font-size: 1.08rem;
    padding: 8px 16px;
    margin: 10px auto 14px;
  }

  .popup-student-result-card {
    display: grid !important;
    grid-template-columns: 98px 1fr !important;
    grid-template-areas:
      "title title"
      "photo data";
    gap: 10px !important;
    align-items: start !important;
    margin-top: 10px !important;
    padding: 12px !important;
    border-radius: 20px !important;
    background:
      linear-gradient(135deg, rgba(37,99,235,.12), rgba(255,255,255,.98) 45%, rgba(219,234,254,.75)),
      #ffffff;
    border: 1px solid #bfdbfe;
    box-shadow: 0 16px 34px rgba(37,99,235,.13);
    position: relative;
    overflow: hidden;
  }
  .popup-student-result-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 8px;
    background: linear-gradient(90deg, #1d4ed8, #60a5fa, #2563eb);
  }
  .mobile-id-card-title {
    display: block;
    grid-area: title;
    margin-top: 4px;
    padding: 7px 8px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e3a8a;
    text-align: center;
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .08em;
    border: 1px solid #dbeafe;
  }
  .popup-student-photo-frame {
    grid-area: photo;
    width: 98px !important;
    min-height: 128px !important;
    height: 128px !important;
    margin: 0 !important;
    padding: 5px !important;
    border-radius: 14px !important;
    border: 1px solid #93c5fd;
    box-shadow: none;
    background: #ffffff;
  }
  .popup-student-photo-frame .student-photo,
  .popup-student-result-card .student-photo {
    width: 100% !important;
    height: 100% !important;
    min-height: unset !important;
    border-radius: 10px !important;
    object-fit: cover !important;
  }
  .popup-student-result-card .student-identity-grid {
    grid-area: data;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 5px !important;
    align-content: start;
  }
  .popup-student-result-card .meta-card {
    min-height: unset !important;
    padding: 5px 0 6px !important;
    border: 0 !important;
    border-bottom: 1px dashed #cbd5e1 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .popup-student-result-card .meta-card:last-child {
    border-bottom: 0 !important;
  }
  .popup-student-result-card .meta-label {
    font-size: .56rem !important;
    letter-spacing: .06em !important;
    color: #64748b !important;
    line-height: 1.2;
  }
  .popup-student-result-card .meta-value {
    font-size: .78rem !important;
    line-height: 1.25 !important;
    margin-top: 1px !important;
    color: #0f172a !important;
    font-weight: 900 !important;
    overflow-wrap: anywhere;
  }
  .popup-note-box {
    font-size: .84rem;
    padding: 10px 12px;
    border-radius: 14px;
    margin-top: 12px;
  }
  .kelulusan-confirm-btn {
    width: calc(100% - 14px);
    margin-top: 4px !important;
  }
}

@media (max-width: 360px) {
  .popup-student-result-card {
    grid-template-columns: 86px 1fr !important;
    gap: 8px !important;
    padding: 10px !important;
  }
  .popup-student-photo-frame {
    width: 86px !important;
    height: 118px !important;
    min-height: 118px !important;
  }
  .popup-student-result-card .meta-value {
    font-size: .72rem !important;
  }
}
