/* Importation des polices Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Poppins:wght@400;600;700&display=swap');

/* --- Styles Généraux et Mobile-First (pour les écrans <= 350px et plus) --- */
.tout {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #1a1a1a, #000000); /* Dégradé sombre et élégant */
    color: #f0f2f5; /* Couleur de texte claire */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Prend toute la hauteur de la vue */
    overflow-x: hidden; /* Empêche le défilement horizontal indésirable */
    position: relative;
    box-sizing: border-box; /* S'assure que padding et border sont inclus dans la largeur/hauteur */
    padding: 15px; /* Padding global pour éviter de coller les bords sur les très petits écrans */
}

/* Effet de fond subtil (particules, motifs, etc. - ici un simple gradient radial pour la démonstration) */
.tout::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top left, rgba(255, 0, 100, 0.1), transparent 50%),
                radial-gradient(circle at bottom right, rgba(0, 200, 255, 0.1), transparent 50%);
    opacity: 0.6;
    z-index: -1;
}

.toutall {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%; /* Par défaut, occupe 100% de l'espace disponible (moins le padding du body) */
    max-width: 400px; /* Limite la largeur par défaut, typique d'un smartphone */
    box-sizing: border-box;
}

/* --- Bouton Retour --- */
.toutback-button {
    background: none;
    border: none;
    color: #a0a0a0; /* Couleur discrète */
    font-size: 1.1em; /* Légèrement plus petit pour les mobiles */
    cursor: pointer;
    align-self: flex-start; /* Aligne à gauche */
    margin-bottom: 25px; /* Espacement ajusté */
    transition: color 0.3s ease;
    padding: 5px 0; /* Ajout d'un petit padding pour faciliter le clic */
}

.toutback-button:hover {
    color: #fff;
}

.toutback-button a {
    text-decoration: none;
    color: inherit; /* Hérite de la couleur du bouton */
    display: flex;
    align-items: center;
    gap: 5px;
}

/* --- Section Beat --- */
.toutbeat-section {
    background: rgba(255, 255, 255, 0.08); /* Fond semi-transparent */
    border-radius: 20px;
    padding: 20px; /* Padding de base pour la section */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px); /* Effet de flou derrière le conteneur */
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px; /* Espacement entre les éléments */
    animation: fadeInScale 0.6s ease-out forwards; /* Animation d'apparition */
    box-sizing: border-box;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Conteneur de la Cover du Beat --- */
.toutbeat-cover-container {
    width: 100%;
    padding-top: 100%; /* Ratio 1:1 pour une image carrée, s'adapte à la largeur */
    position: relative;
    border-radius: 15px;
    overflow: hidden; /* Cache ce qui dépasse */
     background: linear-gradient(rgba(0, 0, 0, 0.151), rgba(0, 77, 64, 0.7)), url('covervente.jpg') no-repeat center center/cover;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transform-style: preserve-3d; /* Pour l'effet de tilt */
}

.toutoverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent); /* Dégradé sombre en bas */
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Aligner les éléments en bas */
    align-items: center;
    padding-bottom: 15px; /* Padding ajusté */
    box-sizing: border-box;
    opacity: 1; /* Toujours visible pour le titre et le bouton */
    transition: opacity 0.3s ease;
}

.toutbeat-cover-container:hover .toutoverlay {
    opacity: 1; /* Maintenir visible ou ajouter un effet au survol si désiré */
}

.toutbeat-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.6em; /* Taille de base pour le titre */
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    text-align: center;
    word-break: break-word; /* Permet aux longs mots de se couper pour éviter le débordement */
    padding: 0 10px; /* Ajoute un peu de padding pour éviter que le texte ne touche les bords */
}

.toutbuy-button {
    background: linear-gradient(45deg, #FF2D55, #FF9500); /* Dégradé vibrant (rose-orange) */
    color: #fff;
    border: none;
    padding: 10px 25px; /* Padding de base pour le bouton */
    border-radius: 30px;
    font-family: 'Poppins', sans-serif;
    font-size: 1em; /* Taille de base pour le texte du bouton */
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 45, 85, 0.4);
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap; /* Empêche le texte du bouton de se casser sur plusieurs lignes */
}

.toutbuy-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 25px rgba(255, 45, 85, 0.6);
}

/* --- Détails du Beat --- */
.toutbeat-details ul {
    list-style: none;
    padding: 0;
    margin: 0;
    color: #a0a0a0;
    font-size: 0.9em; /* Taille de base pour les détails */
}

.toutbeat-details ul li {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toutbeat-details ul li:first-child {
    font-weight: 600;
    color: #fff;
    font-size: 1em;
}

.toutbeat-details ul li strong {
    color: #009643; /* Mettre en évidence le prix */
    font-size: 1.05em;
}

/* --- Lecteur Audio (TikTok-like) --- */
.toutaudio-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px; /* Espacement ajusté */
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px; /* Padding de base pour le lecteur */
    margin-top: 15px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
    width: 100%; /* S'assure que le lecteur prend toute la largeur disponible */
    box-sizing: border-box;
}

.toutloader-container {
    display: flex; /* Assurez-vous qu'il est flex par défaut */
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #a0a0a0;
    /* Sera contrôlé par JS pour s'afficher/masquer */
}

.toutspinner {
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #FF2D55;
    border-radius: 50%;
    width: 25px; /* Taille ajustée */
    height: 25px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.toutlisten-button {
    background: #FF2D55; /* Couleur principale */
    color: #fff;
    border: none;
    padding: 8px 20px; /* Padding de base pour le bouton d'écoute */
    border-radius: 25px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9em; /* Taille de base pour le texte du bouton d'écoute */
    font-weight: 600;
    cursor: pointer;
    display: flex; /* Assurez-vous qu'il est flex par défaut */
    align-items: center;
    gap: 8px;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 5px 15px rgba(255, 45, 85, 0.3);
    text-align: center;
    width: fit-content; /* S'adapte à la largeur du contenu */
}

.toutlisten-button:hover {
    background: #FF5A7A;
    transform: translateY(-2px);
}

.toutplay-icon, .toutpause-icon {
    font-size: 1.1em; /* Taille ajustée */
}

.toutprogress-bar-container {
    width: 100%;
    height: 5px; /* Hauteur ajustée */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
    cursor: pointer; /* Indique que la barre est cliquable */
}

.toutprogress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00C8FF, #FF2D55); /* Dégradé pour la barre de progression */
    border-radius: 3px;
    transition: width 0.1s linear; /* Animation fluide de la progression */
}

.touttime-display {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.75em; /* Taille ajustée */
    color: #a0a0a0;
}

.toutcurrent-time {
    color: #fff;
    font-weight: 600;
}

/* Le conteneur du lecteur YouTube lui-même - caché visuellement */
#toutplayer {
    position: absolute; /* Position absolue pour ne pas perturber le flux */
    left: -9999px;      /* Déplacez-le hors de la vue */
    top: -9999px;
    width: 1px;         /* Réduisez sa taille au minimum */
    height: 1px;
    opacity: 0;         /* Rendez-le complètement transparent */
    pointer-events: none; /* Empêche toute interaction */
}

/* --- Nouvelle section pour la playlist --- */
.toutplaylist-section {
    width: 100%;
    margin-top: 40px; /* Espacement avec la section du beat principal */
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}

.toutplaylist-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5em;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.toutplaylist-horizontal-scroll {
    width: 100%;
    overflow-x: auto; /* Permet le défilement horizontal */
    -webkit-overflow-scrolling: touch; /* Améliore le défilement sur iOS */
    scrollbar-width: none; /* Cache la barre de défilement pour Firefox */
    padding-bottom: 10px; /* Espace pour une barre de défilement invisible */
}

/* Cache la barre de défilement pour WebKit (Chrome, Safari) */
.toutplaylist-horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.toutplaylist-container {
    display: flex; /* Affiche les éléments côte à côte */
    gap: 15px; /* Espacement entre les éléments de la playlist */
    padding: 5px; /* Petit padding pour éviter que le contenu ne colle les bords du scroll */
    min-width: fit-content; /* S'assure que le conteneur ne se contracte pas */
}

.toutplaylist-item {
    flex-shrink: 0; /* Empêche les éléments de rétrécir */
    width: 140px; /* Largeur fixe pour chaque élément */
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 10px; /* Pour le texte */
}

.toutplaylist-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.toutplaylist-item img {
    width: 100%;
    height: 140px; /* Image carrée */
    object-fit: cover; /* S'assure que l'image couvre l'espace */
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    margin-bottom: 5px;
}

.toutplaylist-item .toutitem-title {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    color: #f0f2f5;
    text-align: center;
    padding: 0 8px;
    word-break: break-word; /* Permet aux titres longs de se couper */
}

/* --- Media Queries (Points de rupture stratégiques) --- */

/* Pour les écrans ultra-petits (moins de 350px) - ajustements très minimes */
@media (max-width: 350px) {
   .tout {
        padding: 10px; /* Réduit encore le padding global */
    }
    .toutbeat-section {
        padding: 15px;
        gap: 15px;
    }
    .toutback-button {
        font-size: 1em;
        margin-bottom: 20px;
    }
    .toutbeat-title {
        font-size: 1.4em;
        margin-bottom: 8px;
        padding: 0 5px;
    }
    .toutbuy-button {
        padding: 8px 18px;
        font-size: 0.9em;
    }
    .toutbeat-details ul {
        font-size: 0.85em;
    }
    .toutbeat-details ul li {
        margin-bottom: 4px;
        gap: 6px;
    }
    .toutaudio-player {
        padding: 10px;
        gap: 10px;
    }
    .toutlisten-button {
        padding: 6px 15px;
        font-size: 0.8em;
        gap: 6px;
    }
    .toutspinner {
        width: 20px;
        height: 20px;
        border-width: 2px;
    }
    .toutprogress-bar-container {
        height: 4px;
        margin-top: 6px;
    }
    .touttime-display {
        font-size: 0.7em;
    }
    /* Playlist adjustments for very small screens */
    .toutplaylist-section {
        padding: 15px;
        margin-top: 30px;
    }
    .toutplaylist-title {
        font-size: 1.3em;
        margin-bottom: 20px;
    }
    .toutplaylist-item {
        width: 120px; /* Réduire la taille des éléments de la playlist */
        height: auto;
    }
    .toutplaylist-item img {
        height: 120px;
    }
    .toutplaylist-item .toutitem-title {
        font-size: 0.8em;
    }
}

/* Pour les écrans plus grands que 380px (majorité des smartphones) */
@media (min-width: 380px) {
    .tout {
        padding: 20px; /* Plus de padding global */
    }
    .toutall {
        max-width: 450px; /* Taille typique des iPhones, Androids */
    }
    .toutback-button {
        font-size: 1.2em;
        margin-bottom: 30px;
    }
    .beat-section {
        padding: 25px;
        gap: 25px;
    }
    .toutoverlay {
        padding-bottom: 20px;
    }
    .toutbeat-title {
        font-size: 1.8em;
        margin-bottom: 15px;
    }
    .toutbuy-button {
        padding: 12px 30px;
        font-size: 1.1em;
    }
    .toutbeat-details ul {
        font-size: 0.95em;
    }
    .toutbeat-details ul li {
        margin-bottom: 8px;
        gap: 10px;
    }
    .toutbeat-details ul li:first-child {
        font-size: 1.1em;
    }
    .toutbeat-details ul li strong {
        font-size: 1.1em;
    }
    .toutaudio-player {
        padding: 20px;
        gap: 15px;
    }
    .toutspinner {
        width: 30px;
        height: 30px;
    }
    .toutlisten-button {
        padding: 10px 25px;
        font-size: 1em;
        gap: 10px;
    }
    .toutplay-icon, .toutpause-icon {
        font-size: 1.2em;
    }
    .progress-bar-container {
        height: 6px;
        margin-top: 10px;
    }
    .touttime-display {
        font-size: 0.85em;
    }
}

/* Pour les écrans plus grands que 580px (smartphones en paysage, petites tablettes) */
@media (min-width: 580px) {
    .toutall {
        max-width: 550px; /* Permet un peu plus de largeur */
    }
    .toutbeat-section {
        padding: 30px;
    }
    .toutbeat-title {
        font-size: 2em;
    }
}

/* Pour les écrans plus grands que 760px (tablettes, petits ordinateurs portables) */
@media (min-width: 760px) {
    .toutall {
        max-width: 700px; /* Permet une largeur confortable pour les tablettes */
    }
    .tout {
        padding: 40px; /* Plus de padding sur les grands écrans */
    }
    .toutback-button {
        font-size: 1.3em;
        margin-bottom: 40px;
    }
    .toutbeat-section {
        flex-direction: row; /* La cover et les détails côte à côte */
        align-items: flex-start;
        gap: 40px;
        padding: 40px;
    }
    .toutbeat-cover-container {
        width: 250px; /* Taille fixe pour la cover */
        min-width: 250px;
        padding-top: 250px;
    }
    .toutbeat-details {
        flex-grow: 1; /* Les détails prennent l'espace restant */
    }
    .toutbeat-title {
        font-size: 2.2em;
        text-align: left; /* Aligne le titre à gauche */
        padding: 0; /* Plus besoin de padding latéral */
    }
    .toutbuy-button {
        padding: 15px 35px;
        font-size: 1.2em;
    }
    .toutaudio-player {
        padding: 25px;
    }
    .toutlisten-button {
        padding: 12px 30px;
        font-size: 1.1em;
    }
    /* Playlist adjustments for larger screens */
    .toutplaylist-section {
        padding: 30px;
        margin-top: 60px;
    }
    .toutplaylist-title {
        font-size: 1.8em;
        margin-bottom: 35px;
    }
    .toutplaylist-item {
        width: 160px; /* Agrandir les éléments de la playlist */
    }
    .toutplaylist-item img {
        height: 160px;
    }
    .toutplaylist-item .toutitem-title {
        font-size: 1em;
    }
}

/* Pour les écrans plus grands que 1024px (ordinateurs de bureau) */
@media (min-width: 1024px) {
    .toutall {
        max-width: 850px; /* Plus large pour les grands écrans */
    }
    .toutbeat-section {
        gap: 60px;
        padding: 50px;
    }
    .toutbeat-cover-container {
        width: 300px;
        min-width: 300px;
        padding-top: 300px;
    }
    .toutbeat-title {
        font-size: 2.5em;
    }
    .toutbuy-button {
        padding: 18px 40px;
        font-size: 1.3em;
    }
}

/* Pour les écrans très larges > 1200px (écrans 4K, etc.) */
@media (min-width: 1200px) {
    .toutall {
        max-width: 950px; /* Encore plus large pour maximiser l'espace */
    }
    .toutbeat-title {
        font-size: 2.8em;
    }
    .toutbuy-button {
        padding: 20px 45px;
        font-size: 1.4em;
    }
    /* Playlist adjustments for extra large screens */
    .toutplaylist-section {
        padding: 40px;
    }
    .toutplaylist-title {
        font-size: 2em;
    }
    .toutplaylist-item {
        width: 180px;
    }
    .toutplaylist-item img {
        height: 180px;
    }
}