/* ============================ MooseNet Modal System ============================ */

/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(11, 15, 13, 0.92);
  backdrop-filter: blur(8px);
  animation: modalFadeIn 0.25s ease-out;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Modal Container */
.modal-container {
  position: relative;
  background: linear-gradient(180deg, #101613, #0e1512);
  border: 1px solid var(--ring, #1a2a23);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  max-width: min(92vw, 900px);
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--ring, #1a2a23);
  background: linear-gradient(180deg, #121a16, #0f1512);
}

.modal-header h2 {
  margin: 0;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  letter-spacing: 0.04em;
  color: var(--ink, #e6efe9);
}

/* Modal Close Button */
.modal-close {
  background: transparent;
  border: 1px solid var(--ring, #1a2a23);
  color: var(--ink, #e6efe9);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  transition:
    background 0.2s ease,
    transform 0.15s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.modal-close:focus-visible {
  outline: 2px solid var(--focus, #9cc5b1);
  outline-offset: 2px;
}

/* Modal Body */
.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  -webkit-overflow-scrolling: touch;
}

/* Modal Content Grid (for info + form side-by-side on desktop) */
.modal-content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .modal-content-grid {
    grid-template-columns: 1fr 1.2fr;
  }
}

/* Checkbox Label Styling */
.signup-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  color: var(--ink, #e6efe9);
  font-size: 0.9rem;
  line-height: 1.5;
}

.signup-checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--moss-2, #3a5f4b);
}

.signup-checkbox-label span {
  flex: 1;
}

/* Animations */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Closing Animation */
.modal-overlay.closing {
  animation: modalFadeOut 0.2s ease-out forwards;
}

.modal-overlay.closing .modal-container {
  animation: modalSlideOut 0.2s ease-out forwards;
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes modalSlideOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
}

/* Accessibility: No Animation for Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-container {
    animation: none !important;
  }
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .modal-overlay.active {
    padding: 0;
    align-items: flex-start;
  }

  .modal-container {
    border-radius: 0;
    max-height: 100vh;
    height: 100%;
    width: 100%;
  }

  .modal-header {
    padding: 16px 20px;
  }

  .modal-header h2 {
    font-size: 1.25rem;
  }

  .modal-body {
    padding: 16px 20px;
    max-height: calc(100vh - 64px);
  }

  .modal-content-grid {
    gap: 16px;
  }

  /* Hide info panel on mobile to save space - force override inline styles */
  .modal-content-grid > .info-card,
  #signupModal .info-card {
    display: none !important;
  }

  /* Form takes full width */
  .modal-content-grid > div:last-child {
    width: 100%;
  }
}

/* Focus Trap Visual Indicator */
.modal-overlay:focus-within .modal-container {
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.7),
    0 0 0 2px var(--focus, #9cc5b1);
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
  padding-right: var(--scrollbar-width, 0);
}
