/**
 * Modal System Styles
 * Elegant, accessible modals replacing native alerts
 */

/* Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

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

/* Modal Dialog */
.modal-dialog {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9) translateY(-20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-dialog.modal-show {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Header */
.modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #009b3a;
  flex: 1;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  line-height: 1;
}

.modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

/* Body */
.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-message {
  font-size: 1rem;
  line-height: 1.6;
  color: #333;
  margin: 0;
  white-space: pre-wrap;
}

.modal-input {
  width: 100%;
  padding: 12px 16px;
  margin-top: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s;
}

.modal-input:focus {
  outline: none;
  border-color: #009b3a;
  box-shadow: 0 0 0 3px rgba(0, 155, 58, 0.1);
}

/* Footer */
.modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Buttons */
.modal-btn {
  padding: 12px 24px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  color: #333;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
}

.modal-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
  transform: translateY(-1px);
}

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

.modal-btn-primary {
  background: #009b3a;
  color: white;
  border-color: #009b3a;
}

.modal-btn-primary:hover {
  background: #007a2e;
  border-color: #007a2e;
}

.modal-btn-danger {
  background: #f44336;
  color: white;
  border-color: #f44336;
}

.modal-btn-danger:hover {
  background: #d32f2f;
  border-color: #d32f2f;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .modal-dialog {
    max-width: 95%;
    margin: 20px;
  }

  .modal-header {
    padding: 20px 20px 12px;
  }

  .modal-title {
    font-size: 1.25rem;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-footer {
    padding: 12px 20px 20px;
    flex-direction: column;
  }

  .modal-btn {
    width: 100%;
    min-width: auto;
  }
}

/* Accessibility */
.modal-overlay:focus-within .modal-dialog {
  outline: 3px solid #009b3a;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-dialog {
    animation: none;
    transition: none;
  }
}
