/* ==========================================================================
   Radio Senise Centrale - 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, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-color);
  background: var(--bg-gradient);
  color: var(--text-white);
  font-family: var(--font-body);
  overflow-x: hidden;
}

/* --- Top Left Brand Logo Header --- */
.top-header {
  position: absolute;
  top: 1.75rem;
  left: 2.25rem;
  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; /* Natural font style */
  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; /* Invisible Pocket clipping boundary */
  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;
}

/* Spinning Cover Image Animation */
@keyframes spinCover {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  animation: spinCover 18s linear infinite;
  animation-play-state: paused;
  transition: filter 0.4s ease, transform 0.45s cubic-bezier(0.55, 0, 0.1, 1), opacity 0.35s ease;
  will-change: transform, opacity;
}

.cover-image.playing {
  animation-play-state: running;
  filter: blur(0px) brightness(1);
}

.cover-image.paused {
  animation-play-state: paused;
  filter: blur(7px) brightness(0.65);
}

/* --- Vinyl Pocket Slide Transition: Disk stops spinning & slides down into pocket --- */
.cover-image.cover-slide-down {
  animation-play-state: paused !important; /* Stop rotation during transition */
  transform: translateY(140%) scale(0.75) !important;
  opacity: 0 !important;
  transition: transform 0.42s cubic-bezier(0.55, 0, 0.1, 1), opacity 0.35s ease !important;
}

.cover-image.cover-slide-up-prep {
  animation-play-state: paused !important;
  transform: translateY(140%) scale(0.75) !important;
  opacity: 0 !important;
  transition: none !important;
}

.cover-image.cover-slide-up-active {
  animation-play-state: paused !important;
  transform: translateY(0%) scale(1) !important;
  opacity: 1 !important;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease !important;
}

/* 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; /* Optical center alignment for play triangle */
}

.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; /* Natural font style */
  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;
}

.artist-name {
  font-family: 'RSCHeadingNowA', 'RSCHeadingNow', 'Oswald', sans-serif;
  font-size: 2.95rem;
  font-weight: 700; /* RSCHeadingNow A */
  font-style: normal; /* Natural font style (straight / dritto) */
  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; /* Natural font style (straight / dritto) */
  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; /* Natural font style */
  color: var(--text-white);
  letter-spacing: 0.5px;
}

/* --- Storico Card Section (Identical Player Card Style) --- */
.storico-card {
  width: 100%;
  max-width: 510px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 40px;
  padding: 2.25rem 1.75rem;
  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);
}

.storico-header-title {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-white);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
  text-align: center;
}

.storico-header-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
  text-align: center;
}

.storico-list {
  width: 100%;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.35rem;
}

.storico-list::-webkit-scrollbar {
  width: 5px;
}

.storico-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.storico-list::-webkit-scrollbar-thumb {
  background: var(--accent-red);
  border-radius: 10px;
}

.storico-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: var(--transition-smooth);
}

.storico-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(211, 47, 47, 0.4);
}

.storico-item-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
}

.storico-cover {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-red);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.storico-details {
  min-width: 0;
}

.storico-artist {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-red-bright);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.storico-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.storico-time-badge {
  background: rgba(211, 47, 47, 0.18);
  border: 1px solid rgba(211, 47, 47, 0.4);
  color: var(--text-white);
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

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

  .app-container {
    padding: 3.75rem 0.75rem 1.5rem 0.75rem;
    gap: 1.25rem;
  }

  .mode-btn {
    padding: 0.5rem 1.2rem;
    font-size: 1rem;
  }

  .player-card, .tv-card {
    width: 96%;
    max-width: 450px;
    padding: 2.2rem 1.5rem;
    border-radius: 36px;
  }

  .cover-container {
    width: 275px;
    height: 275px;
    margin-bottom: 1.5rem;
  }

  .play-overlay-btn {
    width: 74px;
    height: 74px;
  }

  .play-overlay-btn svg {
    width: 34px;
    height: 34px;
  }

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

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

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

@media (max-width: 480px) {
  .player-card, .tv-card {
    width: 98%;
    padding: 1.85rem 1.15rem;
  }

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

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

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