/* ==========================================================================
   1. GERAL & CONFIGURAÇÕES BASE
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #121212;
    color: #FFFFFF;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    /* Adiciona padding no fundo para não ser coberto pela navegação flutuante */
    padding-bottom: 120px; 
}

.profile-picture {
    width: 32px; height: 32px; border-radius: 50%;
    object-fit: cover; border: 2px solid #282828;
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
a { color: #1DB954; text-decoration: none; transition: color 0.2s ease-in-out; }
a:hover { color: #1ED760; }

/* ==========================================================================
   2. COMPONENTES REUTILIZÁVEIS
   ========================================================================== */
.button {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px; border-radius: 500px; border: none;
    cursor: pointer; font-weight: bold; text-transform: uppercase;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    font-size: 14px; gap: 8px;
}
.button.primary { background-color: #1DB954; color: #FFFFFF; }
.button.primary:hover { background-color: #1ED760; transform: translateY(-1px); }
.button.secondary { background-color: #535353; color: #FFFFFF; border: 1px solid #727272; }
.button.secondary:hover { background-color: #6a6a6a; transform: translateY(-1px); }
.button.danger { background-color: #dc3545; color: #FFFFFF; }
.button.danger:hover { background-color: #c82333; transform: translateY(-1px); }
.button.big-button { padding: 15px 30px; font-size: 14px; margin-top: 20px; }
.button.small-button { padding: 8px 15px; font-size: 12px; }

/* Corrige o tamanho dos ícones dentro dos botões */
.button-icon {
    width: 20px;
    height: 20px;
}

.flash-messages { margin-top: 20px; }
.alert { padding: 15px; margin-bottom: 15px; border-radius: 8px; font-weight: bold; }
.alert-success { background-color: #28a745; }
.alert-error { background-color: #dc3545; }

.form-section { background-color: #1a1a1a; padding: 30px; border-radius: 8px; margin-bottom: 30px; }
.form-section label { display: block; margin-bottom: 8px; font-weight: bold; color: #b3b3b3; }
.form-section input[type="text"],
.form-section input[type="file"],
.form-section textarea {
    width: 100%; padding: 12px 10px; margin-bottom: 20px;
    border: 1px solid #535353; border-radius: 4px; background-color: #282828;
    color: #FFFFFF; font-size: 16px; box-sizing: border-box; font-family: 'Montserrat', sans-serif;
}
.form-section textarea { resize: vertical; min-height: 100px; }
.ia-section textarea#prompt { resize: none; min-height: 87px; }

.checkbox-group { display: flex; align-items: center; margin-top: 15px; margin-bottom: 20px; }
.checkbox-group input[type="checkbox"] { width: auto; margin-right: 10px; accent-color: #1DB954; }

.profile-link { color: #1DB954; font-weight: 600; }
.profile-link:hover { text-decoration: underline; }

/* ==========================================================================
   3. LAYOUT E CABEÇALHO
   ========================================================================== */
header { background-color: #000000; padding: 10px 0; border-bottom: 1px solid #282828; }
header .container { display: flex; justify-content: space-between; align-items: center; }
header h1 { margin: 0; font-size: 28px; }

/* O menu lateral mobile permanece o mesmo */
.mobile-nav-toggle { display: none; }
.mobile-nav { display: none; }
.nav-overlay { display: none; }

footer { display: block; background-color: #000000; color: #b3b3b3; text-align: center; padding: 20px 0; margin-top: 50px; border-top: 1px solid #282828; }

/* ==========================================================================
   4. PÁGINAS ESPECÍFICAS
   ========================================================================== */
.section-title { text-align: center; font-size: 1.8em; color: #1DB954; margin-top: 50px; margin-bottom: 30px; }
.playlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 30px; }
.playlist-card { background-color: #1a1a1a; border-radius: 8px; padding: 20px; text-align: center; display: flex; flex-direction: column; justify-content: space-between; }
.playlist-card a:first-of-type { flex-grow: 1; }
.playlist-image-container { width: 100%; padding-top: 100%; position: relative; margin: 0 auto 15px auto; border-radius: 4px; overflow: hidden; }
.playlist-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.playlist-name { font-size: 18px; font-weight: 700; margin: 10px 0 5px; color: #FFFFFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playlist-owner, .playlist-tracks { font-size: 14px; color: #b3b3b3; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.management-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; margin-bottom: 50px; }
.management-card { background-color: #1a1a1a; padding: 25px; border-radius: 8px; }
.track-list-section { background-color: #1a1a1a; padding: 30px; border-radius: 8px; margin-bottom: 50px; }
.category-header { display: flex; justify-content: space-between; align-items: baseline; padding: 0 10px; }
.category-header .section-title { text-align: left; margin-bottom: 20px; }
.details-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; align-items: flex-start; }
.playlist-header { display: flex; align-items: flex-end; gap: 30px; margin-bottom: 40px; padding: 30px; background: linear-gradient(to bottom, #303030, #121212); border-radius: 8px; }
.playlist-cover-large { width: 250px; height: 250px; object-fit: cover; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.playlist-info h1 { font-size: 48px; margin: 0 0 10px 0; word-break: break-word; }
.assistant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 30px; }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.checkbox-item { display: flex; align-items: center; background-color: #282828; padding: 8px; border-radius: 4px; cursor: pointer; }
.checkbox-item input[type="checkbox"] { width: 18px; height: 18px; margin-right: 10px; accent-color: #1DB954; }
.checkbox-item label { margin-bottom: 0; font-size: 0.9em; color: #FFFFFF; cursor: pointer; }
.ia-select {
    width: 100%; padding: 12px 10px; margin-bottom: 20px;
    border: 1px solid #535353; border-radius: 4px; background-color: #282828;
    color: #FFFFFF; font-size: 16px; font-family: 'Montserrat', sans-serif;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 1rem center; background-size: 1em;
}
.profile-header { position: relative; padding: 30px; border-radius: 8px; overflow: hidden; background: linear-gradient(to bottom, rgba(0, 255, 200, 0.267), var(--dominant-color, #303030)); }
.profile-header::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: url('https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExem4xc240a2EwajZkdHJuYTR2MHB2OWl3MjIyczg4OHRnY2RqaTNtayZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xT9IgHnYXzoiMvOnAc/giphy.gif');
    background-size: cover; background-position: center;
    opacity: 0.3; z-index: 1;
}
.profile-header-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 20px; }
.profile-header-picture { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.profile-header .profile-info h1 { font-size: 28px; margin: 0; text-shadow: 1px 1px 5px rgba(0,0,0,0.5); }
.profile-header .profile-info .description { font-size: 1em; color: #f0f0f0; text-shadow: 1px 1px 5px rgba(0,0,0,0.5); }

/* --- ABAS DA PÁGINA DE IA --- */
.ia-method-tabs {
    position: relative;
    display: flex;
    margin-bottom: 30px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}
.tab-button {
    padding: 15px 38px;
    cursor: pointer;
    background-color: transparent;
    border: none;
    color: #00ffcb;
    font-weight: bold;
    font-size: 14px;
    border-radius: 500px;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
.tab-button:hover {
    color: #FFFFFF;
}
.tab-button.active {
    background-color: #ff6c00;
    color: #FFFFFF;
}
.ia-method-container { overflow: hidden; }
.tab-content { display: none; animation: fadeIn 0.5s; }
.tab-content.active { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   5. NAVEGAÇÃO FLUTUANTE (DOCK & BARRA INFERIOR)
   ========================================================================== */

/* ESTILO PADRÃO (DESKTOP FIRST) - O "DOCK" CENTRALIZADO */
.sticky-action-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 998;
    
    display: flex;
    align-items: center;
    gap: 10px;

    background: rgba(18, 18, 18, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    padding: 10px 15px;
    border-radius: 50px;
    border: 1px solid #333;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease-in-out;
}

.sticky-action-nav .nav-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    
    color: #b3b3b3;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 30px;
    transition: background-color 0.2s, color 0.2s;
}

.sticky-action-nav .nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.sticky-action-nav .nav-item i {
    font-size: 18px;
}

.sticky-action-nav .nav-item .profile-picture-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.sticky-action-nav .mobile-actions-center {
    display: flex;
    gap: 10px;
    padding: 0 10px;
}

.sticky-action-nav .nav-item-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #1DB954;
    color: #FFFFFF;
    border-radius: 50%;
    font-size: 22px;
    border: none;
    transition: background-color 0.2s;
}

.sticky-action-nav .nav-item-primary:hover {
    background-color: #1ED760;
}

/* --- Seção de Estatísticas do Usuário na Barra de Navegação --- */

/* Por padrão, as estatísticas estão escondidas (mobile-first) */
.nav-user-stats {
    display: none;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #b3b3b3;
    font-size: 8px;
    font-weight: 600;
}

.stat-item i {
    font-size: 9px;
    color: #ffc107;
}

.nav-separator-vertical {
    width: 1px;
    height: 25px;
    background-color: #444;
}

/* ==========================================================================
   6. RESPONSIVIDADE (Layout Mobile)
   ========================================================================== */

@media (max-width: 992px) {
    /* Ativa o menu de hambúrguer */
    .mobile-nav-toggle { display: block; }

    /* Estilos do menu lateral */
    .mobile-nav { display: block; position: fixed; top: 0; right: -100%; width: 70%; max-width: 300px; height: 100vh; background-color: #000; padding-top: 80px; transition: right 0.3s ease-in-out; z-index: 1000; border-left: 1px solid #282828; }
    .mobile-nav.is-active { right: 0; }
    .mobile-nav ul { list-style: none; padding: 0 20px; margin: 0; }
    .mobile-nav ul li { margin-bottom: 20px; }
    .mobile-nav ul li a { color: #FFFFFF; font-size: 18px; font-weight: 600; }
    .mobile-nav .nav-credits-mobile { color: #b3b3b3; line-height: 1.4; }
    
    .nav-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; }
    .nav-overlay.is-active { display: block; }
    
    /* Converte o "dock" na barra de rodapé */
    .sticky-action-nav {
        width: 100%;
        left: 0;
        bottom: 0;
        transform: none;
        border-radius: 0;
        border: none;
        border-top: 1px solid #282828;
        box-shadow: none;
        background: #000;
        backdrop-filter: none;
        justify-content: space-around;
        padding: 0;
        height: 60px;
    }
    .sticky-action-nav .nav-item {
        flex-direction: column;
        font-size: 10px;
        font-weight: 400;
        gap: 4px;
        padding: 5px 0;
        flex-grow: 1;
    }
    .sticky-action-nav .nav-item:hover {
        background-color: transparent;
    }
    .sticky-action-nav .mobile-actions-center {
        transform: translateY(-15px);
        border: none;
        padding: 0;
        gap: 5px;
    }
    .sticky-action-nav .nav-item-primary {
        border: 4px solid #121212;
    }

    .container { padding: 15px; }
    
    .playlist-header, .profile-header-content { flex-direction: column; align-items: center; text-align: center; }
    .playlist-cover-large, .profile-header-picture { width: 180px; height: 180px; }
    .playlist-info h1, .profile-header .profile-info h1 { font-size: 28px; }
    .playlist-actions { flex-direction: column; width: 100%; }
    
    .details-grid, .assistant-grid, .management-grid { grid-template-columns: 1fr; }
    .checkbox-grid { grid-template-columns: 1fr 1fr; }
    
    .playlist-grid { 
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
        gap: 15px; 
    }
    .playlist-card { padding: 15px; }
    .playlist-name { font-size: 14px; }
    .playlist-owner, .playlist-tracks { font-size: 12px; }

    .action-buttons { display: flex; flex-direction: column; gap: 15px; }
    .action-buttons .button { width: 100%; box-sizing: border-box; margin-top: 0; }
    .category-header { flex-direction: column; align-items: flex-start; gap: 5px; }
    .category-header .section-title { margin-bottom: 5px; }

    .ia-method-tabs { flex-direction: column; width: 100%; background-color: transparent; }
    .tab-button { background-color: #282828; justify-content: center; }
    .tab-button.active { background-color: #ff6c00; }
    
    /* Esconde o footer tradicional no mobile */
    footer { display: none; }
}

@media (max-width: 480px) {
    .checkbox-grid { grid-template-columns: 1fr; }
}

/* --- Media Query para Telas Maiores (Desktop) --- */
@media (min-width: 768px) {
    .profile-header-content { flex-direction: row; text-align: left; }
    .profile-header-picture { width: 200px; height: 200px; }
    .profile-header .profile-info h1 { font-size: 48px; }
}

/* Mostra as estatísticas no dock apenas no desktop */


.nav-user-stats {
    display: flex;
    flex-direction: column;
    align-items: center;

}

/* ==========================================================================
   7. ESTILOS DE TABELA, UTILITÁRIOS E COMPONENTES FINAIS
   ========================================================================== */

.goog-te-gadget-simple {
    background-color: #292929;
    border: 1px solid #292929;
    font-size: 10pt;
    display: inline-block;
    padding-top: 1px;
    padding-bottom: 2px;
    cursor: pointer;
}

.music-list-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.music-list-table th, .music-list-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #282828;
    text-align: left;
    vertical-align: middle;
}

.music-list-table th {
    color: #b3b3b3;
    font-size: 12px;
    text-transform: uppercase;
}

.user-info-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.album-cover-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.profile-picture-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.table-cell-content-limiter {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scroll-buttons {
    position: fixed;
    bottom: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.scroll-button {
    width: 45px;
    height: 45px;
    background-color: #282828;
    color: #FFFFFF;
    border: 1px solid #535353;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.scroll-button:hover {
    background-color: #3e3e3e;
}

/* Ajuste final para botões de rolagem no mobile */
@media (max-width: 992px) {
    .scroll-buttons {
        bottom: 85px; 
    }
}

/* ==========================================================================
   8. COMPONENTES DE UI (Indicador de Progresso)
   ========================================================================== */

.progress-circle-container {
    position: relative;
    width: 120px;
    margin: 0 auto;
}

.progress-circle {
    position: relative;
    width: 120px;
    height: 120px;
}

.progress-ring {
    transform: rotate(-90deg); /* Começa o círculo do topo */
}

.progress-ring__bg {
    stroke: #282828; /* Fundo cinza escuro do anel */
}

.progress-ring__circle {
    stroke: #1DB954; /* Cor verde do preenchimento */
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease-out; /* Animação suave do preenchimento */
}

.progress-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #FFFFFF;
    transition: opacity 0.3s;
}

/* --- ESTILOS PARA O CARREGAMENTO INICIAL (ANIMAÇÃO DE ROTAÇÃO) --- */

/* Keyframe para a rotação contínua */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Quando a classe 'is-loading' está presente... */
#loading-indicator.is-loading .progress-circle {
    animation: spin 1.5s linear infinite; /* Aplica a animação de rotação */
}

#loading-indicator.is-loading .progress-ring__circle {
    stroke-dasharray: 164 326; /* Deixa apenas metade do círculo visível, para o efeito "pac-man" */
    stroke-dashoffset: 0 !important; /* Reseta o dashoffset para a animação de rotação funcionar */
}

#loading-indicator.is-loading .progress-percent {
    opacity: 0; /* Esconde a porcentagem durante a rotação inicial */
}

/* ==========================================================================
   9. COMPONENTES DE UI (Barra de Ação Flutuante)
   ========================================================================== */

.floating-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    
    
    padding: 15px;
    
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    
    /* Z-index abaixo do menu principal flutuante, mas acima do conteúdo */
    z-index: 990; 
}

/* No desktop, a barra flutuante precisa de espaço para não cobrir o "dock" de navegação */
@media (min-width: 993px) {
    .floating-action-bar {
        /* Distância do fundo igual à altura do dock (aprox 70px) + espaçamento (25px) */
        bottom: 95px; 
    }
}

.ia-sub-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    background-color: #282828;
    border-radius: 50px;
    padding: 5px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.sub-tab-button {
    background: transparent;
    border: none;
    color: #b3b3b3;
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.sub-tab-button.active {
    background-color: #535353;
    color: #FFFFFF;
}


.sub-tab-content {
    display: none;
}
.sub-tab-content.active {
    display: block;
}

.sub-tab-button {
    background: #222;
    color: #fff;
    padding: 6px 12px;
    border: none;
    cursor: pointer;
}
.sub-tab-button.active {
    background: #1db954; /* verde Spotify */
    color: white;
}