/* MeloTune - Mood Portrait Gallery Page */

/* ==================== MOOD HERO ==================== */
.mood-hero {
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8rem 1.5rem 3rem;
  text-align: center;
  position: relative;
  background: radial-gradient(ellipse at 50% 0%, rgba(54, 194, 205, 0.08) 0%, transparent 60%);
}

.mood-hero-content {
  max-width: 600px;
}

.mood-badge {
  display: inline-block;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(54, 194, 205, 0.2) 100%);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #a78bfa;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: 100px;
  margin-bottom: 1rem;
  letter-spacing: 0.5px;
}

.mood-sparkle {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  animation: sparkle-float 3s ease-in-out infinite;
}

@keyframes sparkle-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
}

.mood-hero-headline {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mood-hero-subtitle {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
}

/* ==================== GALLERY SECTION ==================== */
.mood-gallery-section {
  padding: 2rem 1.5rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.mood-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ==================== PORTRAIT CARD ==================== */
.mood-portrait-card {
  position: relative;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  aspect-ratio: 1 / 1;
  perspective: 1000px;
  cursor: pointer;
}

.mood-portrait-card:hover {
  border-color: rgba(54, 194, 205, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(54, 194, 205, 0.1);
}

/* Card inner - this is what rotates */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);
  transform-style: preserve-3d;
  border-radius: 20px;
}

.mood-portrait-card.flipped .card-inner {
  transform: rotateY(180deg);
}

/* Front and back faces */
.card-front,
.card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  overflow: hidden;
}

.card-back {
  transform: rotateY(180deg);
}

/* Images fill the card face */
.card-front .portrait-image,
.card-back .portrait-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mood percentage label */
.portrait-mood {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  font-size: 0.75rem;
  color: rgba(54, 194, 205, 0.9);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-align: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 10px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Flip hint indicator */
.card-front::after {
  content: '↻';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.mood-portrait-card:hover .card-front::after,
.mood-portrait-card:hover .card-back::after {
  opacity: 1;
}

.card-back::after {
  content: '↻';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

/* On touch devices, always show the flip hint */
@media (hover: none) {
  .card-front::after,
  .card-back::after {
    opacity: 0.7;
  }
}


/* ==================== HOW IT WORKS SECTION ==================== */
.mood-how-section {
  padding: 4rem 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mood-how-content {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.mood-how-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 2.5rem;
  color: #fff;
}

.mood-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.mood-step {
  padding: 1.5rem;
}

.step-number {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(54, 194, 205, 0.1);
  border: 1px solid rgba(54, 194, 205, 0.2);
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 700;
  color: #36C2CD;
  margin: 0 auto 1rem;
}

.mood-step h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #fff;
}

.mood-step p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

/* ==================== CTA SECTION ==================== */
.mood-cta-section {
  padding: 5rem 1.5rem;
  text-align: center;
  background: radial-gradient(ellipse at 50% 100%, rgba(54, 194, 205, 0.08) 0%, transparent 50%);
}

.mood-cta-content {
  max-width: 600px;
  margin: 0 auto;
}

.mood-cta-headline {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
  color: #fff;
}

.mood-cta-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 2rem;
}

.mood-cta-button {
  display: inline-block;
  position: relative;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  padding: 1.25rem 3rem;
  border-radius: 16px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(54, 194, 205, 0.3);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(54, 194, 205, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Animated gradient shimmer */
.mood-cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(54, 194, 205, 0.2),
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.6s ease;
}

/* Glow ring */
.mood-cta-button::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #36C2CD, #8B5CF6, #EC4899, #36C2CD);
  border-radius: 18px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: glow-rotate 3s linear infinite;
  background-size: 300% 300%;
}

@keyframes glow-rotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.mood-cta-button:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(54, 194, 205, 0.6);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.5),
    0 0 60px rgba(54, 194, 205, 0.3),
    0 0 100px rgba(139, 92, 246, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, #1a1a2e 0%, #1a2744 50%, #0f3460 100%);
}

.mood-cta-button:hover::before {
  left: 100%;
}

.mood-cta-button:hover::after {
  opacity: 0.6;
}

.mood-cta-section .app-store-badge {
  display: block;
  margin: 0 auto;
  text-align: center;
}

.mood-cta-section .app-store-badge img {
  display: inline-block;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  .mood-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .mood-steps {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .mood-hero {
    padding: 7rem 1.5rem 2rem;
  }

  .mood-sparkle {
    font-size: 2.5rem;
  }
}

@media (max-width: 600px) {
  .mood-gallery-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    max-width: 320px;
    margin: 0 auto;
  }

  .mood-portrait-card {
    aspect-ratio: 1 / 1;
  }

  .mood-hero-headline {
    font-size: 2rem;
  }

  .mood-hero-subtitle {
    font-size: 1rem;
  }

  .mood-how-section {
    padding: 3rem 1rem;
  }

  .mood-how-content h2 {
    font-size: 1.5rem;
  }

  .mood-step {
    padding: 1rem;
  }

  .mood-cta-headline {
    font-size: 1.5rem;
  }

  .mood-cta-button {
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: 12px;
  }

  .mood-cta-button::after {
    border-radius: 14px;
  }

  .portrait-mood {
    font-size: 0.65rem;
    padding: 5px 8px;
    bottom: 8px;
    left: 8px;
    right: 8px;
  }
}

/* ==================== IMAGE LOADING STATES ==================== */
.portrait-image {
  opacity: 1;
  transition: opacity 0.5s ease;
}

/* Loading spinner - hidden by default, shown via JS when needed */
.portrait-image-wrapper .loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 2px solid rgba(54, 194, 205, 0.2);
  border-top-color: rgba(54, 194, 205, 0.6);
  border-radius: 50%;
  animation: loading-spin 1s linear infinite;
  transition: opacity 0.3s ease;
}

@keyframes loading-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
