/* ============================================
   BARRAYARA - REPRODUCTOR COMPLETO
   ============================================ */

/* Asegurar que el reproductor sea visible cuando esté activo */
#barrayara-player {
    position: fixed;
    bottom: -200px; /* Oculto por defecto */
    left: 0;
    width: 100%;
    height: var(--barrayara-height, 80px);
    background-color: var(--barrayara-bg, #282828);
    color: var(--barrayara-text, #FFFFFF);
    display: flex !important; /* Forzar display flex */
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 9999;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.3);
    justify-content: space-between;
    transition: bottom 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    font-family: 'Montserrat', sans-serif;
    overflow: hidden;
    border-top: 3px solid var(--barrayara-primary, #FF6B6B);
}

/* Cuando está visible */
#barrayara-player.player-visible {
    bottom: 0 !important;
}

/* Modos header, shortcode e iframe */
body.barrayara-embed-page { margin: 0; overflow: hidden; background: transparent; }
body.barrayara-embed-page #barrayara-player,
#barrayara-player.barrayara-inline-player { position: relative; inset: auto; width: 100%; height: 100px; min-height: 80px; transform: none; bottom: auto !important; box-shadow: 0 2px 8px rgba(0,0,0,.25); transition: none; }
body.barrayara-embed-page #barrayara-player { display: flex !important; }
#barrayara-player.barrayara-header-player { top: -200px; bottom: auto; box-shadow: 0 2px 5px rgba(0,0,0,.3); border-top: 0; border-bottom: 3px solid var(--barrayara-primary, #FF6B6B); transition: top .5s cubic-bezier(.22,1,.36,1); }
#barrayara-player.barrayara-header-player.player-visible { top: 0 !important; bottom: auto !important; }


/* ========== IMPORTAR FUENTES ========== */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.cdnfonts.com/css/akira-expanded');

/* ========== VARIABLES ========== */
:root {
    --barrayara-primary: #FF6B6B;
    --barrayara-secondary: #282828;
    --barrayara-text: #FFFFFF;
    --barrayara-bg: #282828;
    --barrayara-height: 3cm;
}

/* ========== REPRODUCTOR PRINCIPAL ========== */
#barrayara-player {
    position: fixed;
    bottom: -200px;
    left: 0;
    width: 100%;
    height: var(--barrayara-height);
    background-color: var(--barrayara-bg);
    color: var(--barrayara-text);
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 9999;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.3);
    justify-content: space-between;
    transition: bottom 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    font-family: 'Montserrat', sans-serif;
    overflow: visible;
}

#barrayara-player.player-visible {
    bottom: 0 !important;
}

/* ========== ELEMENTOS INTERNOS ========== */
#barrayara-player .radio-info,
#barrayara-player .social-buttons,
#barrayara-player .metadata,
#barrayara-player .controls,
#barrayara-player .player-controller {
    position: relative;
    z-index: 10;
}

/* ========== RADIO INFO ========== */
#barrayara-player .radio-info {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

#barrayara-player .radio-logo {
    height: 3cm;
    margin-right: 10px;
    border-radius: 5px;
    object-fit: contain;
}

#barrayara-player .radio-name {
    font-size: 0.9em; /* Reducido ligeramente para dar paso a las canciones */
    margin: 0;
    font-weight: 800;
    font-family: 'Akira Expanded', 'Montserrat', sans-serif;
    white-space: nowrap;
}

/* ========== SOCIAL BUTTONS ========== */
#barrayara-player .social-buttons {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

#barrayara-player .social-buttons a {
    color: #bbb;
    font-size: 1.6em;
    text-decoration: none;
    transition: color 0.2s ease-in-out, transform 0.2s ease;
}

#barrayara-player .social-buttons a:hover {
    color: var(--barrayara-primary);
    transform: scale(1.1);
}

/* ========== METADATOS (TITULO Y ARTISTA) ========== */
#barrayara-player .metadata {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 650px; /* Ampliado significativamente para permitir lectura de canciones largas */
    margin: 0 15px;
    overflow: hidden;
}

#barrayara-player .player-cover {
    width: 3cm;
    height: 3cm;
    overflow: hidden;
    border-radius: 3px;
    margin-right: 12px;
    background-color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

#barrayara-player .player-cover.loading::before {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #eee;
    border-top-color: transparent;
    animation: barrayara-spin 1s linear infinite;
}

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

#barrayara-player .cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#barrayara-player .song-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

#barrayara-player .song-title {
    font-size: 1em; /* Aumentado el tamaño del título */
    margin-bottom: 4px;
    margin-top: 0;
    font-weight: 700;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--barrayara-text);
    width: 100%;
}

#barrayara-player .song-artist {
    font-size: 0.7em; /* Aumentado el tamaño del artista */
    margin: 0;
    color: #ccc;
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 100%;
}

/* ========== CONTROLES ========== */
#barrayara-player .controls {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 0;
}

#barrayara-player .controls.player-controller {
    gap: 10px;
    position: relative;
}

#barrayara-player .volume-control {
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible;
}

#barrayara-player .player-button {
    background-color: #ffffff;
    color: #888;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    cursor: pointer;
    border: none;
    outline: none;
    transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
    position: relative;
    overflow: visible;
    margin-left: 5px;
}

#barrayara-player .player-button:first-child {
    margin-left: 0;
}

#barrayara-player .player-button:hover {
    background-color: #f0f0f0;
    transform: scale(1.05);
}

/* Botón Play/Pause con efecto de onda */
#barrayara-player .player-button-play::after {
    content: '';
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(255, 107, 107, 0.4);
    opacity: 0;
    top: 0;
    left: 0;
    transform: scale(0);
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
    z-index: -1;
}

#barrayara-player .player-button-play.playing::after {
    transform: scale(1.5);
    opacity: 1;
}

@keyframes barrayara-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    80% { transform: scale(1.4); opacity: 0; }
    100% { transform: scale(1.4); opacity: 0; }
}

#barrayara-player .player-button-play::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(255, 107, 107, 0.3);
    z-index: -2;
    animation: barrayara-pulse 2s infinite;
}

/* ============================================
   VOLUMEN - VERSIÓN REDUCIDA Y ADAPTATIVA
   ============================================ */

#barrayara-player .volume-button {
    font-size: 1.4em;
    z-index: 15;
    position: relative;
}

#barrayara-player .volume-slider {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    z-index: 20;
    background: #2a2a2a;
    border-radius: 8px;
    height: 10px;
    width: 140px !important;
    max-width: 60vw;
    cursor: pointer;
    bottom: calc(100% + 12px);
    right: 0;
    left: auto;
    transform: none;
    padding: 0 8px;
    display: none;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 6px 20px rgba(0,0,0,0.6);
    box-sizing: border-box;
}

#barrayara-player .volume-slider[aria-hidden="true"] {
    pointer-events: none;
}

#barrayara-player .volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--barrayara-primary, #FF6B6B);
    cursor: pointer;
    margin-top: -5px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

#barrayara-player .volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--barrayara-primary, #FF6B6B);
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

#barrayara-player .volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
}

#barrayara-player .volume-slider::-moz-range-track {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
    border: none;
}

#barrayara-player .volume-slider.slide-down {
    display: block;
    animation: volumeSlideDown 0.2s ease;
}

#barrayara-player .volume-slider.slide-up {
    animation: volumeSlideUp 0.2s ease;
}

@keyframes volumeSlideDown {
    0% { opacity: 0; transform: translateY(10px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes volumeSlideUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(10px) scale(0.95); }
}

/* ========== VISUALIZADOR ========== */
#barrayara-player .visualizer-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    filter: blur(2px);
}

#barrayara-player .visualizer-container.visualizer-hidden {
    opacity: 0;
}

#barrayara-player #barrayara-audio-visualizer {
    display: block;
    width: 100%;
    height: 100%;
}

/* ========== FONDO DINÁMICO ========== */
#barrayara-player .dynamic-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.25;
    z-index: -1;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
    #barrayara-player .metadata {
        max-width: 320px;
        margin: 0 10px;
    }
}

@media (max-width: 768px) {
    #barrayara-player {
        height: auto;
        flex-direction: row;
        padding: 10px 15px;
        align-items: center;
        justify-content: space-between;
    }

    #barrayara-player .radio-info {
        display: none;
    }

    #barrayara-player .social-buttons {
        display: none;
    }

    #barrayara-player .metadata {
        display: flex;
        flex-direction: row;
        align-items: center;
        margin: 0 10px 0 0;
        flex: 1 1 auto;
        max-width: calc(100% - 100px);
    }

    #barrayara-player .player-cover {
        width: 60px;
        height: 60px;
        margin-right: 8px;
    }

    #barrayara-player .song-details {
        text-align: left;
    }

    #barrayara-player .song-title {
        font-size: 0.7em;
    }

    #barrayara-player .song-artist {
        font-size: 0.7em;
    }

    #barrayara-player .controls {
        margin-left: auto;
        flex-shrink: 0;
    }

    #barrayara-player .controls.player-controller {
        gap: 5px;
    }

    #barrayara-player .player-button {
        width: 35px;
        height: 35px;
        font-size: 1em;
        margin: 0 3px;
    }

    #barrayara-player .volume-slider {
        width: 120px !important;
        max-width: 50vw;
        right: 0;
        bottom: calc(100% + 10px);
    }

    #barrayara-player .visualizer-container {
        height: 40px;
    }
}

@media (max-width: 480px) {
    #barrayara-player .metadata {
        max-width: calc(100% - 90px);
        margin-right: 5px;
    }
    
    #barrayara-player .player-cover {
        width: 50px;
        height: 50px;
        margin-right: 6px;
    }

    #barrayara-player .volume-slider {
        width: 110px !important;
        max-width: 50vw;
        right: -5px;
        bottom: calc(100% + 10px);
    }
}

@media (min-width: 769px) {
    #barrayara-player .social-buttons {
        display: flex;
    }

    #barrayara-player .radio-info {
        display: flex;
    }

    #barrayara-player .controls {
        margin-left: 0;
        margin-right: 0;
    }
}

/* ========== ANIMACIÓN DE APARICIÓN ========== */
@keyframes barrayara-slide-up {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

#barrayara-player.player-visible {
    animation: barrayara-slide-up 0.5s ease forwards;
}