/**
 * NowPlay - Stili CSS Personalizzati
 * 
 * Questi stili integrano Tailwind CSS (caricato da CDN)
 * 
 * Data inizio: 26/11/2025
 * Versione: 8
 * Ultima modifica: 05/03/2026 15:00
 */

/* ============================================
   VARIABILI CSS
   ============================================ */
:root {
    --primary: #1db954;
    --primary-hover: #1ed760;
    --background-dark: #121212;
    --surface-dark: #1a1a1a;
    --surface-dark-hover: #282828;
    --border-dark: #282828;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #6a6a6a;
}

/* ============================================
   RESET E BASE
   ============================================ */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--background-dark);
    color: var(--text-primary);
    font-family: 'Spline Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   SCROLLBAR PERSONALIZZATA
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-dark-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   PLAYER PROGRESS BAR
   ============================================ */
.progress-container {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    transition: height 0.1s ease;
}

.progress-container:hover {
    height: 8px;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    position: relative;
    transition: width 0.1s linear;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.progress-container:hover .progress-bar::after {
    opacity: 1;
}

/* ============================================
   VOLUME SLIDER
   ============================================ */
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* ============================================
   TRACKLIST
   ============================================ */
.track-row {
    transition: background-color 0.15s ease;
}

.track-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.track-row.playing {
    background-color: rgba(29, 185, 84, 0.1);
    border-left: 3px solid var(--primary);
}

.track-row.playing .track-title {
    color: var(--primary);
}

.track-row.playing .track-number {
    color: var(--primary);
}

/* ============================================
   ALBUM GRID
   ============================================ */
.album-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.album-card:hover {
    transform: translateY(-4px);
}

.album-card:hover .album-cover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.album-cover {
    transition: box-shadow 0.2s ease;
}

/* Bottone share sulle card album: visibile in hover su desktop, sempre su mobile */
.album-share-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.album-card:hover .album-share-btn {
    opacity: 1;
}

@media (max-width: 640px) {
    .album-share-btn {
        opacity: 1;
    }
}


/* ============================================
   POPUP E MODAL
   ============================================ */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    background: var(--surface-dark);
    border-radius: 12px;
    padding: 24px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.popup-overlay.active .popup-content {
    transform: scale(1);
}

/* ============================================
   LYRICS SIDEBAR (desktop: pannello laterale, mobile: overlay)
   ============================================ */
.lyrics-sidebar {
    position: fixed;
    top: 70px;
    right: 0;
    width: 450px;
    height: calc(100vh - 70px);
    background: var(--surface-dark);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-top-left-radius: 16px;
    z-index: 90;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.lyrics-sidebar.active {
    transform: translateX(0);
}

.lyrics-sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px 24px;
    overflow: hidden;
}

.lyrics-sidebar .lyrics-panel-body {
    flex: 1;
    overflow-y: auto;
    max-height: none;
}

/* Mobile: la sidebar diventa modale fullscreen */
@media (max-width: 640px) {
    .lyrics-sidebar {
        display: none;
    }

    .lyrics-sidebar.active {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-left: none;
        border-top-left-radius: 0;
        transform: none;
        background: var(--background-dark);
        z-index: 9999;
    }
}

/* ============================================
   VOTE POPUP
   ============================================ */
.vote-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.vote-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface-dark-hover);
    color: var(--text-primary);
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.vote-btn:hover {
    background: var(--primary);
    color: var(--background-dark);
}

.vote-btn.selected {
    background: var(--primary);
    color: var(--background-dark);
}


/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 110;
}

.toast {
    background: var(--surface-dark);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--surface-dark) 25%, var(--surface-dark-hover) 50%, var(--surface-dark) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   PLAY BUTTON ANIMATION
   ============================================ */
.play-btn {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.play-btn:hover {
    transform: scale(1.05);
}

.play-btn:active {
    transform: scale(0.98);
}

/* ============================================
   CONTROL BUTTONS
   ============================================ */
.control-btn {
    transition: color 0.15s ease, transform 0.1s ease;
}

.control-btn:hover {
    color: var(--text-primary);
}

.control-btn:active {
    transform: scale(0.9);
}

.control-btn.active {
    color: var(--primary);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 640px) {
    .progress-container {
        height: 4px;
    }
    
    .progress-container:hover {
        height: 6px;
    }
    
    .volume-slider {
        width: 60px;
    }
}

/* ============================================
   ANIMAZIONI
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.slide-up {
    animation: slideUp 0.3s ease forwards;
}

/* ============================================
   MATERIAL SYMBOLS OVERRIDES
   ============================================ */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

.material-symbols-outlined.fill {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ============================================
   PLAYLIST SIDEBAR (Desktop)
   ============================================ */
.scrollbar-thin::-webkit-scrollbar {
    width: 4px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

#playlist-sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.playlist-sidebar-item {
    transition: background-color 0.15s ease;
}

.playlist-sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.playlist-sidebar-item.active,
.playlist-sidebar-item.bg-white\/10 {
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--primary);
    padding-left: calc(0.5rem - 3px);
}

/* ============================================
   PLAYLIST CAROUSEL (Mobile)
   ============================================ */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

#playlist-carousel {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.playlist-card {
    scroll-snap-align: start;
    transition: transform 0.2s ease;
}

.playlist-card:hover {
    transform: translateY(-2px);
}

.playlist-card img {
    transition: box-shadow 0.2s ease;
}

.playlist-card img.ring-2 {
    box-shadow: 0 0 0 2px var(--primary);
}

/* ============================================
   PLAYLIST ACTIVE STATE
   ============================================ */
.playlist-sidebar-item img,
.playlist-card img {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.playlist-sidebar-item:hover img {
    transform: scale(1.05);
}

/* ============================================
   PLAYLIST WHEEL 3D (Desktop)
   ============================================ */
.playlist-wheel {
    transform-style: preserve-3d;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.playlist-wheel-item {
    position: absolute;
    width: 200px;
    left: 50%;
    transform-origin: center center;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    background: transparent;
}

.playlist-wheel-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.playlist-wheel-item.active {
    background: rgba(29, 185, 84, 0.15);
    border-left: 3px solid var(--primary);
}

.playlist-wheel-item img {
    border-radius: 4px;
    object-fit: cover;
    background: var(--surface-dark);
    transition: transform 0.3s ease;
}

.playlist-wheel-item:hover img {
    transform: scale(1.05);
}

.playlist-wheel-item .playlist-info {
    flex: 1;
    min-width: 0;
    transition: opacity 0.3s ease;
}

.playlist-wheel-item .playlist-name {
    font-size: 14px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-wheel-item .playlist-count {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* Stati della ruota in base alla posizione */
.playlist-wheel-item[data-position="0"] {
    transform: translateX(-50%) translateY(-50%) translateZ(60px) rotateX(0deg);
    top: 50%;
    opacity: 1;
    z-index: 5;
}

.playlist-wheel-item[data-position="0"] img {
    width: 48px;
    height: 48px;
}

.playlist-wheel-item[data-position="1"],
.playlist-wheel-item[data-position="-1"] {
    opacity: 0.7;
    z-index: 4;
}

.playlist-wheel-item[data-position="1"] img,
.playlist-wheel-item[data-position="-1"] img {
    width: 40px;
    height: 40px;
}

.playlist-wheel-item[data-position="1"] {
    transform: translateX(-50%) translateY(calc(-50% + 70px)) translateZ(30px) rotateX(-15deg);
    top: 50%;
}

.playlist-wheel-item[data-position="-1"] {
    transform: translateX(-50%) translateY(calc(-50% - 70px)) translateZ(30px) rotateX(15deg);
    top: 50%;
}

.playlist-wheel-item[data-position="2"],
.playlist-wheel-item[data-position="-2"] {
    opacity: 0.4;
    z-index: 3;
}

.playlist-wheel-item[data-position="2"] img,
.playlist-wheel-item[data-position="-2"] img {
    width: 32px;
    height: 32px;
}

.playlist-wheel-item[data-position="2"] {
    transform: translateX(-50%) translateY(calc(-50% + 130px)) translateZ(0px) rotateX(-25deg);
    top: 50%;
}

.playlist-wheel-item[data-position="-2"] {
    transform: translateX(-50%) translateY(calc(-50% - 130px)) translateZ(0px) rotateX(25deg);
    top: 50%;
}

.playlist-wheel-item[data-position="2"] .playlist-info,
.playlist-wheel-item[data-position="-2"] .playlist-info {
    opacity: 0.6;
}

/* Elementi fuori vista */
.playlist-wheel-item.hidden-item,
.playlist-wheel-item.hidden-item-top {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Contenitore con overflow hidden per tagliare elementi */
#playlist-sidebar-wrapper {
    overflow: hidden;
}

/* ============================================
   RESPONSIVE PLAYLIST
   ============================================ */
@media (max-width: 640px) {
    #playlist-section {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    #playlist-carousel {
        padding-left: 0;
        padding-right: 1rem;
    }
    
    /* Su mobile, tre puntini sempre visibili */
    .playlist-card .playlist-menu-btn {
        opacity: 1;
    }
}

/* ============================================
   LYRICS - Display live nel player
   ============================================ */

/* Contenitore delle 2 righe live (visibile solo con testi sincronizzati) */
.lyrics-live {
    transition: opacity 0.3s ease, max-height 0.3s ease;
    max-height: 60px;
    opacity: 1;
}

/* Quando nascosto, nessun spazio occupato */
.lyrics-live.hidden {
    max-height: 0;
    opacity: 0;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

/* Riga corrente: leggero effetto di transizione al cambio */
#lyrics-current-line {
    transition: opacity 0.15s ease;
}

/* Pulsante lyrics attivo (quando il pannello è aperto) */
#btn-lyrics.active {
    color: var(--primary);
}


/* ============================================
   LYRICS - Pannello completo
   ============================================ */

/* Scrollbar personalizzata per il pannello lyrics */
.lyrics-panel-body::-webkit-scrollbar {
    width: 4px;
}

.lyrics-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.lyrics-panel-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* Singola riga nel pannello synced: transizione fluida per evidenziazione */
.lyrics-line {
    transition: color 0.3s ease, font-size 0.3s ease, font-weight 0.3s ease;
}
