/* ============================================================
   Submit Plane — tombol Kumpulkan Ujian "Dilipat Jadi Pesawat"
   Lembar jawaban terlipat menyusut menjadi pesawat kertas, lalu
   pesawatnya terbang pergi; tombol berubah jadi "✓ Terkumpul"
   (centang digambar dari kiri ke kanan).

   Warna cahaya (glow) OTOMATIS mengikuti warna tombol oleh
   submit-plane.js — CSS ini tidak memaksa warna latar tombol.

   Markup tombol yang dibutuhkan:
   <button class="btn-plane [kelas tombol yang sudah ada]">
     <span class="sub-stage">
       <svg class="sub-sheet" viewBox="0 0 24 24" fill="none" stroke="currentColor"
            stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round">
         <path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"/>
         <path d="M14 3v5h5"/>
         <path d="M8.5 13h7M8.5 16.5h7" opacity=".65"/>
       </svg>
       <svg class="sub-plane" viewBox="0 0 24 24" fill="none" stroke="currentColor"
            stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round">
         <path d="m22 2-7 20-4-9-9-4Z"/>
         <path d="M22 2 11 13"/>
       </svg>
     </span>
     <span class="sub-label">Kumpulkan</span>
     <span class="sub-done">
       <svg class="sub-ck" viewBox="0 0 24 24" fill="none" stroke="currentColor"
            stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
         <path pathLength="100" d="M4 12.5 9.5 18 20 6.5"/>
       </svg>
       <span>Terkumpul</span>
     </span>
   </button>
   ============================================================ */

.btn-plane {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(95deg, #15803d, #22c55e) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(21, 128, 61, 0.28) !important;
  transition: all .2s ease;
  text-decoration: none;
  --acc-rgb: 21, 128, 61;
}

.btn-plane:hover {
  background: linear-gradient(95deg, #166534, #16a34a) !important;
  box-shadow: 0 6px 18px rgba(21, 128, 61, 0.38) !important;
  transform: translateY(-1px);
}

.btn-plane:active {
  transform: translateY(0);
}

.btn-plane:disabled {
  opacity: 0.88 !important;
  cursor: wait !important;
  transform: none !important;
}

/* Loading Bar Pesawat Selesai Ujian */
.btn-plane .pl-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4.5px;
  width: 0;
  background: #fff;
  border-radius: 0 4px 4px 0;
  pointer-events: none;
}
.btn-plane.is-playing .pl-bar {
  animation: pl-fill 1.55s linear forwards;
}
@keyframes pl-fill {
  to { width: 100%; }
}
.btn-plane.is-done .pl-bar {
  width: 100%;
}

.btn-plane .sub-stage { position: relative; width: 26px; height: 26px; flex: none; }
.btn-plane .sub-sheet,
.btn-plane .sub-plane {
  position: absolute;
  inset: 0;
  width: 26px;
  height: 26px;
  overflow: visible;
  display: block;
}
.btn-plane .sub-plane { opacity: 0; }

/* Tahap 1: lembar terlipat menyusut */
.btn-plane.is-playing .sub-sheet { animation: sub-fold .48s ease-in forwards; }

@keyframes sub-fold {
  0%   { transform: scale(1) rotate(0deg); opacity: 1; }
  100% { transform: scale(.55) rotate(-14deg) skewY(-10deg); opacity: 0; }
}

/* Tahap 2: pesawat muncul lalu terbang */
.btn-plane.is-playing .sub-plane { animation: sub-fly 1.05s ease-in forwards; }

@keyframes sub-fly {
  0%, 42% { opacity: 0; transform: translate(0, 0) rotate(0deg) scale(.7); }
  52%     { opacity: 1; transform: translate(1px, -1px) rotate(0deg) scale(1); }
  100%    { opacity: 0; transform: translate(32px, -20px) rotate(20deg) scale(1); }
}

/* Status berhasil */
.btn-plane .sub-done { display: none; align-items: center; gap: 8px; }
.btn-plane .sub-ck { width: 18px; height: 18px; flex: none; }
.btn-plane .sub-ck path { stroke-dasharray: 100; stroke-dashoffset: 100; }

.btn-plane.is-done .sub-stage,
.btn-plane.is-done .sub-label { display: none; }
.btn-plane.is-done .sub-done { display: inline-flex; animation: sub-pop .32s cubic-bezier(.34, 1.56, .64, 1); }
.btn-plane.is-done .sub-ck path { animation: sub-draw .5s cubic-bezier(.65, 0, .35, 1) forwards; }
.btn-plane.is-done { box-shadow: 0 0 22px 4px rgba(var(--acc-rgb), .45); }

@keyframes sub-pop {
  0% { opacity: 0; transform: scale(.55); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes sub-draw { to { stroke-dashoffset: 0; } }

.btn-plane:disabled { cursor: wait; }

@media (prefers-reduced-motion: reduce) {
  .btn-plane.is-playing .sub-sheet,
  .btn-plane.is-playing .sub-plane,
  .btn-plane.is-done .sub-done,
  .btn-plane.is-done .sub-ck path { animation: none; }
  .btn-plane.is-done .sub-ck path { stroke-dashoffset: 0; }
}
