/* =======================================================
   0. AJUSTES GLOBALES Y MODO ESCOLAR (ELIMINACIÓN FORZADA)
   ======================================================= */
html,
body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

/* Destrucción total del botón de modo escolar */
a[href*="escolar"],
a[href*="school"],
.btn-escolar,
#btn-escolar,
.school-mode,
#school-mode,
.floating-btn-escolar,
img[src*="escolar"],
[title*="escolar"],
[title*="school"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    z-index: -99999 !important;
}

/* =======================================================
   1. HEADER Y ESTILOS BASE
   ======================================================= */
:root {
    --music-primary: #FF2D55;
    --music-dark: #cc2444;
    --player-bg: rgba(255, 255, 255, 0.85);
    --player-text: #1e293b;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] {
    --player-bg: rgba(15, 23, 42, 0.85);
    --player-text: #f8fafc;
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
}

.music-header {
    text-align: center;
    padding: 60px 20px 30px;
    background: linear-gradient(to bottom, rgba(255, 45, 85, 0.1), transparent);
    position: relative;
}

.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 10;
}

.btn-back:hover {
    background: var(--music-primary);
    color: white;
    border-color: var(--music-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 45, 85, 0.3);
}

.music-header h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 10px;
}

.music-header p {
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 30px;
    font-size: 1.1rem;
}

.content-section {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 80px;
    padding: 0 20px;
    min-height: 50vh;
    overflow: hidden;
}

.section-title {
    font-size: 1.8rem;
    color: var(--text-main);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--music-primary);
    display: inline-block;
    padding-bottom: 5px;
}

/* =======================================================
   2. DIRECTORIO DE ARTISTAS
   ======================================================= */
.artist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
    width: 100%;
}

.artist-card {
    background: var(--player-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 25px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: 0.3s;
    backdrop-filter: blur(10px);
    width: 100%;
    cursor: pointer;
}

.artist-card:hover {
    transform: translateY(-5px);
    border-color: var(--music-primary);
    box-shadow: 0 15px 35px rgba(255, 45, 85, 0.15);
}

@keyframes coinFlipRedGlow {
    0% {
        transform: perspective(600px) rotateY(0deg);
        box-shadow: 0 0 5px rgba(255, 0, 0, 0);
    }

    50% {
        box-shadow: 0 0 35px rgba(255, 0, 0, 1);
    }

    100% {
        transform: perspective(600px) rotateY(360deg);
        box-shadow: 0 0 18px rgba(255, 0, 0, 0.7);
    }
}

.artist-photo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 4px solid #ff0000;
    padding: 3px;
    animation: coinFlipRedGlow 1.2s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.artist-info {
    width: 100%;
    min-width: 0;
}

.artist-info h3 {
    margin: 0 0 5px;
    font-size: 1.3rem;
    color: var(--player-text);
}

.artist-info .genre {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: var(--music-primary);
    font-weight: 600;
}

.artist-info .desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.social-links {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
    width: 100%;
}

.social-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    transition: 0.3s;
    flex-shrink: 0;
}

.social-btn:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.s-yt { background: #FF0000; color: white !important; }
.s-sp { background: #1DB954; color: white !important; }
.s-ap { background: linear-gradient(135deg, #e2e2e2, #999999); color: black !important; }
.s-dk { background: #FF7A00; color: white !important; }
.s-fb { background: #1877F2; }
.s-ig { background: #E4405F; }
.s-tk { background: #000000; }
.s-tw { background: #000000; }
.s-wb { background: #0A84FF; }

[data-theme="dark"] .s-tk,
[data-theme="dark"] .s-tw {
    background: #333333;
}

/* --- Estilos Lightbox (Fotos) --- */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.9);
    z-index: 100000;
    display: none;
    justify-content: center;
    align-items: center;
}
.lightbox-overlay.active {
    display: flex;
}
.lightbox-img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.2);
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    background: none;
    border: none;
}

.ref-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.ref-btn {
    background: rgba(128, 128, 128, 0.1);
    color: var(--player-text);
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    text-decoration: none;
}

.ref-btn:hover {
    background: var(--music-primary);
    color: white;
}

/* =======================================================
   3. LAYOUT DIVIDIDO: PLAYLIST Y REPRODUCTOR
   ======================================================= */
.music-split-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    align-items: stretch;
    margin-bottom: 50px;
    width: 100%;
}

@media (min-width: 900px) {
    .music-split-layout {
        grid-template-columns: 1.2fr 1fr;
    }
}

.playlist-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    width: 100%;
}

.playlist-column::-webkit-scrollbar {
    width: 6px;
}

.playlist-column::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
    border-radius: 10px;
}

.track-item {
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 12px 15px;
    border-radius: 15px;
    gap: 15px;
    transition: 0.3s;
    cursor: pointer;
    width: 100%;
}

.track-item:hover,
.track-item.playing-active {
    transform: translateX(5px);
    border-color: var(--music-primary);
    box-shadow: 0 5px 15px rgba(255, 45, 85, 0.1);
}

.track-item.playing-active {
    background: rgba(255, 45, 85, 0.05);
}

.track-item img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.track-item-info {
    flex-grow: 1;
    min-width: 0;
}

.track-item-info h4 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-item-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-play-list {
    background: rgba(255, 45, 85, 0.1);
    color: var(--music-primary);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.track-item:hover .btn-play-list,
.track-item.playing-active .btn-play-list {
    background: var(--music-primary);
    color: white;
}

/* =======================================================
   4. REPRODUCTOR INMERSIVO Y PANTALLA COMPLETA
   ======================================================= */
.player-column {
    position: sticky;
    top: 20px;
    width: 100%;
}

.modern-player {
    position: relative;
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    background: #000;
    color: #fff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    aspect-ratio: 9/12;
    max-height: 600px;
    transition: all 0.3s ease;
}

.player-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(25px) brightness(0.4);
    z-index: 1;
    transform: scale(1.15);
    transition: background-image 0.5s ease;
}

.player-content {
    position: relative;
    z-index: 2;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: center;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 50%, rgba(0, 0, 0, 0.2) 100%);
    width: 100%;
}

@keyframes spinRecord {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.player-art-large {
    width: 80%;
    max-width: 300px;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    animation: spinRecord 10s linear infinite;
    animation-play-state: paused;
}

.modern-player.is-playing .player-art-large {
    animation-play-state: running;
}

.player-art-large:hover {
    animation-play-state: running !important;
}

.player-info-large {
    width: 100%;
    text-align: left;
    margin-bottom: 20px;
    padding: 0 10px;
    min-width: 0;
}

.player-info-large h3 {
    margin: 0 0 5px;
    font-size: 1.6rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.player-info-large p {
    margin: 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.player-progress-large {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 25px;
    padding: 0 10px;
}

.progress-bar-large {
    flex-grow: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
}

.progress-large {
    height: 100%;
    background: #fff;
    border-radius: 10px;
    width: 0%;
    position: relative;
}

.progress-large::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -5px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.player-controls-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    flex-wrap: nowrap;
}

.player-controls-large button {
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    transition: 0.2s;
    padding: 5px;
}

.player-controls-large button:hover {
    color: var(--music-primary);
    transform: scale(1.1);
}

.player-controls-large .btn-play-huge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    color: black;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.player-controls-large .btn-play-huge:hover {
    transform: scale(1.05);
    background: var(--music-primary);
    color: white;
}

/* CLASES PARA PANTALLA COMPLETA ESTILO "COVER FONDO" RESPONSIVAS */
.modern-player.fullscreen-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-height: none !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
    background: rgba(0, 0, 0, 0.95) !important;
    padding: 0 !important;
}

.modern-player.fullscreen-active .player-bg {
    display: none !important;
}

.modern-player.fullscreen-active .player-content {
    padding: 15px;
    justify-content: flex-end;
    background: transparent !important;
}

/* La imagen se vuelve el fondo completo con un borde de cristal */
.modern-player.fullscreen-active .player-art-large {
    position: absolute;
    top: 2%;
    left: 2%;
    width: 96%;
    height: 96%;
    max-width: none;
    aspect-ratio: auto;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    object-fit: cover;
    animation: none !important;
    margin: 0;
    z-index: -1;
}

.modern-player.fullscreen-active .player-art-large:hover {
    animation: none !important;
    transform: none !important;
}

/* Gradiente oscuro inferior para resaltar controles */
.modern-player.fullscreen-active .player-content::before {
    content: '';
    position: absolute;
    bottom: 2%;
    left: 2%;
    width: 96%;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.5) 50%, transparent 100%);
    border-radius: 0 0 20px 20px;
    z-index: 0;
    pointer-events: none;
}

.modern-player.fullscreen-active .player-info-large,
.modern-player.fullscreen-active .player-progress-large,
.modern-player.fullscreen-active .player-controls-large {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 15px;
}

.modern-player.fullscreen-active .player-info-large {
    margin-bottom: 25px;
}

/* Reubicación y estilo del botón fullscreen para que resalte */
.modern-player.fullscreen-active #btn-fullscreen {
    top: 4% !important;
    right: 4% !important;
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(10px);
    z-index: 100;
}

/* =======================================================
   5. MEDIA QUERIES (OPTIMIZACIÓN MÓVIL)
   ======================================================= */
@media (max-width: 900px) {
    .player-column {
        position: static;
    }
}

@media (max-width: 768px) {
    .music-header {
        padding-top: 30px !important;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .btn-back {
        position: relative;
        top: 0;
        left: 0;
        margin: 0 auto 20px auto;
        width: max-content;
    }

    .music-header h1 {
        font-size: 2.2rem;
    }

    .music-header p {
        font-size: 1rem;
        padding: 0 10px;
    }

    .section-title {
        display: block;
        text-align: center;
        border-bottom: none;
        margin-bottom: 25px;
        font-size: 1.5rem;
    }

    .section-title::after {
        content: '';
        display: block;
        width: 60px;
        height: 3px;
        background: var(--music-primary);
        margin: 10px auto 0;
        border-radius: 3px;
    }

    .content-section {
        padding: 0 15px;
        margin-bottom: 20px;
    }

    .music-split-layout {
        margin-bottom: 10px;
    }

    .artist-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 20px;
    }

    .playlist-column {
        max-height: 350px;
        padding-right: 5px;
    }

    .track-item {
        padding: 10px;
        gap: 10px;
    }

    .track-item img {
        width: 45px;
        height: 45px;
    }

    .track-item-info h4 {
        font-size: 0.95rem;
    }

    .track-item-info p {
        font-size: 0.8rem;
    }

    .btn-play-list {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .modern-player {
        aspect-ratio: auto;
        min-height: 380px;
        border-radius: 20px;
        margin: 0;
    }

    .player-art-large {
        width: 60%;
        max-width: 200px;
        margin-bottom: 20px;
    }

    .player-info-large h3 {
        font-size: 1.3rem;
    }

    .player-controls-large {
        gap: 12px;
    }

    .player-controls-large .btn-play-huge {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
    }

    .player-controls-large button {
        font-size: 1.2rem;
        padding: 5px;
    }
}

@media (max-width: 480px) {
    .content-section {
        padding: 0 10px;
    }

    .artist-grid {
        grid-template-columns: 1fr;
    }

    .modern-player {
        border-radius: 16px;
        min-height: 360px;
    }

    .player-controls-large {
        gap: 8px;
    }

    .player-art-large {
        max-width: 180px;
        margin-bottom: 15px;
    }

    .player-info-large h3 {
        font-size: 1.1rem;
    }

    .player-info-large p {
        font-size: 0.9rem;
    }
}