/**
 * Music Player Styles
 * Player de música ambiente para páginas de posts/artigos
 */

:root {
    --verde-primario: #1a5943;
    --verde-medio: #27AE60;
    --verde-claro: #4dd4ac;
    --amarelo: #ffc107;
    --branco: #ffffff;
    --cinza-texto: #2c3e50;
}

/* ========================================
   ABINHA DE EXPANSÃO
   ======================================== */

.expand-tab {
    position: fixed;
    bottom: 90px;
    left: 30px;
    background: linear-gradient(135deg, var(--verde-primario) 0%, var(--verde-medio) 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 -2px 12px rgba(26, 89, 67, 0.3);
    z-index: 1000;
    transition: all 0.3s;
    opacity: 1;
    pointer-events: all;
}

/* Ajustar posição quando player está expandido */
.music-player.expanded ~ .expand-tab,
.expand-tab.expanded-state {
    bottom: 525px; /* 520px (altura do player) + 60px (bottom) + 18px (margem) */
}

.expand-tab:hover {
    background: linear-gradient(135deg, var(--verde-medio) 0%, var(--verde-claro) 100%);
    transform: translateY(-2px);
    box-shadow: 0 -4px 16px rgba(26, 89, 67, 0.4);
}

/* Ícones e texto - Estado padrão (collapsed) */
.expand-tab .expand-icon,
.expand-tab .expand-text {
    display: inline;
}

.expand-tab .collapse-icon,
.expand-tab .collapse-text {
    display: none;
}

/* Estado expandido */
.expand-tab.expanded-state .expand-icon,
.expand-tab.expanded-state .expand-text {
    display: none;
}

.expand-tab.expanded-state .collapse-icon,
.expand-tab.expanded-state .collapse-text {
    display: inline;
}

.expand-tab-icon {
    font-size: 1.125rem;
    animation: bounce-icon 2s ease-in-out infinite;
}

@keyframes bounce-icon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* ========================================
    PLAYER DE MÚSICA
    ======================================== */

.music-player {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(135deg, var(--verde-primario) 0%, var(--verde-medio) 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(26, 89, 67, 0.25);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Efeito pulse inicial */
@keyframes player-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 32px rgba(26, 89, 67, 0.25);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 12px 40px rgba(39, 174, 96, 0.5);
    }
}

.music-player.first-time {
    animation: player-pulse 2s ease-in-out 3;
}

/* Efeito de brilho contínuo */
.music-player::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--verde-claro) 0%, var(--verde-medio) 100%);
    border-radius: 18px;
    opacity: 0;
    z-index: -1;
    animation: player-glow 4s ease-in-out infinite;
}

@keyframes player-glow {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.4; }
}

/* Estados do player */
.music-player.compact {
    width: 440px;
    height: 80px;
}

.music-player.expanded {
    width: 700px;
    height: 520px;
    bottom: 10px;
}

/* Transição suave mantendo a âncora na base esquerda */
.music-player {
    transform-origin: bottom left;
}

/* Garantir que o conteúdo expandido seja visível */
.music-player.expanded {
    max-height: calc(100vh - 80px);
    overflow: visible;
}

/* ========================================
    MODO COMPACTO
    ======================================== */

.player-compact-view {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
    height: 80px;
    position: relative;
}

.music-player.expanded .player-compact-view {
    display: none;
}

.player-compact-view:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Ícone com badge */
.compact-icon-wrapper {
    position: relative;
    margin-right: 12px;
}

.compact-album-art {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* Badge NOVO pulsante */
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.new-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--amarelo);
    color: #000;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    animation: badge-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.5);
}

/* Efeito glow no ícone */
@keyframes icon-glow {
    0%, 100% { filter: drop-shadow(0 0 3px rgba(255, 193, 7, 0.3)); }
    50% { filter: drop-shadow(0 0 10px rgba(255, 193, 7, 0.8)); }
}

.music-player.first-time .compact-album-art {
    animation: icon-glow 2s ease-in-out infinite;
}

.compact-info {
    flex: 1;
    min-width: 0;
    margin-right: 12px;
}

.compact-title {
    color: var(--branco);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.compact-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.compact-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.compact-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.compact-btn.play-btn {
    background: var(--branco);
    color: var(--verde-primario);
    font-weight: bold;
    width: 40px;
    height: 40px;
}

.compact-btn.play-btn:hover {
    background: #ecf0f1;
}

.compact-btn.small {
    font-size: 14px;
}

/* ========================================
    MODO EXPANDIDO
    ======================================== */

.player-expanded-view {
    display: none;
    height: 100%;
    padding: 18px 20px;
}

.music-player.expanded .player-expanded-view {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 18px;
    grid-template-rows: auto 1fr;
}

/* Header */
.expanded-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 10px;
    grid-column: 1 / -1;
}

.expanded-title {
    color: var(--branco);
    font-size: 1.125rem;
    font-weight: 700;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Arte do álbum */
.album-art {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    flex-shrink: 0;
}

/* Container do álbum + info */
.album-info-container {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

/* Coluna da esquerda - Controles */
.player-controls-column {
    display: flex;
    flex-direction: column;
}

/* Coluna da direita - Playlist */
.player-playlist-column {
    display: flex;
    flex-direction: column;
    grid-row: 2;
    min-height: 0;
    overflow: hidden;
}

/* Info da música */
.track-info {
    flex: 1;
    min-width: 0;
}

.track-name {
    color: var(--branco);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-category {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Barra de progresso */
.progress-section {
    margin-bottom: 12px;
}

.progress-bar-container {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 8px;
}

.progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: white;
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.2s;
}

.progress-bar-container:hover .progress-bar::after {
    opacity: 1;
}

.progress-time {
    display: flex;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
}

/* Controles principais */
.main-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.control-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.control-btn.main-play {
    width: 52px;
    height: 52px;
    background: var(--branco);
    color: var(--verde-primario);
    font-size: 22px;
    font-weight: bold;
}

.control-btn.main-play:hover {
    background: #ecf0f1;
}

.control-btn.active {
    background: rgba(255, 255, 255, 0.3);
}

/* Controle de volume */
.volume-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 8px;
}

.volume-icon {
    color: white;
    font-size: 18px;
    cursor: pointer;
    width: 24px;
    text-align: center;
}

.volume-slider {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.volume-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: white;
    border-radius: 2px;
    width: 70%;
    transition: width 0.1s;
}

.volume-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.2s;
}

.volume-slider:hover .volume-bar::after {
    opacity: 1;
}

/* Categorias */
.categories-section {
    margin-bottom: 0;
}

.categories-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 0;
}

.category-card {
    padding: 6px 4px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.category-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.category-card.active {
    background: white;
    border-color: white;
}

.category-icon {
    font-size: 1rem;
    display: block;
    margin-bottom: 2px;
}

.category-name {
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.2;
}

.category-card.active .category-name {
    color: var(--verde-primario);
}

.category-btn {
    /* Alias for category-card to match JS selector */
}

/* Playlist */
.playlist-section {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
}

.playlist-section::-webkit-scrollbar {
    width: 6px;
}

.playlist-section::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.playlist-section::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.playlist-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.playlist-item.active {
    background: rgba(255, 255, 255, 0.25);
}

.playlist-item-number {
    width: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-weight: 600;
}

.playlist-item.active .playlist-item-number {
    color: white;
}

.playlist-item-icon {
    font-size: 0.875rem;
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
}

.playlist-item-name {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item.active .playlist-item-name {
    color: white;
    font-weight: 600;
}

.playlist-item-duration {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}

/* ========================================
    RESPONSIVIDADE
    ======================================== */

@media (max-width: 900px) {
    .music-player.compact {
        width: calc(100% - 40px);
        left: 20px;
    }

    .music-player.expanded {
        width: calc(100% - 40px);
        height: 560px;
        grid-template-columns: 1fr;
    }

    .player-expanded-view {
        grid-template-columns: 1fr !important;
    }

    .player-playlist-column {
        grid-row: auto !important;
    }

    .expand-tab {
        left: 20px;
    }
}

/* ========================================
    OVERLAY DE BOAS-VINDAS / POPUP
    ======================================== */

.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.welcome-overlay.hidden {
    display: none;
}

.welcome-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.welcome-card {
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 480px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
    animation: welcome-appear 0.5s ease-out;
    position: relative;
}

.welcome-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #6c757d;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
    line-height: 1;
}

.welcome-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #495057;
    transform: scale(1.1);
}

@keyframes welcome-appear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.welcome-icon {
    font-size: 72px;
    margin-bottom: 24px;
    animation: welcome-icon-pulse 2s ease-in-out infinite;
}

@keyframes welcome-icon-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.welcome-card h2 {
    color: var(--verde-primario);
    font-size: 2rem;
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.welcome-card p {
    color: var(--cinza-texto);
    line-height: 1.7;
    margin-bottom: 32px;
    font-size: 1.05rem;
}

.welcome-card p strong {
    color: var(--verde-primario);
    font-weight: 600;
}

.welcome-btn {
    background: linear-gradient(135deg, var(--verde-primario) 0%, var(--verde-medio) 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(26, 89, 67, 0.3);
    width: 100%;
}

.welcome-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(26, 89, 67, 0.4);
}

/* Fechar overlay clicando fora */
.welcome-overlay-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
}

/* Animação de pulso quando tocando */
@keyframes playing-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.music-player.playing .album-art,
.music-player.playing .compact-album-art {
    animation: playing-pulse 2s ease-in-out infinite;
}
