/* Modal base */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 90%;
  max-width: 500px;
  background: white;
  border-radius: 12px;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: all 0.35s ease;
  z-index: 9999; /* 🔥 FIX UTAMA */
  pointer-events: none;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

#modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

#modalOverlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Modal aktif */
.modal.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Modal header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
}

/* Close button */
.close-btn {
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

/* Content scroll */
.modal-content {
  overflow-y: auto;
  padding: 16px;
}

/* Drag handle (mobile only) */
.drag-handle {
  width: 48px;
  height: 5px;
  background: #e5e7eb;
  border-radius: 999px;
  margin: 8px auto;
  display: none;
}

/* Input */
.form-input {
  width: 100%;
  border: 1px solid #d1d5db;
  padding: 12px 16px;
  border-radius: 12px;
  transition: border 0.2s, box-shadow 0.2s;
}

.form-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 1px #ef4444;
}

/* Error text */
.error-text {
  font-size: 12px;
  color: #ef4444;
}

/* Submit button */
button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
button.enabled {
  background: #16a34a;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .modal {
    width: 100%;
    height: 100%;
    border-radius: 0;
    bottom: 0;
    left: 0;
    top: auto;
    transform: translateY(100%);
    max-height: 100%;
    flex: 1;
  }

  .modal.active {
    transform: translateY(0);
  }

  .drag-handle { display: block; }
}
