/* ============================================================
   mood.css — Halaman By Mood
   Import: tokens.css wajib dimuat sebelum file ini
   ============================================================ */

/* ── WRAPPER UTAMA ────────────────────────────────────────── */
.mood-page {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════════════════
   STEP 1 — PILIH MOOD
   ══════════════════════════════════════════════════════════ */

.mood-select-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 64px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.mood-select-view.is-hiding {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

/* Header */
.mood-header {
  text-align: center;
  margin-bottom: 48px;
}

.mood-header__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 40px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.3px;
  margin-bottom: 10px;
  line-height: 1.1;
}

.mood-header__sub {
  font-size: 15px;
  color: var(--text-2);
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Grid 8 Mood Cards */
.mood-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 900px;
  width: 100%;
}

/* ── MOOD CARD ────────────────────────────────────────────── */
.mood-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px solid transparent;
  transition:
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease,
    opacity 0.3s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Gradients unik per mood */
.mood-card[data-mood="adrenalin"] {
  background: linear-gradient(135deg, #FF1744 0%, #FF6B00 100%);
  --glow: rgba(255, 23, 68, 0.5);
}
.mood-card[data-mood="laugh"] {
  background: linear-gradient(135deg, #FF9500 0%, #FFD600 100%);
  --glow: rgba(255, 149, 0, 0.5);
}
.mood-card[data-mood="friday"] {
  background: linear-gradient(135deg, #6B21A8 0%, #1A0030 100%);
  --glow: rgba(107, 33, 168, 0.55);
}
.mood-card[data-mood="mindbend"] {
  background: linear-gradient(135deg, #1E3A8A 0%, #0F172A 100%);
  --glow: rgba(30, 58, 138, 0.55);
}
.mood-card[data-mood="cry"] {
  background: linear-gradient(135deg, #1D4ED8 0%, #475569 100%);
  --glow: rgba(29, 78, 216, 0.5);
}
.mood-card[data-mood="love"] {
  background: linear-gradient(135deg, #DB2777 0%, #FF1744 100%);
  --glow: rgba(219, 39, 119, 0.5);
}
.mood-card[data-mood="family"] {
  background: linear-gradient(135deg, #16A34A 0%, #84CC16 100%);
  --glow: rgba(22, 163, 74, 0.5);
}
.mood-card[data-mood="relax"] {
  background: linear-gradient(135deg, #4338CA 0%, #1E3A8A 100%);
  --glow: rgba(67, 56, 202, 0.5);
}

/* Noise overlay — tekstur halus */
.mood-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  opacity: 0.4;
  pointer-events: none;
}

/* Hover */
.mood-card:hover {
  transform: scale(1.06);
  box-shadow: 0 16px 48px var(--glow, rgba(0,0,0,0.4));
  border-color: rgba(255,255,255,0.25);
}

/* Fade state saat satu card diklik */
.mood-card.is-fading {
  opacity: 0.15;
  transform: scale(0.94);
  pointer-events: none;
}

/* Pulse saat diklik */
@keyframes moodPulse {
  0%   { transform: scale(1.06); }
  40%  { transform: scale(1.12); }
  100% { transform: scale(1.06); }
}

.mood-card.is-pulsing {
  animation: moodPulse 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Expand animation → center */
@keyframes moodExpand {
  0%   { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(6); opacity: 0; }
}

.mood-card.is-expanding {
  animation: moodExpand 0.45s ease-in forwards;
  z-index: 10;
}

/* Emoji */
.mood-card__emoji {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  transition: transform 0.25s ease;
  position: relative;
  z-index: 1;
}

.mood-card:hover .mood-card__emoji {
  transform: translateY(-4px) scale(1.1);
}

/* Label */
.mood-card__label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: white;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  letter-spacing: 0.3px;
  line-height: 1.2;
  padding: 0 8px;
  position: relative;
  z-index: 1;
}

/* ── PAGE TRANSITION OVERLAY ──────────────────────────────── */
.mood-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mood-transition-overlay.is-active {
  opacity: 1;
  pointer-events: all;
}


/* ══════════════════════════════════════════════════════════
   STEP 2 — HASIL REKOMENDASI
   ══════════════════════════════════════════════════════════ */

.mood-result-view {
  display: none;
  flex: 1;
  flex-direction: column;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.mood-result-view.is-visible {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Header hasil */
.mood-result-header {
  padding: 32px 24px 0;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.mood-result-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}

.mood-result-header__left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mood-result-emoji {
  font-size: 48px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.mood-result-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.3px;
}

.mood-result-sub {
  font-size: 14px;
  color: var(--text-2);
  margin-top: 2px;
}

/* Tombol kembali */
.btn-back-mood {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  font-family: 'Inter', sans-serif;
}

.btn-back-mood:hover {
  color: var(--text-1);
  border-color: var(--border-hi);
  background: var(--surface-3);
}

/* ── FILTER TYPE ──────────────────────────────────────────── */
.mood-type-filter {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.mood-type-btn {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.mood-type-btn:hover {
  color: var(--text-1);
  border-color: var(--border-hi);
}

.mood-type-btn.active {
  color: white;
  border-color: transparent;
  /* warna diset via inline style per mood */
}

/* ── GRID HASIL ───────────────────────────────────────────── */
.mood-result-grid {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  animation: fadeIn 0.4s ease;
}

/* Loading state grid */
.mood-result-grid.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ── SKELETON GRID ────────────────────────────────────────── */
.mood-grid-skeleton {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}

.mood-skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mood-skeleton-img {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: var(--r-md);
}

/* ── TOMBOL SHUFFLE ───────────────────────────────────────── */
.mood-shuffle-wrap {
  display: flex;
  justify-content: center;
  padding: 32px 24px 48px;
}

.btn-shuffle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  color: white;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  letter-spacing: 0.3px;
}

.btn-shuffle:hover {
  background: var(--surface-3);
  border-color: var(--border-hi);
  transform: scale(1.03);
}

.btn-shuffle:active {
  transform: scale(0.97);
}

.btn-shuffle__icon {
  font-size: 18px;
  transition: transform 0.5s ease;
}

.btn-shuffle.is-spinning .btn-shuffle__icon {
  animation: spin 0.5s linear;
}

/* ── EMPTY STATE ──────────────────────────────────────────── */
.mood-result-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

.mood-result-empty__icon {
  font-size: 52px;
  opacity: 0.5;
}

.mood-result-empty__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-2);
}

.mood-result-empty__sub {
  font-size: 14px;
  color: var(--text-3);
}

/* ── MOOD ACCENT BAR (dekorasi atas halaman hasil) ────────── */
.mood-accent-bar {
  height: 4px;
  width: 100%;
  margin-bottom: 0;
  transition: background 0.4s ease;
}

/* ── MOBILE ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .mood-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 420px;
  }

  .mood-card__emoji {
    font-size: 40px;
  }

  .mood-card__label {
    font-size: 15px;
  }

  .mood-header__title {
    font-size: 28px;
  }

  .mood-header__sub {
    font-size: 14px;
  }

  .mood-select-view {
    padding: 32px 16px 48px;
  }

  .mood-result-header {
    padding: 24px 16px 0;
  }

  .mood-result-title {
    font-size: 26px;
  }

  .mood-result-emoji {
    font-size: 36px;
  }

  .mood-result-header__top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .mood-result-grid,
  .mood-grid-skeleton {
    padding: 0 16px;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }

  .mood-shuffle-wrap {
    padding: 24px 16px 40px;
  }
}

@media (max-width: 400px) {
  .mood-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .mood-card__emoji {
    font-size: 34px;
  }

  .mood-card__label {
    font-size: 13px;
  }
}
