/* Universal Modal Close Button Styles */

/* Base close button styling for all modals */
.modal-close,
.booking-modal-close,
.universal-contact-close,
.conversation-modal-content .modal-close,
.course-modal-close,
button[aria-label="Close"],
button[aria-label*="Close"] {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  z-index: 1000;
  padding: 0;
  color: var(--text);
}

.modal-close:hover,
.booking-modal-close:hover,
.universal-contact-close:hover,
.conversation-modal-content .modal-close:hover,
.course-modal-close:hover,
button[aria-label="Close"]:hover,
button[aria-label*="Close"]:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
  color: rgb(220, 38, 38);
  transform: rotate(90deg) scale(1.1);
}

.modal-close:active,
.booking-modal-close:active,
.universal-contact-close:active {
  transform: rotate(90deg) scale(0.95);
}

.modal-close svg,
.booking-modal-close svg,
.universal-contact-close svg,
.conversation-modal-content .modal-close svg,
.course-modal-close svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5px;
}

/* Mobile responsive close button */
@media (max-width: 768px) {
  .modal-close,
  .booking-modal-close,
  .universal-contact-close,
  .conversation-modal-content .modal-close,
  .course-modal-close {
    top: 0.75rem;
    right: 0.75rem;
    width: 36px;
    height: 36px;
  }

  .modal-close svg,
  .booking-modal-close svg,
  .universal-contact-close svg,
  .conversation-modal-content .modal-close svg,
  .course-modal-close svg {
    width: 18px;
    height: 18px;
  }
}

/* Form submission status styles - consistent across all forms */
.form-status,
.form-message {
  display: none;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  animation: slideDown 0.3s ease;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.form-status.success,
.form-message.success {
  display: flex;
  background: rgba(34, 197, 94, 0.1);
  border: 2px solid rgba(34, 197, 94, 0.3);
  color: rgb(21, 128, 61);
}

.form-status.error,
.form-message.error {
  display: flex;
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid rgba(239, 68, 68, 0.3);
  color: rgb(185, 28, 28);
}

.form-status svg,
.form-message svg {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.form-status strong {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

/* Modal overlay standardization */
.modal-backdrop,
.booking-modal-overlay,
.conversation-overlay,
.universal-contact-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  animation: fadeIn 0.3s ease;
}

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

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

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

/* Modal container standardization */
.booking-modal-container,
.conversation-modal-content,
.universal-contact-modal,
.course-modal-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
}

/* Loading spinner for submit buttons */
.btn-submit .btn-loader,
.btn-primary .btn-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Success checkmark animation */
.success-icon-large {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  color: rgb(34, 197, 94);
  animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Form submission button states */
button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button[type="submit"]:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

button[type="submit"]:not(:disabled):active {
  transform: translateY(0);
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

/* Accessibility improvements */
.modal-close:focus-visible,
.booking-modal-close:focus-visible,
.universal-contact-close:focus-visible {
  outline: 2px solid var(--navy-primary);
  outline-offset: 2px;
}

/* Success message container */
.universal-contact-success {
  text-align: center;
  padding: 3rem 2rem;
}

.universal-contact-success h3 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--primary);
}

.universal-contact-success p {
  font-size: 1.125rem;
  color: var(--muted);
  margin: 0 0 2rem;
  line-height: 1.6;
}

/* Responsive modal sizing */
@media (max-width: 768px) {
  .booking-modal-container,
  .conversation-modal-content,
  .universal-contact-modal {
    width: 95vw;
    max-height: 95vh;
  }
}

@media (max-width: 480px) {
  .booking-modal-container,
  .conversation-modal-content,
  .universal-contact-modal {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
  }
}
