:root {
    --primary: #6c5ce7;
    --secondary: #a29bfe;
    --dark: #2d3436;
    --light: #f5f6fa;
    --success: #00b894;
    --danger: #d63031;
    --background-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --player-gradient: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--background-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.player-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    position: relative;
    animation: playerPulse 8s infinite ease-in-out;
}

@keyframes playerPulse {
    0% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); }
    50% { box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15); }
    100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); }
}

.now-playing {
    padding: 20px;
    text-align: center;
    background: var(--player-gradient);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cover {
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

.cover:hover {
    transform: scale(1.05);
}

.cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.cover i {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.7);
}

.track-info {
    margin-top: 15px;
    width: 100%;
    text-align: center;
}

.track-info h2 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
    animation: metadataFadeIn 0.5s ease forwards;
}

.track-info p {
    font-size: 0.9rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
    animation: metadataFadeIn 0.5s ease forwards;
}

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

.controls {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--light);
}

.play-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.play-btn.playing {
    background: var(--danger);
    animation: pulsePlay 1.5s infinite;
}

.play-btn.paused {
    background: var(--success);
    animation: none;
}

@keyframes pulsePlay {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.volume-slider {
    -webkit-appearance: none;
    width: 80px;
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.volume-slider.volume-changed {
    transform: scaleX(1.05);
    background: var(--primary);
}

.volume-slider.volume-changed::-webkit-slider-thumb {
    transform: scale(1.1);
}

.loading {
    animation: pulse 1.5s infinite;
}

.no-metadata {
    font-style: italic;
    opacity: 0.7;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

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

.cover {
    animation: fadeIn 0.5s ease forwards;
}

.start-screen {
    text-align: center;
    padding: 30px;
}

.start-screen .cover {
    margin-bottom: 20px;
    animation: none;
}

.start-screen .cover i {
    font-size: 3rem;
    color: var(--primary);
}

.start-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    transform: translateY(0);
    position: relative;
    overflow: hidden;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.start-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.start-btn:hover::after {
    transform: translateX(100%);
}

.error-message {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 10px;
    display: none;
}

/* Styles pour les réseaux sociaux */
.social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 0px;
    padding: 10px 0;
}

.social-link {
    color: #fff;
    font-size: 20px;
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-link:hover {
    transform: scale(1.2);
}

.social-link i {
    font-size: 1.5rem;
}

/* Animation pour les icônes */
.social-link {
    animation: fadeIn 0.5s ease forwards;
}

.social-link:nth-child(1) { animation-delay: 0.1s; }
.social-link:nth-child(2) { animation-delay: 0.2s; }
.social-link:nth-child(3) { animation-delay: 0.3s; }
.social-link:nth-child(4) { animation-delay: 0.4s; }
.social-link:nth-child(5) { animation-delay: 0.5s; }
.social-link:nth-child(6) { animation-delay: 0.6s; }

/* Couleurs spécifiques pour chaque réseau social */
.social-link.facebook i {
    color: #3b5998;
}

.social-link.x i {
    color: #000000;
    background-color: #ffffff;
    border-radius: 50%;
    padding: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-link.instagram i {
    color: #e1306c;
}

.social-link.youtube i {
    color: #ff0000;
}

.social-link.tiktok i {
    color: #000000;
}

.social-link.spotify i {
    color: #1db954;
}

/* Ajustement de la position des icônes */
.player .social-links {
    margin-top: 15px;
    position: relative;
    top: -20px; /* Ajustement pour remonter les icônes */
}

.start-screen .social-links {
    margin-top: 30px;
    position: relative;
    top: -10px; /* Ajustement pour remonter les icônes */
}

/* Animation pour le texte "Prêt à écouter" */
.start-screen h2 {
    animation: textPulse 2s infinite ease-in-out;
}

@keyframes textPulse {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

/* CSS pour le bouton historique et la modal */
.history-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 10;
}

.history-btn:hover {
    background: var(--secondary);
    transform: scale(1.1);
}

.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.history-modal.active {
    opacity: 1;
    pointer-events: all;
}

.history-content {
    background: var(--dark);
    border-radius: 15px;
    padding: 25px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.history-title {
    font-size: 1.5rem;
    color: var(--light);
    margin: 0;
}

.history-close {
    background: none;
    border: none;
    color: var(--light);
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.history-close:hover {
    transform: rotate(90deg);
}

/* Nouvelle disposition pour l'historique */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(255,255,255,0.1);
}

.history-cover {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin-right: 15px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-cover .loading {
    font-size: 1rem;
    color: rgba(255,255,255,0.5);
}

.history-cover .no-cover {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.3);
}

.history-info {
    flex-grow: 1;
}

.history-title-item {
    font-weight: bold;
    color: var(--light);
    margin-bottom: 5px;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.history-artist {
    color: var(--light);
    opacity: 0.8;
    font-size: 0.9rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.history-time {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-time i {
    font-size: 0.8rem;
}

.no-history {
    text-align: center;
    color: var(--light);
    font-size: 1.1rem;
    padding: 20px;
}

/* Animation pour les pochettes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.history-cover img {
    animation: fadeIn 0.3s ease-in-out;
}

/* Styles spécifiques pour mobile */
@media (max-width: 600px) {
    body {
        padding: 0;
    }

    .player-container {
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }

    .history-content {
        width: 95%;
        padding: 15px;
        height: 90vh;
    }

    .history-cover {
        width: 50px;
        height: 50px;
    }

    .history-title-item, .history-artist {
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        max-width: 100%;
    }

    .history-info {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .history-time {
        align-self: flex-start;
    }
}

/* Styles pour les éléments de chargement et les pochettes manquantes */
.loading-cover {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
}

.no-cover {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
}
