/* ===== Modal Component ===== */
/* Standard modal used across all modules */

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

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

/* Modal Content */
.modal-content {
  background: white;
  border-radius: 16px;
  padding: 0;
  min-width: 400px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 0, 0, 0.08);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html.dark-mode .modal-content {
  background: #2a2a2a;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, rgba(139, 195, 74, 0.1), rgba(94, 129, 34, 0.05));
  border-bottom: 2px solid rgba(0, 0, 0, 0.06);
}

html.dark-mode .modal-header {
  background: linear-gradient(135deg, rgba(139, 195, 74, 0.15), rgba(139, 195, 74, 0.08));
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.modal-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #8bc34a, #7ab82d);
  border-radius: 12px;
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px rgba(139, 195, 74, 0.3);
}

.modal-title {
  flex: 1;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: #2c3e50;
}

html.dark-mode .modal-title {
  color: #ecf0f1;
}

/* Optional: Apply gradient text effect when modal-title is used with modal-header-icon */
.modal-header-icon + .modal-title {
  background: linear-gradient(135deg, #8bc34a, #7ab82d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html.dark-mode .modal-header-icon + .modal-title {
  background: linear-gradient(135deg, #8bc34a, #7ab82d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #546e7a;
  padding: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.modal-close:hover {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
  transform: rotate(90deg);
}

html.dark-mode .modal-close {
  background: rgba(255, 255, 255, 0.05);
  color: #95a5a6;
}

html.dark-mode .modal-close:hover {
  background: rgba(231, 76, 60, 0.2);
  color: #ff6b6b;
}

/* Contrast Close Button (for colored headers) */
.modal-close-contrast {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-close-contrast:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
  padding: 2rem;
  max-height: calc(90vh - 180px);
  overflow-y: auto;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: rgba(0, 0, 0, 0.02);
  border-top: 2px solid rgba(0, 0, 0, 0.06);
}

html.dark-mode .modal-footer {
  background: rgba(255, 255, 255, 0.02);
  border-top-color: rgba(255, 255, 255, 0.1);
}

.modal-footer .action-btn {
  flex: 1;
  justify-content: center;
}

/* Modal Message */
.modal-message {
  margin: 0 0 1.5rem 0;
  font-size: 1rem;
  line-height: 1.5;
  color: #555;
}

html.dark-mode .modal-message {
  color: #d1d5db;
}

/* Responsive */
@media (max-width: 768px) {
  .modal-content {
    min-width: 0;
    width: 95%;
    max-height: 95vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1.25rem 1.5rem;
  }

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

  .modal-header-icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
}
