/* Estilos para o sistema de comentários */
.comments-section {
    background: rgba(30, 30, 30, 0.7);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 1px solid rgba(251, 191, 36, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.comments-section h4 {
    color: #fbbf24;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Estilos base para o botão de comentários */
.comments-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(45deg, #fbbf24, #d97706);
    color: #111827;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 2px solid #f59e0b !important;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

.comments-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
    border-color: #d97706 !important;
}

/* Estilos específicos para cada cor de extensão */
.purple-extension .comments-btn {
    background: linear-gradient(45deg, #8B5CF6, #7C3AED) !important;
    color: #ffffff !important;
    border: 2px solid #a855f7 !important;
}

.purple-extension .comments-btn:hover {
    border-color: #7c3aed !important;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.yellow-extension .comments-btn {
    background: linear-gradient(45deg, #F59E0B, #D97706) !important;
    color: #1a1a1a !important;
    border: 2px solid #f59e0b !important;
}

.yellow-extension .comments-btn:hover {
    border-color: #d97706 !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.blue-extension .comments-btn {
    background: linear-gradient(45deg, #3B82F6, #2563EB) !important;
    color: #ffffff !important;
    border: 2px solid #60a5fa !important;
}

.blue-extension .comments-btn:hover {
    border-color: #2563eb !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.gray-extension .comments-btn {
    background: linear-gradient(45deg, #6B7280, #4B5563) !important;
    color: #ffffff !important;
    border: 2px solid #9ca3af !important;
}

.gray-extension .comments-btn:hover {
    border-color: #4b5563 !important;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}

/* Modal de comentários */
.comments-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200000; /* Aumentado de 1000 para 200000 para sobrepor o slider */
    align-items: center;
    justify-content: center;
}

.comments-modal.active {
    display: flex;
}

/* Correção para o modal - remover regras duplicadas e conflitantes */
.comments-modal-content {
    background: #1f2937;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(251, 191, 36, 0.3);
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Ajustar o conteúdo das seções */
.comments-modal-section {
    padding: 1.5rem;
    overflow-y: auto; /* Permitir scroll quando necessário */
    display: flex;
    flex-direction: column;
}

/* Seção de ver comentários - com altura limitada */
#ver-comentarios-secao {
    max-height: 70vh;
    /* Garantir que use todo espaço disponível */
    flex: 1;
    /* Melhorar comportamento no mobile */
    display: flex;
    flex-direction: column;
}

#ver-comentarios-secao .comments-list {
    flex: 1;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    /* Garantir que a lista use todo espaço disponível */
    min-height: 200px;
    /* Melhorar scroll no mobile */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    box-sizing: border-box;
}

/* Seção de escrever comentário - sem limitação de altura */
#escrever-comentario-secao {
    max-height: none; /* Remover limitação de altura */
    overflow: visible; /* Permitir que o conteúdo seja visível */
    flex: none; /* Não usar flex para esta seção */
}

/* Formulário de comentários - ajustar para não ter limitações */
.comment-form {
    background: rgba(30, 30, 30, 0.7);
    border-radius: 8px;
    padding: 1.5rem;
    overflow: visible;
    min-height: auto; /* Permitir altura automática */
}

/* Garantir que os botões sejam sempre visíveis */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    flex-shrink: 0; /* Impedir que os botões sejam comprimidos */
}

/* Melhorar a aparência da barra de rolagem apenas para a lista de comentários */
.comments-list::-webkit-scrollbar {
    width: 8px;
}

.comments-list::-webkit-scrollbar-track {
    background: rgba(75, 85, 99, 0.3);
    border-radius: 4px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.6);
    border-radius: 4px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: rgba(251, 191, 36, 0.8);
}

/* Remover regras duplicadas e conflitantes */
/* REMOVER estas linhas duplicadas do CSS:

.comments-modal-section {
    padding: 1.5rem;
    max-height: 70vh;
    // Removido: overflow-y: auto;
}

.comments-list {
    max-height: 500px;
    overflow-y: auto;
    // Adicionar padding para melhor aparência
    padding-right: 10px;
}

.comment-form {
    background: rgba(30, 30, 30, 0.7);
    border-radius: 8px;
    padding: 1.5rem;
    // Garantir que não tenha overflow
    overflow: visible;
}

.comments-modal-content {
    background: #1f2937;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(251, 191, 36, 0.3);
    animation: modalSlideIn 0.3s ease;
    // Adicionar flexbox para melhor controle
    display: flex;
    flex-direction: column;
}

.comments-modal-section {
    padding: 1.5rem;
    flex: 1;
    overflow: hidden;
    // Permitir que o conteúdo se ajuste
    display: flex;
    flex-direction: column;
}

#ver-comentarios-secao .comments-list {
    flex: 1;
    overflow-y: auto;
}

#escrever-comentario-secao {
    overflow: visible;
}

.comments-list {
    max-height: 500px;
    overflow-y: auto;
}

*/
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comments-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(45deg, #fbbf24, #d97706);
    color: #111827;
}

.comments-modal-header h3 {
    font-size: 1.3rem;
    margin: 0;
    font-weight: 700;
}

.comments-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #111827;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comments-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Correção para remover barras laterais desnecessárias */
.comments-modal-section {
    padding: 1.5rem;
    max-height: 70vh;
    /* Removido: overflow-y: auto; */
}

/* Lista de comentários - manter apenas aqui */
.comments-list {
    max-height: 500px;
    overflow-y: auto;
    /* Adicionar padding para melhor aparência */
    padding-right: 10px;
}

/* Melhorar a aparência da barra de rolagem */
.comments-list::-webkit-scrollbar {
    width: 8px;
}

.comments-list::-webkit-scrollbar-track {
    background: rgba(75, 85, 99, 0.3);
    border-radius: 4px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.6);
    border-radius: 4px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: rgba(251, 191, 36, 0.8);
}

/* Remover barra de rolagem da seção de escrever comentário */
.comment-form {
    background: rgba(30, 30, 30, 0.7);
    border-radius: 8px;
    padding: 1.5rem;
    /* Garantir que não tenha overflow */
    overflow: visible;
}

/* Ajustar o modal para melhor responsividade */
.comments-modal-content {
    background: #1f2937;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(251, 191, 36, 0.3);
    animation: modalSlideIn 0.3s ease;
    /* Adicionar flexbox para melhor controle */
    display: flex;
    flex-direction: column;
}

/* Ajustar o conteúdo das seções */
.comments-modal-section {
    padding: 1.5rem;
    flex: 1;
    overflow: hidden;
    /* Permitir que o conteúdo se ajuste */
    display: flex;
    flex-direction: column;
}

/* Garantir que apenas a lista de comentários tenha scroll */
#ver-comentarios-secao .comments-list {
    flex: 1;
    overflow-y: auto;
}

/* Para a seção de escrever comentário, não ter scroll */
#escrever-comentario-secao {
    overflow: visible;
}

.comments-modal-section.hidden {
    display: none;
}

/* Configurações específicas para modal de comentários de obras */
#modal-comentarios-obras .comments-modal-content {
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#modal-comentarios-obras .comments-modal-section {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#modal-comentarios-obras #secao-ver-comentarios-obras {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#modal-comentarios-obras #lista-comentarios-obras,
#modal-comentarios-obras #lista-sugestoes-obras {
    flex: 1;
    max-height: 50vh;
    min-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    box-sizing: border-box;
}

/* Garantir que as abas não afetem o scroll */
#modal-comentarios-obras .comments-tabs {
    flex-shrink: 0;
}

#modal-comentarios-obras .comments-header {
    flex-shrink: 0;
}

/* Responsividade para modal de comentários de obras */
@media (max-width: 768px) {
    #modal-comentarios-obras .comments-modal-content {
        max-height: 95vh;
        width: 95%;
    }
    
    #modal-comentarios-obras #lista-comentarios-obras,
    #modal-comentarios-obras #lista-sugestoes-obras {
        max-height: 60vh;
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    #modal-comentarios-obras .comments-modal-content {
        max-height: 100vh;
        width: 100%;
        border-radius: 0;
    }
    
    #modal-comentarios-obras #lista-comentarios-obras,
    #modal-comentarios-obras #lista-sugestoes-obras {
        max-height: 70vh;
        min-height: 100px;
    }
}

/* Lista de comentários */
.comments-list {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.comment-item {
    background: rgba(30, 30, 30, 0.7);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 3px solid #fbbf24;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: #fbbf24;
}

.comment-meta {
    font-size: 0.8rem;
    color: #9ca3af;
}

.comment-rating {
    margin: 0.5rem 0;
}

.comment-rating .fa-star.active {
    color: #FFD700; /* Dourado mais vibrante */
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5); /* Brilho dourado */
}

.comment-rating .fa-star {
    color: #4b5563;
}

.comment-text {
    color: #e5e7eb;
    line-height: 1.5;
}

/* Formulário de comentários */
.comment-form {
    background: rgba(30, 30, 30, 0.7);
    border-radius: 8px;
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #e5e7eb;
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Sistema de estrelas */
.star-rating {
    display: flex;
    gap: 5px;
    margin: 0.5rem 0;
}

.star-rating .fa-star {
    font-size: 1.5rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
}

.star-rating .fa-star:hover,
.star-rating .fa-star.active {
    color: #fbbf24;
    transform: scale(1.1);
}

#rating-text {
    font-size: 0.9rem;
    color: #9ca3af;
    margin-left: 10px;
}

/* Botões de ação */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.form-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-actions .cancel-btn {
    background: #4b5563;
    color: #e5e7eb;
}

.form-actions .cancel-btn:hover {
    background: #374151;
}

.form-actions .submit-btn {
    background: linear-gradient(45deg, #fbbf24, #d97706);
    color: #111827;
}

.form-actions .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

/* Mensagens de alerta */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid #10b981;
    color: #10b981;
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.2);
    border: 1px solid #fbbf24;
    color: #fbbf24;
}

/* Responsividade */
@media (max-width: 640px) {
    .comments-modal-content {
        width: 95%;
        max-height: 95vh; /* Aumentar altura máxima no mobile */
        height: 95vh; /* Forçar altura específica no mobile */
    }
    
    /* Ajustar seções para mobile */
    .comments-modal-section {
        max-height: none; /* Remover limitação de altura no mobile */
        flex: 1; /* Usar todo espaço disponível */
        overflow-y: auto; /* Permitir scroll quando necessário */
    }
    
    /* Seção de ver comentários - ajustar para mobile */
    #ver-comentarios-secao {
        max-height: none; /* Remover limitação no mobile */
        flex: 1; /* Usar todo espaço disponível */
        display: flex;
        flex-direction: column;
    }
    
    #ver-comentarios-secao .comments-list {
        max-height: none; /* Remover limitação no mobile */
        flex: 1; /* Usar todo espaço disponível */
        overflow-y: auto; /* Permitir scroll */
        -webkit-overflow-scrolling: touch; /* Melhorar scroll no iOS */
        scrollbar-width: thin; /* Scrollbar fina no Firefox */
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .comments-btn {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
        border-width: 2px !important;
    }
}

/* Responsividade para telas muito pequenas */
@media (max-width: 480px) {
    .comments-modal-content {
        width: 98%;
        max-height: 98vh;
        height: 98vh;
    }
}

/* Badge para sugestões */
.suggestion-badge {
    background: linear-gradient(45deg, #10B981, #059669);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Indicador de sugestão com mesmo estilo das estrelas */
.suggestion-indicator {
    color: #10B981;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Estilos para botões de like nos comentários */
.comment-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Container do comentário precisa ter posição relativa */
.comment-item {
    position: relative;
    padding-bottom: 60px; /* Aumentado espaço para o botão maior */
}

.like-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 8px 16px; /* Aumentado padding */
    border-radius: 8px; /* Aumentado border-radius */
    cursor: pointer;
    font-size: 1em; /* Aumentado font-size */
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px; /* Aumentado gap */
    min-width: 70px; /* Aumentado min-width */
    justify-content: center;
}

.like-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Apenas o ícone fica vermelho quando curtido */
.like-btn.liked {
    background: rgba(255, 255, 255, 0.1); /* Mantém fundo original */
    border-color: rgba(255, 255, 255, 0.2); /* Mantém borda original */
    color: white;
}

.like-btn.liked:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.like-btn:active {
    transform: translateY(0);
}

/* Animação para o botão de like */
.like-btn i {
    transition: all 0.2s ease;
}

.like-btn:hover i {
    transform: scale(1.1);
}

/* Apenas o ícone fica vermelho quando curtido */
.like-btn.liked i {
    color: #dc3545; /* Coração vermelho */
    animation: heartBeat 0.3s ease;
}

.like-btn.liked:hover i {
    color: #c82333; /* Coração vermelho mais escuro no hover */
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Responsividade para botões de like */
@media (max-width: 768px) {
    .comment-item {
        padding-bottom: 55px; /* Ajustado para botão maior */
    }
    
    .comment-actions {
        bottom: 8px;
        right: 8px;
    }
    
    .like-btn {
        min-width: 60px; /* Aumentado para mobile */
        padding: 6px 12px; /* Aumentado para mobile */
        font-size: 0.9em; /* Aumentado para mobile */
    }
}