/* Modal Component - Dialog boxes for forms */

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal:not(.hidden) {
  display: flex;
}

.modal .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.modal .modal-card {
  position: relative;
  width: min(92vw, 420px);
  max-width: 92vw;
  background: #fff;
  color: #222;
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  padding: 1rem 1rem 0.75rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-form h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.modal-form input[type="text"],
.modal-form input[type="number"],
.modal-form input[type="email"],
.modal-form select {
  border: 1px solid #ccc;
  border-radius: var(--br-md);
  padding: 0.5rem 0.65rem;
  font-size: 1rem;
  font-family: inherit;
}

.modal-form input[type="text"]:focus,
.modal-form input[type="number"]:focus,
.modal-form input[type="email"]:focus,
.modal-form select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.modal-actions button {
  padding: 0.5rem 0.9rem;
  border-radius: var(--br-md);
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
}

.modal-actions button.primary {
  background: #111;
  color: #fff;
}

.modal-actions button.primary:hover {
  background: #333;
}

.modal-actions button:not(.primary) {
  background: var(--grey-lighter);
  color: #111;
}

.modal-actions button:not(.primary):hover {
  background: #e0e0e0;
}

/* Success Modal */
.success-modal-card {
  text-align: center;
  padding: 2.5rem 2rem;
  max-width: 400px;
  border-radius: 12px;
  background: #fff;
  animation: modalScaleContent 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal:not(.hidden) .modal-backdrop {
  animation: modalFadeBackdrop 0.2s ease-out;
}

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

@keyframes modalScaleContent {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.success-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.success-icon {
  margin-bottom: 1.2rem;
  display: flex;
  justify-content: center;
}

.success-modal-title {
  font-size: 1.5rem;
  margin: 0 0 1rem;
  color: #333;
  font-weight: 700;
}

.success-modal-message {
  color: #666;
  font-size: 1rem;
  margin: 0 0 2rem;
  line-height: 1.5;
}

.success-modal-btn {
  background: #3b60e4;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.8rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  max-width: 160px;
  transition: background 0.2s;
}

.success-modal-btn:hover {
  background: #2f50c0;
}
