@use "../../../styles/mixins.scss";

// Modal overlay with magical backdrop
.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 10;
  animation: fadeIn 0.3s ease-out;
  
  @include mixins.respond-below(md) {
    padding: 0;
    align-items: flex-start;
  }
}

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

// Floating background emojis
.floatingEmojis {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: -1;
}

.floatingEmoji {
  position: absolute;
  font-size: 2rem;
  opacity: 0.3;
  animation: float 6s ease-in-out infinite;
  
  @include mixins.respond-below(sm) {
    font-size: 1.5rem;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-20px) rotate(5deg);
  }
  50% {
    transform: translateY(-10px) rotate(-5deg);
  }
  75% {
    transform: translateY(-25px) rotate(3deg);
  }
}


// Main modal container
.modalContainer {
  background: white;
  border-radius: 24px;
  max-width: 750px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  z-index: 2;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;

  @include mixins.respond-below(md) {
    border-radius: 0;
    max-height: 100dvh;
    height: 100dvh;
    width: 100vw;
    max-width: none;
  }
}

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

// Close button
.closeButton {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--mantine-color-gray-7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

  &:hover {
    background: white;
    transform: scale(1.1) rotate(90deg);
  }

  &:active {
    transform: scale(0.95) rotate(90deg);
  }

  &:focus-visible {
    outline: 2px solid var(--mantine-color-blue-5);
    outline-offset: 2px;
  }
}

// Modal header
.modalHeader {
  background: var(--hi-gradient);
  padding: 1.5rem 2rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;

  @include mixins.respond-below(md) {
    padding: 1.25rem 1rem 0.75rem;
  }
}

.headerContent {
  position: relative;
  z-index: 1;
}

.magicWand {
  font-size: 1.75rem;
  display: inline-block;
  margin-bottom: 0.25rem;
  animation: sparkle 2s ease-in-out infinite;
  
  @include mixins.respond-below(sm) {
    font-size: 1.25rem;
  }
}

@keyframes sparkle {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(-10deg) scale(1.1);
  }
  50% {
    transform: rotate(10deg) scale(1.05);
  }
  75% {
    transform: rotate(-5deg) scale(1.1);
  }
}

.headerTitle {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  margin: 0 0 0.125rem;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  
  @include mixins.respond-below(sm) {
    font-size: 1.25rem;
  }
}

.headerSubtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  font-weight: 400;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  
  @include mixins.respond-below(sm) {
    font-size: 0.75rem;
  }
}

// Modal content
.modalContent {
  max-height: calc(90vh - 120px);
  overflow-y: auto;
  @include mixins.scrollbar();
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;

  @include mixins.respond-below(md) {
    max-height: none;
    overflow-y: auto;
  }
}

.formContainer {
  padding: 2.5rem;

  @include mixins.respond-below(md) {
    padding: 1.5rem;
    padding-bottom: 2.5rem;
  }

  @include mixins.respond-below(sm) {
    padding: 1rem;
    padding-bottom: 2rem;
  }

  // Ensure consistent spacing between form elements
  form > * + * {
    margin-top: 1.5rem;

    @include mixins.respond-below(sm) {
      margin-top: 1rem;
    }
  }
}

// Create organizer link
.createOrganizerLink {
  text-align: center;
  margin-top: 1rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: var(--mantine-color-gray-6);
}

// Editor field
.editorField {
  // Spacing handled by parent form
}

// Date time section
.dateTimeGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;

  @include mixins.respond-below(sm) {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}


// Create button
.createButton {
  height: 64px;
  font-weight: 700;
  font-size: 1.25rem;
  background: var(--hi-gradient);
  border: none;
  border-radius: 16px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
  padding: 0 2rem;

  @include mixins.respond-below(sm) {
    height: 56px;
    font-size: 1rem;
    padding: 0 1.5rem;
  }

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
  }

  &:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(102, 126, 234, 0.4);

    &::before {
      left: 100%;
    }
  }

  &:active {
    transform: translateY(-1px);
  }
  
  &:focus-visible {
    outline: 2px solid var(--mantine-color-blue-5);
    outline-offset: 2px;
  }
}

// Organizer creation form
.createOrganizerCard {
  background: linear-gradient(135deg, #f8f9ff 0%, #f3f4f6 100%);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 2px dashed rgba(102, 126, 234, 0.3);
  animation: slideIn 0.3s ease-out;
  
  @include mixins.respond-below(sm) {
    padding: 1.5rem;
  }
}

.createOrganizerHeading {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mantine-color-dark-9);
  margin: 0 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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