/**
 * Universal Loading Screen Component
 * Features: Pulsating BlueMonster logo + Text reveal animation
 * Can be themed for different sections
 */

/* ===== LOADING OVERLAY (INSIDE POPOVER CONTAINER) ===== */
.mm-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #3498db; /* Default blue - override per section */
  z-index: 10001; /* Higher than popover content to cover it */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.5s ease-out;
  pointer-events: all;
  border-radius: inherit; /* Match popover border radius */
}

/* Hide state */
.mm-loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Remove from DOM after fade */
.mm-loading-overlay.removed {
  display: none;
}

/* ===== BLUEMONSTER LOGO ===== */
.mm-loading-logo {
  width: 200px;
  height: 200px;
  margin-bottom: 2rem;
  animation: mm-pulse 2s ease-in-out infinite;
}

/* Pulsating animation */
@keyframes mm-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* ===== LOADING TEXT ===== */
.mm-loading-text {
  position: relative;
  color: rgba(0, 0, 0, 0.3);
  font-size: 3em;
  font-family: sans-serif;
  margin: 0;
}

/* Animated text reveal overlay */
.mm-loading-text::before {
  content: attr(data-text);
  position: absolute;
  overflow: hidden;
  max-width: 15em;
  white-space: nowrap;
  color: #fff;
  animation: mm-text-reveal 3s linear infinite;
}

/* Text reveal animation */
@keyframes mm-text-reveal {
  0% {
    max-width: 0;
  }
  80% {
    max-width: 15em;
  }
  100% {
    max-width: 15em;
  }
}

/* ===== THEME VARIATIONS ===== */

/* Read-along books theme */
.mm-loading-overlay.theme-read-along {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Reading fluency theme */
.mm-loading-overlay.theme-fluency {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Chat challenges theme */
.mm-loading-overlay.theme-chat {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Mad libs theme */
.mm-loading-overlay.theme-madlibs {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

/* Main index theme */
.mm-loading-overlay.theme-main {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .mm-loading-logo {
    width: 150px;
    height: 150px;
  }

  .mm-loading-text {
    font-size: 2em;
  }
}

@media (max-width: 480px) {
  .mm-loading-logo {
    width: 120px;
    height: 120px;
  }

  .mm-loading-text {
    font-size: 1.5em;
  }
}
