/* ================= LAYER SYSTEM ================= */

:root {
  --z-modal-base: 1000;
  --z-modal-alert: 1100;
  --z-loading: 2000;
}

/* ===== MODAL SYSTEM ===== */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: var(--z-modal-base);
}

.modal.active {
  display: flex;
}

/* Confirm & Verify */
#confirmModal,
#verifyModal {
  z-index: var(--z-modal-base);
}

/* Alert selalu di atas confirm */
#alertModal {
  z-index: var(--z-modal-alert);
}

.modal-card{
  background:#ffffff;
  border-radius:20px;
  padding:28px;
  box-shadow:0 25px 60px rgba(0,0,0,0.4);
  animation:scaleIn .25s ease;
}

@keyframes scaleIn{
  from{transform:scale(.95);opacity:0;}
  to{transform:scale(1);opacity:1;}
}

.modal-card button {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: #2563eb;
  color: white;
  cursor: pointer;
}

/* ===== LOADING ===== */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: var(--z-loading);
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 45px;
  height: 45px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

/* ===== CAPTCHA ===== */

.captcha-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.captcha-wrapper canvas {
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.captcha-refresh {
  cursor: pointer;
  font-size: 18px;
  user-select: none;
}

.modal-card{
  max-width:90%;
  padding:32px 28px;

  width:340px;
  text-align:center; /* isi tetap rapi */
}

#alertModal .modal-card,
#confirmModal .modal-card,
#verifyModal .modal-card{
  display:flex;
  flex-direction:column;
  gap:15px;
}