/* ============================================
   Musiceli — Style CSS complet
   Design dark-first inspiré Linear/Vercel
   ============================================ */

/* --- Variables CSS --- */
:root {
    --accent: #C89B3C;
    --accent-rgb: 200, 155, 60;
    --vert: #22c55e;
    --rouge: #EF4444;
    --bleu: #3b82f6;
    --violet: #8b5cf6;
    --rayon: 14px;
    --rayon-sm: 10px;
    --rayon-rond: 50%;
    --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    --sidebar-largeur: 250px;
    --lecteur-hauteur: 80px;
}

[data-theme="sombre"] {
    --bg: #0F0F0F;
    --sidebar-bg: #0A0A0A;
    --surface: #1A1A1A;
    --texte: #E0E0E0;
    --texte-secondaire: #888;
    --bordure: rgba(255,255,255,0.06);
    --hover: rgba(255,255,255,0.03);
    --input-bg: rgba(255,255,255,0.04);
    --ombre: 0 2px 8px rgba(0,0,0,0.3);
    --ombre-lg: 0 8px 32px rgba(0,0,0,0.5);
}

[data-theme="clair"] {
    --bg: #F4F5F7;
    --sidebar-bg: #FFFFFF;
    --surface: #FFFFFF;
    --texte: #1A1A1A;
    --texte-secondaire: #666;
    --bordure: rgba(0,0,0,0.08);
    --hover: rgba(0,0,0,0.03);
    --input-bg: rgba(0,0,0,0.04);
    --ombre: 0 2px 8px rgba(0,0,0,0.08);
    --ombre-lg: 0 8px 32px rgba(0,0,0,0.12);
}

/* --- Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--texte);
    line-height: 1.5;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* --- Animations --- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

/* --- Layout principal --- */
.app-conteneur {
    display: flex;
    min-height: 100vh;
    padding-bottom: var(--lecteur-hauteur);
    overflow-x: hidden;
    max-width: 100vw;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: var(--lecteur-hauteur);
    width: var(--sidebar-largeur);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--bordure);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-lien {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--rayon-sm);
    font-size: 0.87rem;
    font-weight: 500;
    color: var(--texte-secondaire);
    transition: var(--transition);
    position: relative;
}

.sidebar-lien:hover {
    background: var(--hover);
    color: var(--texte);
}

.sidebar-lien.actif {
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
}

.sidebar-lien.actif::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.sidebar-lien svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-lien.actif svg {
    opacity: 1;
}

.sidebar-separateur {
    height: 1px;
    background: var(--bordure);
    margin: 8px 14px;
}

.sidebar-profil {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--bordure);
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--rayon-rond);
    object-fit: cover;
}

.sidebar-nom {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Topbar --- */
.topbar {
    position: sticky;
    top: 0;
    left: var(--sidebar-largeur);
    right: 0;
    height: 56px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--bordure);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    z-index: 90;
    backdrop-filter: blur(12px);
    margin-left: var(--sidebar-largeur);
}

.topbar-titre {
    display: none;
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent);
}

.topbar-droite {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.burger-btn {
    display: none;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
}

.burger-btn:hover {
    background: var(--hover);
}

.theme-toggle {
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.theme-toggle:hover {
    background: var(--hover);
}

[data-theme="sombre"] .icone-lune { display: none; }
[data-theme="clair"] .icone-soleil { display: none; }

.topbar-deconnexion {
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.topbar-deconnexion:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--rouge);
}

/* --- Contenu principal --- */
.contenu-principal {
    flex: 1;
    margin-left: var(--sidebar-largeur);
    padding: 28px;
    min-height: calc(100vh - var(--lecteur-hauteur));
    transition: opacity 0.2s ease;
}

/* Animations d'apparition en cascade */
.contenu-principal .page-entete {
    animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.contenu-principal .section-accueil {
    animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.contenu-principal .section-accueil:nth-child(2) { animation-delay: 0.05s; }
.contenu-principal .section-accueil:nth-child(3) { animation-delay: 0.1s; }
.contenu-principal .section-accueil:nth-child(4) { animation-delay: 0.15s; }

.contenu-principal .liste-videos {
    animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.contenu-principal .grille-cartes {
    animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.contenu-principal .recherche-barre {
    animation: fadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.contenu-principal .parametres-grille {
    animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

/* --- En-tête de page --- */
.page-entete {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-titre {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.page-sous-titre {
    font-size: 0.85rem;
    color: var(--texte-secondaire);
    margin-top: 4px;
}

/* --- Sections accueil --- */
.section-accueil {
    margin-bottom: 32px;
}

.section-titre {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.section-titre-date {
    font-size: 0.9rem;
    color: var(--texte-secondaire);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

/* --- Grille de cartes --- */
.grille-cartes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

/* --- Carte playlist / vidéo --- */
.carte-playlist,
.carte-video {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    display: block;
}

.carte-playlist:hover,
.carte-video:hover {
    transform: translateY(-2px);
    box-shadow: var(--ombre-lg);
}

.carte-playlist:active,
.carte-video:active {
    transform: scale(0.96);
    transition: transform 0.1s;
}

.carte-miniature {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #111;
}

.carte-miniature img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.carte-playlist:hover .carte-miniature img,
.carte-video:hover .carte-miniature img {
    transform: scale(1.05);
}

.carte-overlay-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
    color: #fff;
}

.carte-playlist:hover .carte-overlay-play,
.carte-video:hover .carte-overlay-play {
    opacity: 1;
}

.carte-infos {
    padding: 12px;
}

.carte-titre {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.carte-sous-titre {
    font-size: 0.75rem;
    color: var(--texte-secondaire);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Liste de vidéos (lignes) --- */
.liste-videos {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.video-ligne {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--rayon-sm);
    transition: var(--transition);
    cursor: pointer;
}

.video-ligne:hover {
    background: var(--hover);
}

.video-ligne:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

.video-ligne-miniature {
    width: 48px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #111;
}

.video-ligne-infos {
    flex: 1;
    min-width: 0;
}

.video-ligne-titre {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-ligne-artiste {
    font-size: 0.75rem;
    color: var(--texte-secondaire);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-ligne-heure {
    font-size: 0.72rem;
    color: var(--texte-secondaire);
    flex-shrink: 0;
}

.video-ligne-play {
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.video-ligne:hover .video-ligne-play {
    opacity: 1;
}

/* --- Playlist détail header --- */
.playlist-entete {
    flex-direction: column;
    gap: 20px;
}

.playlist-header-info {
    display: flex;
    align-items: flex-end;
    gap: 24px;
}

.playlist-grande-miniature {
    width: 180px;
    height: 180px;
    border-radius: var(--rayon);
    object-fit: cover;
    box-shadow: var(--ombre-lg);
    background: #111;
    flex-shrink: 0;
}

.playlist-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--texte-secondaire);
    margin-bottom: 6px;
}

.playlist-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.playlist-btn-play {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.playlist-btn-play:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.playlist-btn-play svg {
    margin-left: 2px;
}

.playlist-btn-melanger {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    color: var(--texte-secondaire);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.playlist-btn-melanger:hover {
    color: var(--texte);
}

.playlist-btn-melanger.actif {
    color: var(--accent);
}

.video-ligne-index {
    font-size: 0.75rem;
    color: var(--texte-secondaire);
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* --- Boutons --- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: #111;
    padding: 10px 20px;
    border-radius: var(--rayon-sm);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.3);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    color: var(--texte);
    padding: 10px 20px;
    border-radius: var(--rayon-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--bordure);
    transition: var(--transition);
    cursor: pointer;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--rouge);
    padding: 10px 20px;
    border-radius: var(--rayon-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.btn-danger:hover {
    background: var(--rouge);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.76rem;
    border-radius: 8px;
}

/* --- Recherche --- */
.recherche-barre {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.recherche-input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon-sm);
    padding: 12px 18px;
    font-size: 0.95rem;
    color: var(--texte);
    transition: var(--transition);
    outline: none;
}

.recherche-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.recherche-input::placeholder {
    color: var(--texte-secondaire);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: center;
}

/* --- Messages --- */
.chargement-indicateur {
    text-align: center;
    color: var(--texte-secondaire);
    padding: 40px 0;
    font-size: 0.9rem;
    animation: pulse 1.5s infinite;
}

.message-vide {
    text-align: center;
    color: var(--texte-secondaire);
    padding: 40px 0;
    font-size: 0.9rem;
}

.message-erreur {
    text-align: center;
    color: var(--rouge);
    padding: 40px 0;
    font-size: 0.9rem;
}

/* ============================================
   LECTEUR — Barre fixe en bas
   ============================================ */
.lecteur {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--lecteur-hauteur);
    background: var(--sidebar-bg);
    border-top: 1px solid var(--bordure);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    z-index: 200;
}

.lecteur-info {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 220px;
    flex-shrink: 0;
}

.lecteur-miniature {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: #222;
    display: none;
}

.lecteur-texte {
    min-width: 0;
}

.lecteur-titre {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lecteur-artiste {
    font-size: 0.72rem;
    color: var(--texte-secondaire);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Contrôles centraux */
.lecteur-controles {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.lecteur-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--rayon-rond);
    transition: var(--transition);
    color: var(--texte-secondaire);
}

.lecteur-btn:hover {
    color: var(--texte);
    background: var(--hover);
}

.lecteur-btn.actif {
    color: var(--accent);
}

.lecteur-btn-play {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: #111 !important;
}

.lecteur-btn-play:hover {
    filter: brightness(1.15);
    background: var(--accent);
    transform: scale(1.05);
}

/* Progression */
.lecteur-progression {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.lecteur-temps {
    font-size: 0.68rem;
    color: var(--texte-secondaire);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: center;
    flex-shrink: 0;
}

.lecteur-barre {
    flex: 1;
    height: 4px;
    background: var(--bordure);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: height 0.15s;
}

.lecteur-barre:hover {
    height: 6px;
}

.lecteur-barre-remplie {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.lecteur-barre:hover .lecteur-barre-remplie::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
}

/* Volume */
.lecteur-volume {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 130px;
    flex-shrink: 0;
}

.lecteur-volume-barre {
    flex: 1;
    height: 4px;
    background: var(--bordure);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.lecteur-volume-remplie {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.lecteur-btn-queue {
    flex-shrink: 0;
}

/* ============================================
   PANNEAU FILE D'ATTENTE
   ============================================ */
.panneau-queue {
    position: fixed;
    right: -360px;
    top: 0;
    bottom: var(--lecteur-hauteur);
    width: 350px;
    background: var(--surface);
    border-left: 1px solid var(--bordure);
    z-index: 150;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panneau-queue.ouvert {
    right: 0;
}

.queue-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bordure);
}

.queue-entete h3 {
    font-size: 1rem;
    font-weight: 600;
}

.queue-actions {
    display: flex;
    gap: 6px;
    padding: 12px 20px;
}

.queue-liste {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 12px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.queue-item:hover {
    background: var(--hover);
}

.queue-item-actif {
    background: rgba(var(--accent-rgb), 0.08);
}

.queue-item-actif .queue-item-titre {
    color: var(--accent);
}

.queue-item-miniature {
    width: 40px;
    height: 30px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #111;
}

.queue-item-infos {
    min-width: 0;
    flex: 1;
}

.queue-item-titre {
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item-artiste {
    font-size: 0.68rem;
    color: var(--texte-secondaire);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   PARAMETRES
   ============================================ */
.parametres-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.parametre-carte {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 24px;
}

.parametre-titre {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bordure);
}

.parametre-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    gap: 12px;
}

.parametre-label {
    font-size: 0.85rem;
    color: var(--texte-secondaire);
}

.parametre-toggle-groupe {
    display: flex;
    gap: 4px;
    background: var(--input-bg);
    border-radius: 8px;
    padding: 3px;
}

.parametre-theme-btn {
    padding: 5px 14px;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 6px;
    transition: var(--transition);
    color: var(--texte-secondaire);
}

.parametre-theme-btn.actif {
    background: var(--accent);
    color: #111;
}

.parametre-compte-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.parametre-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--rayon-rond);
    object-fit: cover;
}

.parametre-nom {
    font-size: 0.85rem;
    font-weight: 600;
}

.parametre-email {
    font-size: 0.75rem;
    color: var(--texte-secondaire);
}

/* Lien dans paramètres */
.parametre-lien {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--texte);
    border-bottom: 1px solid var(--bordure);
    transition: color 0.2s;
}

.parametre-lien:last-child {
    border-bottom: none;
}

.parametre-lien svg {
    color: var(--texte-secondaire);
}

/* Cacher la nav mobile des paramètres sur desktop */
.parametre-nav-mobile {
    display: none;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bordure);
    border-radius: 22px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--texte);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: #111;
}

/* ============================================
   PAGE CONNEXION
   ============================================ */
.page-connexion {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg);
}

.connexion-conteneur {
    width: 100%;
    max-width: 420px;
}

.connexion-carte {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 48px 36px;
    text-align: center;
    animation: slideUp 0.4s ease;
}

.connexion-logo {
    margin-bottom: 20px;
}

.connexion-titre {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.connexion-sous-titre {
    font-size: 0.85rem;
    color: var(--texte-secondaire);
    margin-bottom: 32px;
    line-height: 1.5;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    color: #333;
    padding: 12px 24px;
    border-radius: var(--rayon-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.1);
}

.btn-google:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.connexion-info {
    font-size: 0.72rem;
    color: var(--texte-secondaire);
    margin-top: 20px;
}

/* ============================================
   SIDEBAR OVERLAY MOBILE
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
}

.sidebar-overlay.visible {
    display: block;
}

/* ============================================
   MODE VEILLE (écran noir)
   ============================================ */
.mode-veille {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.mode-veille.actif {
    display: flex;
}

.veille-contenu {
    text-align: center;
    padding: 20px;
}

.veille-titre {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255,255,255,0.15);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80vw;
}

.veille-artiste {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.08);
    margin-bottom: 24px;
}

.veille-hint {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.06);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Bouton veille dans le lecteur fullscreen */
.lfs-footer {
    display: flex;
    justify-content: center;
    padding: 0 0 8px;
}

.lfs-btn-veille {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255,255,255,0.05);
    color: var(--texte-secondaire);
    font-size: 0.72rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.lfs-btn-veille:hover {
    background: rgba(255,255,255,0.08);
    color: var(--texte);
}

/* ============================================
   NAVIGATION MOBILE (style Spotify)
   ============================================ */
.mobile-nav {
    display: none;
}

/* ============================================
   LECTEUR PLEIN ECRAN MOBILE
   ============================================ */
.lecteur-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--bg);
    flex-direction: column;
    display: flex;
    padding: 0 24px env(safe-area-inset-bottom, 20px);
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    pointer-events: none;
}

.lecteur-fullscreen.ouvert {
    transform: translateY(0);
    pointer-events: auto;
}

.lfs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}

.lfs-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--texte-secondaire);
}

.lfs-miniature-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
    min-height: 0;
}

.lfs-miniature {
    width: 100%;
    max-width: 340px;
    aspect-ratio: 1;
    border-radius: 12px;
    object-fit: cover;
    background: var(--surface);
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lecteur-fullscreen.ouvert .lfs-miniature {
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.lecteur-fullscreen.ouvert .lfs-infos {
    animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.lecteur-fullscreen.ouvert .lfs-progression {
    animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.lecteur-fullscreen.ouvert .lfs-controles {
    animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.lfs-infos {
    padding: 8px 0 16px;
}

.lfs-titre {
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.02em;
}

.lfs-artiste {
    font-size: 0.85rem;
    color: var(--texte-secondaire);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lfs-progression {
    padding: 0 0 8px;
}

.lfs-barre {
    height: 4px;
}

.lfs-temps-row {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}

.lfs-controles {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 24px;
}

.lfs-controles .lecteur-btn {
    width: 44px;
    height: 44px;
}

.lfs-btn-play {
    width: 64px !important;
    height: 64px !important;
    background: var(--accent);
    color: #111 !important;
    border-radius: 50%;
}

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

.lfs-btn-play:active {
    transform: scale(0.92);
    filter: brightness(0.85);
    transition: transform 0.1s, filter 0.1s;
}

@media (hover: none) {
    .lecteur-btn:hover {
        color: var(--texte-secondaire);
        background: transparent;
    }
    .lfs-btn-play:hover {
        transform: none;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
    .grille-cartes {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .lecteur-volume {
        width: 100px;
    }
}

@media (max-width: 768px) {
    /* Cacher la sidebar et la topbar sur mobile */
    .sidebar {
        display: none;
    }

    .topbar {
        display: none;
    }

    /* Navigation mobile en bas */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--sidebar-bg);
        border-top: 1px solid var(--bordure);
        z-index: 300;
        padding: 6px 0;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        font-size: 0.6rem;
        font-weight: 500;
        color: var(--texte-secondaire);
        transition: color 0.2s;
        -webkit-tap-highlight-color: transparent;
        padding: 4px 0;
    }

    .mobile-nav-item.actif {
        color: var(--accent);
    }

    .mobile-nav-item:active {
        transform: scale(0.9);
        transition: transform 0.1s;
    }

    .mobile-nav-item svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    /* Contenu */
    .contenu-principal {
        margin-left: 0;
        padding: 12px 16px;
        padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px));
        min-height: 100vh;
        overflow-x: hidden;
        max-width: 100vw;
    }

    .page-titre {
        font-size: 1.4rem;
    }

    .page-entete {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 20px;
    }

    /* Lecteur compact au-dessus de la nav mobile */
    .lecteur {
        bottom: calc(44px + env(safe-area-inset-bottom, 0px));
        height: 56px;
        padding: 0 12px;
        gap: 10px;
        cursor: pointer;
        background: var(--surface);
        border-top: 1px solid var(--bordure);
        border-bottom: 1px solid var(--bordure);
    }

    .lecteur-info {
        flex: 1;
        min-width: 0;
        width: auto;
    }

    .lecteur-miniature {
        width: 40px;
        height: 40px;
        border-radius: 6px;
    }

    .lecteur-titre {
        font-size: 0.78rem;
    }

    .lecteur-artiste {
        font-size: 0.66rem;
    }

    /* Sur mobile, cacher tout sauf play + suivant */
    .lecteur-controles #btn-melanger,
    .lecteur-controles #btn-boucle,
    .lecteur-controles #btn-precedent {
        display: none;
    }

    .lecteur-btn-play {
        width: 36px;
        height: 36px;
    }

    .lecteur-controles #btn-suivant {
        display: flex;
        width: 32px;
        height: 32px;
    }

    .lecteur-progression {
        display: none;
    }

    .lecteur-volume {
        display: none;
    }

    .lecteur-btn-queue {
        display: none;
    }

    /* Queue cachée sur mobile */
    .panneau-queue {
        display: none;
    }

    /* Playlist détail */
    .playlist-entete {
        align-items: center;
    }

    .playlist-header-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
        width: 100%;
    }

    .playlist-grande-miniature {
        width: 200px;
        height: 200px;
        border-radius: 8px;
        margin: 0 auto;
    }

    .playlist-label {
        text-align: center;
    }

    .playlist-actions {
        justify-content: center;
    }

    /* Grilles */
    .grille-cartes {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* Lignes vidéo */
    .video-ligne {
        padding: 10px 4px;
        gap: 10px;
    }

    .video-ligne-miniature {
        width: 48px;
        height: 36px;
        border-radius: 4px;
    }

    .video-ligne-titre {
        font-size: 0.82rem;
    }

    .video-ligne-play {
        opacity: 0.6;
    }

    /* Paramètres */
    .parametres-grille {
        grid-template-columns: 1fr;
    }

    /* Recherche */
    .recherche-barre {
        flex-direction: column;
    }

    .recherche-input {
        padding: 12px 16px;
        font-size: 1rem;
        border-radius: 24px;
    }

    /* Section */
    .section-titre {
        font-size: 1.05rem;
    }

    /* Cartes */
    .carte-miniature {
        border-radius: 6px 6px 0 0;
    }

    .carte-infos {
        padding: 10px;
    }

    .carte-titre {
        font-size: 0.8rem;
    }

    .carte-overlay-play {
        opacity: 0;
    }

    .sidebar-overlay {
        z-index: 199;
    }

    /* Afficher le lien historique dans les paramètres sur mobile */
    .parametre-nav-mobile {
        display: block;
    }
}

@media (max-width: 480px) {
    .contenu-principal {
        padding: 10px 12px;
        padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px));
    }

    .page-titre {
        font-size: 1.2rem;
    }

    .playlist-grande-miniature {
        width: 160px;
        height: 160px;
    }

    .parametre-carte {
        padding: 16px;
    }

    .parametre-option {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .lfs-miniature {
        max-width: 280px;
    }
}

@media (max-width: 360px) {
    .grille-cartes {
        grid-template-columns: 1fr;
    }

    .lfs-miniature {
        max-width: 240px;
    }

    .lfs-titre {
        font-size: 1rem;
    }
}
