/* --- RIMUOVE AURA BLU E FOCUS --- */
* {
    -webkit-tap-highlight-color: transparent;
}
button:focus, input:focus, a:focus {
    outline: none;
}
/* ------------------------------- */

body {
    margin: 0;
    background-color: #f0f0f0;
    font-family: 'IBM Plex Mono', monospace;
    color: black;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    padding-bottom: 80px;
}

#page-title {
    margin-top: 10px;
    text-align: center;
    width: 100%;
    font-family: 'IBM Plex Mono', monospace;
}

.music-container {
    padding: 20px;
    text-align: center;
    width: 80%;
    max-width: 600px;
    position: relative;
    margin-top: 20px;
    margin-bottom: 20px;
    transition: opacity 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.album {
    margin-bottom: 20px;
}

.album img {
    max-width: 200px;
    width: 200px;
    border-radius: 5px;
}

.album-cover-clickable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.album-cover-clickable:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}


#album-title {
    margin-top: 10px;
    font-size: 1.1em;
    font-family: 'IBM Plex Mono', monospace;
    width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#track-title {
    margin-top: 5px;
    font-size: 1em;
    font-family: 'IBM Plex Mono', monospace;
    width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 200px;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
    width: 100%;
}

.controls button {
    padding: 15px 30px;
    font-family: 'IBM Plex Mono', monospace;
    border: none;
    background-color: transparent;
    font-size: 1.5em;
    outline: none;
    box-shadow: none;
    cursor: pointer;
    border-radius: 3px;
    flex-grow: 0;
    text-align: center;
}

.progress-bar {
    width: 100%;
    margin-top: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: #ccc;
    height: 3px;
    cursor: pointer;
    border-radius: 2px;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: black;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    cursor: pointer;
}

.progress-bar::-moz-range-thumb {
    background: black;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.time-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 3px;
    font-size: 0.7em;
    color: #555;
    font-family: 'IBM Plex Mono', monospace;
}

/* =========================================
   STILI HAMBURGER MENU (CORRETTO)
   ========================================= */
.hamburger-menu {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    transition: visibility 0.2s, opacity 0.2s linear;
}

/* Nasconde il menu quando il player è aperto */
.hamburger-menu.hidden-by-player {
    visibility: hidden;
    opacity: 0;
}

.menu__btn {
    position: relative;
    display: flex;
    align-items: center;
    width: 26px;
    height: 26px;
    cursor: pointer;
    /* MODIFICATO: Z-index aumentato a 1002 per stare sopra al box del menu (che è 1000) */
    z-index: 1002; 
}

.menu__btn > span,
.menu__btn > span::before,
.menu__btn > span::after {
    display: block;
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: black;
    transition-duration: .25s;
}

.menu__btn > span::before {
    content: '';
    top: -8px;
}

.menu__btn > span::after {
    content: '';
    top: 8px;
}

.menu__box {
    display: block;
    position: fixed;
    visibility: hidden;
    top: 0;
    left: -100%;
    width: 300px;
    height: 100vh;
    margin: 0;
    padding: 80px 0;
    list-style: none;
    background-color: #ECEFF1;
    box-shadow: 2px 2px 6px rgba(0, 0, 0, .4);
    transition-duration: .25s;
    z-index: 1000; /* Il box è 1000, quindi il bottone deve essere > 1000 */
}

.menu__item {
    display: block;
    padding: 12px 24px;
    color: black;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 20px;
    text-decoration: none;
    transition-duration: .25s;
}

.menu__item:hover {
    background-color: #CFD8DC;
}

#menu__toggle {
    display: none;
}

#menu__toggle:checked ~ .menu__btn > span {
    transform: rotate(45deg);
}

#menu__toggle:checked ~ .menu__btn > span::before {
    top: 0;
    transform: rotate(0deg);
}

#menu__toggle:checked ~ .menu__btn > span::after {
    top: 0;
    transform: rotate(90deg);
}

#menu__toggle:checked ~ .menu__box {
    visibility: visible;
    left: 0;
}
/* ========================================= */


@media (max-width: 600px) {
    .music-container {
        width: 95%;
        padding: 10px;
    }

    .album {
        margin-bottom: 15px;
    }

    .album img {
        max-width: 150px;
        width: 150px;
    }

    .player {
        width: 150px;
    }

    .controls {
        gap: 10px;
    }

    .controls button {
        padding: 10px 20px;
        font-size: 1.2em;
    }
}

/* Stili Player Globale */
#global-player-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}

#global-player-container.hidden {
    transform: translateY(100%);
}

#player-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    border-top: 1px solid #ccc;
    height: 60px;
    padding: 0 10px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.player-bar-clickable {
    display: flex;
    align-items: center;
    flex-grow: 1;
    cursor: pointer;
    width: calc(100% - 60px); 
    overflow: hidden;
}

#bar-album-cover {
    width: 40px;
    height: 40px;
    object-fit: cover;
    margin-right: 10px;
    border-radius: 4px;
}

.bar-track-info {
    display: flex;
    flex-direction: column;
    font-size: 0.8em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

#bar-track-title {
    font-weight: bold;
    text-overflow: ellipsis;
    overflow: hidden;
}

#bar-album-title {
    color: #555;
    text-overflow: ellipsis;
    overflow: hidden;
}

#player-bar .play-pause-btn {
    font-size: 1.5em;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

#player-expanded {
    position: fixed;
    top: 100%;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #f0f0f0;
    z-index: 1001; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.4s;
    visibility: hidden;
}

#player-expanded.active {
    top: 0;
    visibility: visible;
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
}

#close-expanded-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.5em;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1002;
    color: #555;
    font-weight: bold;
}

.expanded-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 90%;
    max-width: 350px;
}

#expanded-album-cover {
    width: 80vw;
    height: 80vw;
    max-width: 300px;
    max-height: 300px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

#expanded-album-title {
    font-size: 1.2em;
    font-weight: bold;
    margin: 10px 0 5px 0;
}

#expanded-track-title {
    font-size: 1em;
    color: #333;
    margin-bottom: 20px;
}

#player-expanded .controls {
    width: 100%;
}

#player-expanded .progress-bar {
    width: 100%;
}

#player-expanded .time-container {
    width: 100%;
}


/* Stili per il Modal Tracklist */

#modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#modal-backdrop.active {
    visibility: visible;
    opacity: 1;
}

#tracklist-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 1002;
    
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    
    display: flex;
    flex-direction: column;
}

#tracklist-modal.active {
    visibility: visible;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#close-tracklist-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
#close-tracklist-btn:hover {
    color: #333;
}

#tracklist-content {
    padding: 20px;
    text-align: center;
    overflow-y: auto;
}

.tracklist-cover {
    width: 150px;
    height: 150px;
    border-radius: 5px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tracklist-album-title {
    font-size: 1.2em;
    font-weight: bold;
    margin: 0 0 20px 0;
}

.tracklist-ol {
    list-style-type: decimal;
    padding-left: 30px;
    margin: 0;
    text-align: left;
}

.tracklist-item {
    padding: 12px 10px;
    font-size: 0.9em;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tracklist-item:hover {
    background-color: #f9f9f9;
}

.tracklist-item:last-child {
    border-bottom: none;
}

/* Stile icone SVG */
.play-pause-btn svg {
    width: 1em; 
    height: 1em;
    fill: currentColor; 
    vertical-align: middle; 
    flex-shrink: 0; 
}