/* ==========================================================================
   Radio Senise Centrale - Clean Player, TV, Video.js & Volume UI
   ========================================================================== */

/* --- Custom Font Declarations --- */
@font-face {
  font-family: 'RSCHeadingNowA';
  src: url('fonts/RSCHeadingNow A.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'RSCHeadingNowB';
  src: url('fonts/RSCHeadingNow - B.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'RSCHeadingNow';
  src: url('fonts/RSCHeadingNow - B.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'RSCHeadingNow';
  src: url('fonts/RSCHeadingNow.woff2') format('woff2'),
       url('fonts/RSCHeadingNow A.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --- CSS Variables & Design Tokens --- */
:root {
  --bg-color: #121214;
  --bg-gradient: radial-gradient(circle at center, #1a1a1d 0%, #0c0c0e 100%);
  --card-bg: #1c1c1f;
  --card-border: rgba(255, 255, 255, 0.08);
  --accent-red: #d32f2f;
  --accent-red-bright: #e50914;
  --text-white: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.4);
  --font-heading: 'RSCHeadingNow', 'Oswald', sans-serif;
  --font-body: 'Montserrat', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global Reset & Box Sizing --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  background-color: var(--bg-color);
}

body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  /* iOS Safari 100vh fix */
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  background: var(--bg-gradient);
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  color: var(--text-white);
  font-family: var(--font-body);
  overflow-x: hidden;
  /* Prevent bounce on iOS */
  overscroll-behavior-y: none;
}

/* --- Top Header: Brand Logo --- */
.top-header {
  position: absolute;
  top: max(1.75rem, env(safe-area-inset-top));
  left: max(2.25rem, env(safe-area-inset-left));
  z-index: 100;
}

.brand-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.6));
  transition: transform 0.3s ease;
}

.brand-logo:hover {
  transform: scale(1.04);
}

/* --- App Container: Perfectly Centered --- */
.app-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2.5rem 1.5rem;
  gap: 1.75rem;
}

/* --- Mode Switcher: Desktop --- */
.mode-switcher {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem;
  border-radius: 36px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 28px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.mode-btn:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.08);
}

.mode-btn.active {
  background: var(--accent-red);
  color: var(--text-white);
  box-shadow: 0 4px 16px rgba(211, 47, 47, 0.5);
}

.mode-icon {
  width: 20px;
  height: 20px;
}

/* --- Main Content Grid --- */
.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 640px;
}

/* --- Central Player Card --- */
.player-card {
  width: 100%;
  max-width: 510px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 40px;
  padding: 2.6rem 2.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8),
              inset 0 1px 1px rgba(255, 255, 255, 0.05);
  position: relative;
  backdrop-filter: blur(12px);
  transition: var(--transition-smooth);
}

/* --- Circular Cover Container (Acts as Invisible Vinyl Pocket) --- */
.cover-container {
  position: relative;
  width: 300px;
  height: 300px;
  margin-bottom: 1.75rem;
}

.cover-ring {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid var(--accent-red);
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.85),
              0 0 25px rgba(211, 47, 47, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0d0d0f;
}

/* --- Pure 60FPS Hardware-Accelerated Vinyl Rotation --- */
@keyframes spinCover {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Default Station Cover (Shown as solid background until Spotify artwork finishes loading) */
.default-cover-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
  transform: rotate(0deg);
  opacity: 1;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

.cover-container.has-song-art .default-cover-image {
  opacity: 0;
  pointer-events: none;
}

/* Rotating Container for 60FPS Song Artwork Spin */
.cover-rotator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: spinCover 18s linear infinite;
  animation-play-state: paused;
  will-change: transform, opacity;
  transform-origin: center center;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.cover-rotator.playing {
  animation-play-state: running;
  opacity: 1;
}

.cover-rotator.paused {
  animation-play-state: paused !important;
  opacity: 1;
}

/* --- Smooth Fade & Soft Scale Cover Animation --- */
@keyframes coverFadeOut {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }
  100% {
    transform: scale(0.94);
    opacity: 0;
    filter: brightness(1.1);
  }
}

@keyframes coverFadeIn {
  0% {
    transform: scale(1.05);
    opacity: 0;
    filter: brightness(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, filter 0.3s ease;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: block;
}

.cover-image.flip-out {
  animation: coverFadeOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.cover-image.flip-in {
  animation: coverFadeIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cover-image.updating {
  opacity: 0;
}

/* Central Overlay Play/Pause Button - Perfect Geometric & Optical Center */
.play-overlay-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  backdrop-filter: blur(8px);
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.icon-play,
.icon-pause {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.icon-play svg {
  width: 32px;
  height: 32px;
  margin-left: 3px;
}

.icon-pause svg {
  width: 30px;
  height: 30px;
  margin-left: 0;
}

/* When PLAYING: Hide pause button overlay by default on desktop */
.play-overlay-btn.is-playing {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  pointer-events: auto;
}

/* Hover over cover ring/container reveals pause button smoothly */
.cover-container:hover .play-overlay-btn.is-playing,
.cover-ring:hover .play-overlay-btn.is-playing {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.play-overlay-btn:hover {
  transform: translate(-50%, -50%) scale(1.08) !important;
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

/* Helper Class to Toggle Display */
.hidden {
  display: none !important;
}

/* --- LIVE Badge --- */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.9rem;
  border: 1.2px solid rgba(255, 255, 255, 0.6);
  border-radius: 50px;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.2);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 7px #22c55e;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

.live-text {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 1px;
  color: var(--text-white);
}

/* --- Track Info & Crisp Marquee --- */
.track-info {
  text-align: center;
  margin-bottom: 1.75rem;
  width: 100%;
  min-height: 95px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.1rem;
}

/* Mascherino Virtuale Container with Crisp Unclipped Edges */
.text-mask-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px 0;
}

.text-mask-container.has-scrolling {
  justify-content: flex-start;
}

.artist-name {
  font-family: 'RSCHeadingNowA', 'RSCHeadingNow', 'Oswald', sans-serif;
  font-size: 2.95rem;
  font-weight: 700;
  font-style: normal;
  color: var(--accent-red-bright);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(229, 9, 20, 0.25);
  display: inline-block;
  white-space: nowrap;
  transition: transform 0.35s cubic-bezier(0.55, 0, 0.1, 1), opacity 0.35s ease;
  will-change: transform, opacity;
}

.song-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  font-style: normal;
  color: var(--text-white);
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  white-space: nowrap;
  transition: transform 0.35s cubic-bezier(0.55, 0, 0.1, 1), opacity 0.35s ease;
  will-change: transform, opacity;
}

/* Slide Down Animation Classes inside Mascherino Virtuale */
.text-slide-out-down {
  transform: translateY(120%) !important;
  opacity: 0 !important;
  transition: transform 0.35s ease-in, opacity 0.35s ease-in !important;
}

.text-slide-in-prep {
  transform: translateY(-120%) !important;
  opacity: 0 !important;
  transition: none !important;
}

.text-slide-in-active {
  transform: translateY(0%) !important;
  opacity: 1 !important;
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.38s ease !important;
}

/* Ultra-Smooth Crisp Marquee Bounce Animation */
@keyframes marqueeScroll {
  0%, 15% {
    transform: translateX(0px);
  }
  50%, 65% {
    transform: translateX(var(--scroll-offset, -100px));
  }
  100% {
    transform: translateX(0px);
  }
}

.artist-name.is-scrolling,
.song-title.is-scrolling {
  animation: marqueeScroll var(--marquee-duration, 8s) cubic-bezier(0.42, 0, 0.58, 1) infinite;
  will-change: transform;
}

/* --- Redesigned Sleek Volume UI --- */
.volume-control-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem 1.2rem;
  border-radius: 30px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  width: 220px;
}

.volume-btn {
  background: none;
  border: none;
  color: var(--text-white);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.volume-btn:hover {
  color: var(--accent-red-bright);
  transform: scale(1.1);
}

.speaker-icon {
  width: 20px;
  height: 20px;
}

.volume-slider-container {
  width: 100%;
  display: flex;
  align-items: center;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-white);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.volume-slider::-webkit-slider-thumb:hover {
  background: var(--accent-red-bright);
  transform: scale(1.25);
}

/* --- TV Card Section & Video.js Styling --- */
.tv-card {
  width: 100%;
  max-width: 620px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 40px;
  padding: 1.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  gap: 1.5rem;
}

.tv-screen-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 24px;
  overflow: hidden;
  background-color: #000;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65);
}

.tv-video-player {
  width: 100% !important;
  height: 100% !important;
  border-radius: 22px;
}

/* Custom Video.js Styling */
.video-js .vjs-big-play-button {
  background-color: rgba(211, 47, 47, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
  border-radius: 50% !important;
  width: 68px !important;
  height: 68px !important;
  line-height: 66px !important;
  margin-top: -34px !important;
  margin-left: -34px !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

.video-js .vjs-play-progress {
  background-color: var(--accent-red-bright) !important;
}

.tv-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.tv-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  font-style: normal;
  color: var(--text-white);
  letter-spacing: 0.5px;
}

/* --- Mobile Responsive Rules --- */
@media (max-width: 899px) {
  .top-header {
    top: 1rem;
    left: 1.25rem;
  }
  
  .brand-logo {
    height: 38px;
  }

  .app-container {
    padding: 4rem 1rem 1.5rem 1rem;
    gap: 1.25rem;
  }

  .mode-btn {
    padding: 0.35rem 1rem;
    font-size: 0.95rem;
  }

  .player-card, .tv-card {
    max-width: 360px;
    padding: 1.6rem 1.25rem;
  }

  .cover-container {
    width: 210px;
    height: 210px;
  }

  .artist-name {
    font-size: 2.1rem;
  }

  .song-title {
    font-size: 1.3rem;
  }

  .volume-control-wrapper {
    width: 170px;
  }
}

/* --- Offline Mode Player Overlay & Obscure Style --- */
.player-card.is-offline {
  position: relative;
  opacity: 0.88;
  border-color: rgba(239, 68, 68, 0.4) !important;
  box-shadow: 0 30px 70px rgba(239, 68, 68, 0.15), 0 0 30px rgba(0, 0, 0, 0.8) !important;
}

.player-card.is-offline .cover-image {
  filter: grayscale(0.5) brightness(0.65);
  transition: filter 0.5s ease;
}

.player-card.is-offline .artist-name {
  color: #ff6b6b !important;
}

.player-card.is-offline .song-title {
  color: #ffaaaa !important;
}

.player-card.is-offline .live-badge {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
}

.player-card.is-offline .live-dot {
  background-color: #ef4444 !important;
  box-shadow: 0 0 8px #ef4444 !important;
  animation: none !important;
}
