/* ============================================
   FULLSCREEN IMMERSIVE PLAYER MODE
   Phase 7: Cinematic Polish + Stabilization
   Emotional cohesion, motion restraint, atmospheric depth
   ============================================ */
/* ---------- FULLSCREEN OVERLAY LAYER ---------- */
.fullscreen-player-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at 50% 30%,
    rgba(8, 8, 10, 0.98) 0%,
    rgba(3, 3, 5, 0.99) 100%
  );
  z-index: var(--z-fullscreen, 850);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-cinematic) var(--ease-soft),
    visibility var(--transition-cinematic) var(--ease-soft);
  will-change: opacity, visibility;
}

.fullscreen-player-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Subtle atmospheric veil overlay */
.fullscreen-player-overlay::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    ellipse at 50% 40%,
    rgba(139, 44, 44, 0.04) 0%,
    transparent 60%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-slow) var(--ease-soft);
}

.fullscreen-player-overlay.active::before {
  opacity: 1;
  transition-delay: 0.2s;
}

/* ---------- FULLSCREEN CONTENT CONTAINER ---------- */
.fullscreen-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 720px;
  width: 90%;
  margin: 0 auto;
  transform: translateY(16px);
  opacity: 0;
  transition:
    transform var(--transition-slow) var(--ease-soft),
    opacity var(--transition-slow) var(--ease-soft);
}

.fullscreen-player-overlay.active .fullscreen-content {
  transform: translateY(0);
  opacity: 1;
  transition-delay: 0.15s;
}

/* ---------- LARGE ARTWORK - Emotional Presence ---------- */
.fullscreen-artwork {
  width: min(65vw, 380px);
  height: min(65vw, 380px);
  margin-bottom: var(--space-lg);
  border-radius: 32px;
  overflow: hidden;
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  transition:
    transform var(--transition-soft) var(--ease-calm),
    box-shadow var(--transition-soft) var(--ease-calm);
  position: relative;
}

/* Soft atmospheric glow behind artwork */
.fullscreen-artwork::after {
  content: "";
  position: absolute;
  top: 10%;
  left: 10%;
  right: 10%;
  bottom: 10%;
  border-radius: 32px;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(0, 0, 0, 0.3),
    transparent
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-soft) var(--ease-subtle);
}

.fullscreen-artwork:hover::after {
  opacity: 0.4;
}

.fullscreen-artwork:hover {
  transform: scale(1.01);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.fullscreen-artwork img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition:
    transform var(--transition-slow) var(--ease-calm),
    opacity 0.35s ease;
  will-change: transform, opacity;
}

.fullscreen-artwork:hover img {
  transform: scale(1.02);
}

.fullscreen-artwork-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    var(--color-gray-dark),
    var(--color-gray-mid)
  );
  font-size: 80px;
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* ---------- TRACK INFO - Cinematic Typography ---------- */
.fullscreen-track-title {
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: var(--space-xs);
  letter-spacing: -0.02em;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(200, 200, 200, 0.85) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  animation: titleReveal 0.6s var(--ease-soft) forwards;
  animation-delay: 0.2s;
}

@keyframes titleReveal {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.fullscreen-track-artist {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  opacity: 0.6;
  text-align: center;
  margin-bottom: var(--space-md);
  letter-spacing: 0.2px;
  transition: opacity var(--transition-fast) var(--ease-subtle);
}

.fullscreen-track-artist:hover {
  opacity: 0.85;
}

/* ---------- SPOTLIGHT LYRIC - Premium Cinematic Atmosphere ---------- */
.fullscreen-spotlight-lyric {
  max-width: 85%;
  margin: 0 auto var(--space-sm) auto;
  text-align: center;
  opacity: 0;
  animation: lyricFadeIn 0.8s var(--ease-soft) forwards;
  animation-delay: 0.3s;
}

.fullscreen-spotlight-context {
  min-height: 1.35em;
  margin: 0 auto 0.18rem;
  color: var(--kv2-lyric-inactive, rgba(154, 154, 165, 0.55));
  font-size: 0.82rem;
  line-height: 1.45;
  font-weight: 450;
  opacity: 0.52;
  max-width: min(640px, 92vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fullscreen-spotlight-context:last-child {
  margin: 0.42rem auto 0;
}

@keyframes lyricFadeIn {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.fullscreen-spotlight-text {
  position: relative;
  font-size: 1.12rem;
  line-height: 1.52;
  font-weight: 540;
  letter-spacing: 0;
  color: var(--kv2-lyric-active, rgba(243, 245, 247, 0.92));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  
  transition: 
    opacity 0.35s ease,
    color 0.35s ease,
    text-shadow 0.35s ease;
  
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

.fullscreen-spotlight-text:not(.syncing-state) {
  background:
    linear-gradient(
      90deg,
      var(--kv2-lyric-fill-start, #8FE8B5) 0%,
      var(--kv2-lyric-fill-end, #D8C6FF) calc(var(--kv2-lyrics-progress, 0) * 100%),
      var(--kv2-lyric-active, #F3F5F7) calc(var(--kv2-lyrics-progress, 0) * 100%),
      var(--kv2-lyric-active, #F3F5F7) 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.fullscreen-spotlight-text::after,
.fullscreen-spotlight-text::before {
  content: "";
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
}

.fullscreen-spotlight-text::after {
  bottom: -11px;
  width: min(190px, 60vw);
  height: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  transform: translateX(-50%);
}

.fullscreen-spotlight-text::before {
  bottom: -13px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--kv2-lyric-fill-end, #D8C6FF);
  box-shadow: 0 0 8px rgba(216, 198, 255, 0.34);
  transform: translateX(calc(-95px + (190px * var(--kv2-lyrics-progress, 0))));
}

.fullscreen-spotlight-lyric[data-lyrics-source="advanced"] .fullscreen-spotlight-text::after {
  opacity: 0.18;
}

.fullscreen-spotlight-lyric[data-lyrics-source="advanced"] .fullscreen-spotlight-text::before {
  opacity: 0;
}

/* Syncing state for fullscreen - soft breathing anticipation */
.fullscreen-spotlight-text.syncing-state {
  color: rgba(220, 220, 235, 0.62);
  text-shadow: 0 0 16px rgba(141, 245, 143, 0.1);
  animation: fullscreenSyncingBreath 2.8s ease-in-out infinite;
}

@keyframes fullscreenSyncingBreath {
  0% { opacity: 0.48; text-shadow: 0 0 10px rgba(141, 245, 143, 0.06); }
  50% { opacity: 0.76; text-shadow: 0 0 20px rgba(141, 245, 143, 0.12); }
  100% { opacity: 0.48; text-shadow: 0 0 10px rgba(141, 245, 143, 0.06); }
}

/* ---------- ENHANCED VISUALIZER - Softer, Ambient Companion ---------- */
.fullscreen-visualizer-container {
  width: 100%;
  max-width: 560px;
  margin: var(--space-sm) 0;
  padding: var(--space-xs) 0;
  position: relative;
}

/* Soft ambient glow behind visualizer - reduced intensity */
.fullscreen-visualizer-container::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 10%;
  right: 10%;
  height: 100%;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(141, 245, 143, 0.04),
    transparent
  );
  border-radius: 50%;
  filter: blur(20px);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-slow) var(--ease-soft);
}

.fullscreen-player-overlay.active .fullscreen-visualizer-container::before {
  opacity: 1;
  transition-delay: 0.3s;
}

.fullscreen-visualizer {
  width: 100%;
  height: 65px;
  display: block;
  opacity: 0.55;
  transition: opacity var(--transition-smooth) var(--ease-subtle);
}

.fullscreen-player-overlay.active .fullscreen-visualizer {
  opacity: 0.75;
}

/* ---------- PLAYBACK CONTROLS (CENTRALIZED) - Tighter Composition ---------- */
.fullscreen-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin: var(--space-sm) 0 var(--space-xs);
}

.fullscreen-control-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base) var(--ease-premium);
  backdrop-filter: blur(8px);
  opacity: 0.7;
}

.fullscreen-control-btn:hover {
  background: rgba(141, 245, 143, 0.12);
  transform: scale(1.04);
  opacity: 1;
}

.fullscreen-control-btn:active {
  transform: scale(0.97);
}

.fullscreen-play-pause {
  width: 70px;
  height: 70px;
  background: rgba(141, 245, 143, 0.1);
  border: 1px solid rgba(141, 245, 143, 0.15);
  opacity: 0.9;
}

.fullscreen-play-pause:hover {
  background: rgba(141, 245, 143, 0.18);
  transform: scale(1.05);
  opacity: 1;
}

/* ---------- PROGRESS BAR (ENHANCED) ---------- */
.fullscreen-progress-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xs);
}

.fullscreen-time {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  opacity: 0.5;
  min-width: 38px;
  text-align: center;
  font-family: monospace;
  letter-spacing: 0.03em;
}

.fullscreen-progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  transition: height var(--transition-micro) var(--ease-subtle);
}

.fullscreen-progress-bar:hover {
  height: 5px;
}

.fullscreen-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(141, 245, 143, 0.9),
    rgba(141, 245, 143, 0.6)
  );
  border-radius: 999px;
  transition: width var(--transition-micro) var(--ease-standard);
  position: relative;
}

/* Progress glow dot */
.fullscreen-progress-fill::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8df58f;
  box-shadow: 0 0 8px rgba(141, 245, 143, 0.4);
  opacity: 0;
  transition: opacity var(--transition-fast) var(--ease-subtle);
}

.fullscreen-progress-bar:hover .fullscreen-progress-fill::after {
  opacity: 1;
}

/* ---------- EXIT BUTTON ---------- */
.fullscreen-exit {
  position: absolute;
  top: var(--space-xl);
  right: var(--space-xl);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base) var(--ease-premium);
  backdrop-filter: blur(8px);
  z-index: 10;
  opacity: 0.6;
}

.fullscreen-exit:hover {
  background: rgba(139, 44, 44, 0.25);
  transform: scale(1.05);
  opacity: 1;
}

.fullscreen-exit svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
}

/* ---------- FULLSCREEN TOGGLE BUTTON (IN GLOBAL PLAYER) ---------- */
.fullscreen-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast) var(--ease-premium);
  margin-left: var(--space-sm);
}

.fullscreen-toggle-btn:hover {
  background: rgba(141, 245, 143, 0.12);
  transform: scale(1.04);
}

.fullscreen-toggle-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
}

/* ---------- AMBIENT ENHANCEMENT VIA BODY CLASS ---------- */
body.fullscreen-ambient-enhanced .ambient-glow-layer {
  opacity: calc(var(--ambient-intensity, 0.08) * 1.8);
  transition: opacity var(--transition-cinematic) var(--ease-soft);
}

/* ---------- BODY SCROLL LOCK ---------- */
body.fullscreen-active {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ---------- MOBILE ADJUSTMENTS - SAFE AREA ---------- */
@media (max-width: 768px) {
  .fullscreen-artwork {
    width: min(75vw, 280px);
    height: min(75vw, 280px);
    border-radius: 24px;
  }

  .fullscreen-track-title {
    font-size: 1.4rem;
  }

  .fullscreen-track-artist {
    font-size: 0.85rem;
    margin-bottom: var(--space-sm);
  }
  
  .fullscreen-spotlight-lyric {
    margin-bottom: var(--space-xs);
    max-width: 90%;
  }
  
  .fullscreen-spotlight-text {
    font-size: 0.98rem;
    line-height: 1.48;
    font-weight: 520;
  }

  .fullscreen-spotlight-text::after,
  .fullscreen-spotlight-text::before {
    display: none;
  }

  .fullscreen-spotlight-context {
    min-height: 1.2em;
    font-size: 0.78rem;
    opacity: 0.42;
  }

  .fullscreen-visualizer {
    height: 50px;
    opacity: 0.6;
  }

  .fullscreen-control-btn {
    width: 48px;
    height: 48px;
  }

  .fullscreen-play-pause {
    width: 60px;
    height: 60px;
  }

  .fullscreen-exit {
    top: var(--space-md);
    right: var(--space-md);
    width: 38px;
    height: 38px;
  }

  .fullscreen-toggle-btn {
    width: 28px;
    height: 28px;
  }

  /* Tighter mobile spacing */
  .fullscreen-artwork {
    margin-bottom: calc(var(--space-lg) * 0.6);
  }

  .fullscreen-track-artist {
    margin-bottom: calc(var(--space-md) * 0.4);
  }

  .fullscreen-visualizer-container {
    margin: calc(var(--space-sm) * 0.5) 0;
    padding: calc(var(--space-xs) * 0.5) 0;
  }

  .fullscreen-controls {
    margin: calc(var(--space-sm) * 0.5) 0 var(--space-xs);
  }

  .fullscreen-progress-container {
    margin-top: calc(var(--space-xs) * 0.5);
  }

  .fullscreen-content {
    padding-top: calc(var(--space-sm) * 0.25);
  }
}

@media (max-width: 480px) {
  .fullscreen-track-title {
    font-size: 1.2rem;
  }

  .fullscreen-artwork {
    width: min(80vw, 240px);
    height: min(80vw, 240px);
  }
  
  .fullscreen-spotlight-text {
    font-size: 0.9rem;
    line-height: 1.45;
    font-weight: 510;
  }

  .fullscreen-visualizer {
    height: 44px;
    opacity: 0.65;
  }

  .fullscreen-controls {
    gap: var(--space-md);
  }

  .fullscreen-control-btn {
    width: 44px;
    height: 44px;
  }

  .fullscreen-play-pause {
    width: 54px;
    height: 54px;
  }

  .fullscreen-progress-container {
    max-width: 90%;
  }

  .fullscreen-exit {
    top: var(--space-sm);
    right: var(--space-sm);
    width: 36px;
    height: 36px;
  }

  .fullscreen-time {
    font-size: 0.6rem;
    min-width: 32px;
  }
}

/* ---------- LANDSCAPE MOBILE OPTIMIZATION ---------- */
@media (max-width: 896px) and (orientation: landscape) {
  .fullscreen-artwork {
    width: min(35vh, 180px);
    height: min(35vh, 180px);
    margin-bottom: var(--space-md);
  }

  .fullscreen-track-title {
    font-size: 1.2rem;
    margin-bottom: var(--space-xs);
  }

  .fullscreen-track-artist {
    font-size: 0.8rem;
    margin-bottom: var(--space-xs);
  }
  
  .fullscreen-spotlight-lyric {
    margin-bottom: var(--space-xs);
  }
  
  .fullscreen-spotlight-text {
    font-size: 0.88rem;
  }

  .fullscreen-visualizer {
    height: 38px;
  }

  .fullscreen-controls {
    margin: var(--space-xs) 0;
    gap: var(--space-md);
  }

  .fullscreen-control-btn {
    width: 42px;
    height: 42px;
  }

  .fullscreen-play-pause {
    width: 52px;
    height: 52px;
  }
}

/* ---------- REDUCED MOTION PREFERENCE ---------- */
@media (prefers-reduced-motion: reduce) {
  .fullscreen-player-overlay,
  .fullscreen-content,
  .fullscreen-artwork,
  .fullscreen-control-btn,
  .fullscreen-exit,
  .fullscreen-toggle-btn,
  .fullscreen-track-title,
  .fullscreen-spotlight-lyric {
    transition: none !important;
    animation: none !important;
  }

  .fullscreen-player-overlay.active .fullscreen-content {
    transition-delay: 0s;
  }

  .fullscreen-track-title,
  .fullscreen-spotlight-lyric {
    animation: none !important;
    opacity: 1;
  }
}

.fullscreen-spotlight-text:not(.syncing-state) {
  background:
    linear-gradient(
      90deg,
      rgba(190, 255, 205, 0.96) calc(var(--kv2-lyrics-progress, 0) * 100%),
      rgba(210, 188, 255, 0.94) calc(var(--kv2-lyrics-progress, 0) * 100%),
      rgba(255, 255, 255, 0.58) 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
