/**
 * Site-wide Modal Styles
 * 
 * Reusable modal component styles with color palette support and dark mode.
 */

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  animation: modalFadeIn 0.2s ease-out;
}

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

/* Modal Dialog */
.modal-dialog {
  background-color: white;
  border-radius: 0.75rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.2s ease-out;
}

.dark .modal-dialog {
  background-color: var(--color-surface-dark);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

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

/* Modal Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-dark-accent);
}

.dark .modal-header {
  border-bottom-color: rgba(127, 101, 220, 0.3);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--color-dark-shades);
  margin: 0;
}

.dark .modal-title {
  color: var(--color-text-bright);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--color-dark-accent);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  color: var(--color-dark-shades);
  background-color: rgba(150, 158, 165, 0.1);
}

.dark .modal-close-btn:hover {
  color: var(--color-text-bright);
  background-color: rgba(127, 101, 220, 0.2);
}

/* Modal Body */
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  color: var(--color-text-dark);
}

.dark .modal-body {
  color: var(--color-text-bright);
}

/* Modal Footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid var(--color-dark-accent);
}

.dark .modal-footer {
  border-top-color: rgba(127, 101, 220, 0.3);
}

/* Modal Buttons */
.modal-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Default button style */
.modal-btn {
  background-color: var(--color-dark-accent);
  color: white;
}

.modal-btn:hover {
  background-color: var(--color-dark-shades);
}

/* Primary button (can use .btn-primary class from site) */
.modal-btn.btn-primary {
  background-color: var(--color-dark-shades);
  color: white;
}

.modal-btn.btn-primary:hover {
  background-color: var(--color-brand-primary);
}

/* Secondary button (can use .btn-secondary class from site) */
.modal-btn.btn-secondary {
  background-color: var(--color-light-accent);
  color: var(--color-dark-shades);
}

.modal-btn.btn-secondary:hover {
  background-color: var(--color-brand-primary);
  color: white;
}

/* Responsive */
@media (max-width: 640px) {
  .modal-dialog {
    margin: 0;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .modal-btn {
    width: 100%;
  }
}

/* Modal Form Elements */
.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body textarea,
.modal-body select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--color-dark-accent);
  border-radius: 0.5rem;
  background-color: white;
  color: var(--color-text-dark);
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
}

.dark .modal-body input[type="text"],
.dark .modal-body input[type="email"],
.dark .modal-body input[type="password"],
.dark .modal-body textarea,
.dark .modal-body select {
  background-color: rgba(51, 67, 136, 0.3);
  color: var(--color-text-bright);
  border-color: var(--color-brand-primary);
}

.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px rgba(127, 101, 220, 0.1);
}

.modal-body label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-dark-shades);
  margin-bottom: 0.5rem;
}

.dark .modal-body label {
  color: var(--color-text-bright);
}

.modal-body .helper-text {
  font-size: 0.75rem;
  color: var(--color-dark-accent);
  margin-top: 0.25rem;
}

