/* ============================================================
   Bolinha de trilha sonora — canto inferior direito
   ------------------------------------------------------------
   Espelha a linguagem visual do logo das folhas: halo azul,
   glow suave, constelação sutil ao redor quando tocando.
   Visível em login, welcome e todas as páginas internas.
   ============================================================ */

.music-bubble {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 8500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    pointer-events: none;
    /* `pointer-events: none` no wrapper pra o halo não bloquear clique fora.
       Os filhos reativam com `pointer-events: auto`. */
}

.music-bubble * {
    box-sizing: border-box;
}

/* ------------------------------------------------------------
   A bolinha em si — círculo com logo folha dentro
   ------------------------------------------------------------ */

.music-bubble__orb {
    pointer-events: auto;
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%,
        rgba(56, 189, 248, 0.85) 0%,
        rgba(14, 116, 166, 0.9) 55%,
        rgba(8, 47, 73, 0.95) 100%);
    border: 1px solid rgba(56, 189, 248, 0.4);
    box-shadow:
        0 0 18px rgba(56, 189, 248, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 6px 18px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e0f2fe;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    user-select: none;
}

.music-bubble__orb:hover {
    transform: scale(1.06);
    box-shadow:
        0 0 26px rgba(56, 189, 248, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset,
        0 8px 22px rgba(0, 0, 0, 0.5);
}

.music-bubble__orb:active {
    transform: scale(0.97);
}

.music-bubble__orb svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.6));
    transition: opacity 0.2s;
}

/* Estado tocando: halo pulsante + constelação girando */
.music-bubble.is-playing .music-bubble__orb {
    animation: music-bubble-pulse 2.6s ease-in-out infinite;
}

@keyframes music-bubble-pulse {
    0%, 100% {
        box-shadow:
            0 0 18px rgba(56, 189, 248, 0.35),
            0 0 0 1px rgba(255, 255, 255, 0.04) inset,
            0 6px 18px rgba(0, 0, 0, 0.45);
    }
    50% {
        box-shadow:
            0 0 30px rgba(56, 189, 248, 0.7),
            0 0 0 1px rgba(255, 255, 255, 0.08) inset,
            0 6px 22px rgba(0, 0, 0, 0.5);
    }
}

/* Estado "primeiro login" (chamativo): pulsa mais forte + balãozinho */
.music-bubble.is-inviting .music-bubble__orb {
    animation: music-bubble-invite 1.6s ease-in-out infinite;
}

@keyframes music-bubble-invite {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 18px rgba(56,189,248,0.45), 0 6px 18px rgba(0,0,0,0.45); }
    50%      { transform: scale(1.08); box-shadow: 0 0 32px rgba(56,189,248,0.9),  0 6px 22px rgba(0,0,0,0.5);  }
}

/* Constelação sutil de pontos ao redor (decorativa, só quando tocando) */
.music-bubble__stars {
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}

.music-bubble.is-playing .music-bubble__stars {
    opacity: 0.6;
    animation: music-bubble-rotate 18s linear infinite;
}

.music-bubble__stars::before,
.music-bubble__stars::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.85);
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
}

.music-bubble__stars::before {
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
}

.music-bubble__stars::after {
    bottom: 6px;
    right: 10px;
}

@keyframes music-bubble-rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ------------------------------------------------------------
   Tooltip do primeiro login
   ------------------------------------------------------------ */

.music-bubble__tooltip {
    pointer-events: none;
    position: absolute;
    right: 70px;
    bottom: 6px;
    background: rgba(8, 47, 73, 0.95);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #e0f2fe;
    font-size: 0.82rem;
    padding: 8px 12px;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateX(6px);
    transition: opacity 0.3s, transform 0.3s;
}

.music-bubble.is-inviting .music-bubble__tooltip {
    opacity: 1;
    transform: translateX(0);
}

.music-bubble__tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(56, 189, 248, 0.35);
}

/* ------------------------------------------------------------
   Painel expandido (abre ao clicar na bolinha)
   ------------------------------------------------------------ */

.music-bubble__panel {
    pointer-events: auto;
    position: absolute;
    right: 0;
    bottom: 70px;
    width: 260px;
    background: rgba(10, 15, 26, 0.97);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 14px;
    padding: 16px 16px 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    color: #e0e6ef;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.2s, transform 0.2s;
    visibility: hidden;
    backdrop-filter: blur(8px);
}

.music-bubble.is-open .music-bubble__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.music-bubble__title {
    font-size: 0.78rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(224, 242, 254, 0.6);
    margin-bottom: 10px;
}

.music-bubble__track {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 2px;
    color: #e0f2fe;
    line-height: 1.3;
}

/* Crédito do canal — discreto, não compete com os controles */
.music-bubble__credit {
    display: inline-block;
    font-size: 0.72rem;
    color: rgba(224, 242, 254, 0.38);
    text-decoration: none;
    margin-bottom: 14px;
    letter-spacing: 0.2px;
    transition: color 0.15s;
    font-weight: 400;
}

.music-bubble__credit:hover,
.music-bubble__credit:focus-visible {
    color: rgba(56, 189, 248, 0.85);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.music-bubble__credit span {
    display: inline-block;
    margin-left: 2px;
    opacity: 0.7;
}

.music-bubble__controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.music-bubble__btn {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(56, 189, 248, 0.3);
    background: rgba(56, 189, 248, 0.08);
    color: #e0f2fe;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    font-family: inherit;
    padding: 0;
}

.music-bubble__btn:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.5);
}

.music-bubble__btn:active {
    transform: scale(0.94);
}

.music-bubble__btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.music-bubble__btn--play {
    background: rgba(56, 189, 248, 0.22);
    border-color: rgba(56, 189, 248, 0.5);
}

.music-bubble__btn--play:hover {
    background: rgba(56, 189, 248, 0.35);
}

.music-bubble__volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.music-bubble__volume-icon {
    opacity: 0.7;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.music-bubble__volume-icon svg {
    width: 16px;
    height: 16px;
    fill: #e0f2fe;
}

.music-bubble__slider {
    flex: 1 1 auto;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 3px;
    background: linear-gradient(
        to right,
        #38bdf8 0%,
        #38bdf8 var(--vol, 50%),
        rgba(255, 255, 255, 0.14) var(--vol, 50%),
        rgba(255, 255, 255, 0.14) 100%);
    outline: none;
    cursor: pointer;
}

.music-bubble__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e0f2fe;
    border: 2px solid #38bdf8;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
}

.music-bubble__slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e0f2fe;
    border: 2px solid #38bdf8;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
}

.music-bubble__volume-value {
    font-size: 0.75rem;
    color: rgba(224, 242, 254, 0.55);
    min-width: 30px;
    text-align: right;
    flex: 0 0 auto;
}

.music-bubble__hint {
    margin-top: 10px;
    font-size: 0.72rem;
    color: rgba(224, 242, 254, 0.45);
    line-height: 1.4;
    text-align: center;
}

/* Mobile: bolinha um pouco menor, painel fullwidth */
@media (max-width: 520px) {
    .music-bubble {
        right: 12px;
        bottom: 12px;
    }
    .music-bubble__orb {
        width: 48px;
        height: 48px;
    }
    .music-bubble__orb svg {
        width: 24px;
        height: 24px;
    }
    .music-bubble__panel {
        width: 240px;
    }
    .music-bubble__tooltip {
        right: 60px;
        font-size: 0.78rem;
    }
}

/* Respeita prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .music-bubble__orb,
    .music-bubble__panel,
    .music-bubble__tooltip,
    .music-bubble__stars {
        transition: none !important;
        animation: none !important;
    }
}
