/* ==========================================================================
   Modal Dialogs
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-xl);
  animation: modalOverlayIn 0.2s ease;
}

.modal-overlay--closing {
  animation: modalOverlayOut 0.15s ease forwards;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(60px);
  -webkit-backdrop-filter: blur(60px);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-glass);
  padding: var(--sp-xl) var(--sp-2xl);
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay--closing .modal {
  animation: modalOut 0.15s ease forwards;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
}

.modal__title {
  font-size: 18px;
  font-weight: 700;
}

.modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--muted-text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal__close:hover {
  background: var(--glass-bg-secondary);
  color: var(--base-text);
}

.modal__body {
  margin-bottom: var(--sp-lg);
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-sm);
}

/* ---------- Confirm body ---------- */
.modal__confirm-text {
  font-size: 14px;
  color: var(--base-text);
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalOverlayOut {
  to { opacity: 0; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modalOut {
  to { opacity: 0; transform: scale(0.95) translateY(10px); }
}

@media (max-width: 480px) {
  .modal {
    border-radius: var(--radius-2xl);
    padding: var(--sp-lg) var(--sp-base);
    max-height: 90vh;
  }

  .modal-overlay {
    padding: var(--sp-md);
  }
}
