/* teti/css/ranking-resources.css v6.0 */

/* Container Full Screen */
#rr-full-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-body, #121212);
    z-index: 2000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.rr-header-bar {
    padding: 15px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
}
.rr-header-title { font-weight: bold; color: var(--text-main); }
.rr-scroll-area { flex: 1; overflow-y: auto; padding: 15px; padding-bottom: 100px; }

/* 1. Área das questões: Define altura limite e scroll vertical */
#rr-questions-area {
    width: 100%;
    /* Define uma altura máxima (aprox 3 a 4 linhas de bolinhas visíveis) */
    max-height: 160px; 
    
    /* Scroll vertical ativado */
    overflow-y: auto;
    
    /* Scroll lateral DESATIVADO */
    overflow-x: hidden; 
    
    padding: 10px 15px;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    
    /* Estilização da barra de rolagem (opcional, para ficar bonito) */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-card);
}

/* 2. Grid: Garante que quebre linha e centralize */
.rr-questions-grid {
    display: flex;
    flex-wrap: wrap; /* Mantém a quebra de linha */
    gap: 8px; /* Gap reduzido levemente (era 12px) */
    padding: 5px;
    justify-content: center;
    width: 100%; /* Garante uso total da largura para quebrar linha corretamente */
}

/* 3. Bolinhas: Tamanho reduzido */
.rr-q-circle {
    /* Reduzido de 50px para 38px */
    min-width: 38px; 
    height: 38px; 
    
    border-radius: 10px; /* Ajuste proporcional do raio */
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    
    cursor: pointer; 
    font-weight: bold;
    font-size: 0.85rem; /* Fonte levemente menor */
    transition: all 0.2s;
    position: relative;
}
.rr-q-circle.active {
    border-color: var(--primary-color);
    background: rgba(98, 0, 234, 0.2);
    color: var(--primary-color);
    box-shadow: 0 0 8px rgba(98, 0, 234, 0.4);
}

/* Botões de Ação */
.btn-rr-back, .btn-rr-create {
    display: inline-flex; align-items: center; justify-content: center;
    height: 40px; padding: 0 15px; border-radius: 8px; border: none;
    font-weight: 600; cursor: pointer; color: #fff; font-size: 0.9rem;
}
.btn-rr-back { background-color: rgba(255, 255, 255, 0.1); }
.btn-rr-create { background: linear-gradient(135deg, #6200ea, #7c4dff); box-shadow: 0 4px 12px rgba(98, 0, 234, 0.3); }

/* Contexto da Questão */
.rr-question-context {
    background: var(--bg-card);
    padding: 15px; 
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);

    /* --- CORREÇÃO DE QUEBRA DE LINHA --- */
    /* Garante que palavras longas/fórmulas quebrem para a próxima linha */
    word-break: break-word;      
    overflow-wrap: break-word;   
    
    /* Segurança extra: limita a largura máxima ao container pai */
    max-width: 100%; 
}
.rr-alternative-item {
    display: flex; align-items: flex-start;
    padding: 10px; background: rgba(255,255,255,0.03);
    border-radius: 8px; margin-bottom: 8px;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Cards de Recursos */
.resource-card {
    background: var(--bg-card); padding: 15px; margin-bottom: 15px;
    border-radius: 12px; border: 1px solid var(--border-color);
    position: relative; transition: all 0.3s ease;
}

/* Badges de Qualidade */
.rating-low { background: rgba(244, 67, 54, 0.2); color: #ff5252; }
.rating-med { background: rgba(255, 193, 7, 0.2); color: #ffab00; }
.rating-high { background: rgba(0, 230, 118, 0.2); color: #00e676; }

/* Botões Internos do Card */
.btn-res-action {
    background: none; border: none;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 5px;
    cursor: pointer; padding: 5px 8px;
    border-radius: 6px; transition: background 0.2s;
}
.btn-res-action:hover { background: rgba(255,255,255,0.05); }
.btn-res-action.liked { color: #f91880; }
.btn-res-action.disabled { opacity: 0.5; cursor: not-allowed; }

/* COMENTÁRIOS INLINE (Correção Tópico 2) */
.rr-comments-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: none; /* Oculto por padrão */
    flex-direction: column;
}
.rr-comments-section.open { display: flex; }

.rr-comment-item {
    background: rgba(255,255,255,0.03);
    padding: 10px; border-radius: 8px;
    margin-bottom: 8px; font-size: 0.9rem;
}

.rr-comment-input-area {
    display: flex; gap: 10px; margin-top: 10px;
}
.rr-input-comment {
    flex: 1; background: var(--bg-body); border: 1px solid var(--border-color);
    padding: 10px; border-radius: 20px; color: #fff; outline: none;
}
.btn-send-comment {
    background: var(--primary-color); border: none;
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; cursor: pointer;
}

/* BOTÃO DE UPLOAD (Correção Tópico 6) */
.btn-upload-gabarito {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px dashed var(--border-color);
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.2s;
}
.btn-upload-gabarito:hover { background: rgba(255,255,255,0.05); border-color: var(--primary-color); color: var(--text-main); }
.btn-upload-gabarito.processed {
    border: 1px solid #00e676;
    background: rgba(0, 230, 118, 0.1);
    color: #00e676;
}

/* Modais */
.rr-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 2100;
    align-items: center; justify-content: center;
}
.rr-modal-card {
    background: var(--bg-card); width: 90%; max-width: 500px;
    border-radius: 16px; padding: 20px;
    border: 1px solid var(--border-color);
}

/* --- ITEM 2: Grid de Bolinhas (Wrap em vez de Scroll) --- */
.rr-questions-grid {
    display: flex;
    flex-wrap: wrap; /* Quebra linha */
    gap: 12px;
    padding: 10px 5px;
    justify-content: center; /* Centralizado */
}

/* Bolinhas ajustadas */
.rr-q-circle {
    min-width: 50px; height: 50px; /* Um pouco maior para caber contador */
    border-radius: 12px; /* Mais moderno que bolinha perfeita */
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex; flex-direction: column; /* Para empilhar número e contador */
    align-items: center; justify-content: center;
    cursor: pointer; font-weight: bold;
    transition: all 0.2s;
    position: relative;
}

/* --- ITEM 3: Contador dentro da bolinha --- */
.rr-bubble-counter {
    font-size: 7px;
    color: var(--text-muted);
    margin-top: -1px;
}
.rr-q-circle.active .rr-bubble-counter {
    color: var(--primary-color);
}

/* --- ITEM 5: Snapshot da Questão dentro do post --- */
.rr-post-snapshot {
    background: rgba(0,0,0,0.2); /* Fundo escuro sutil */
    border-left: 3px solid var(--primary-color);
    padding: 10px;
    margin-bottom: 12px;
    border-radius: 0 6px 6px 0;
}
.snapshot-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}
.snapshot-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limita a 2 linhas */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- ITEM 6: Badge de Qualidade Menor --- */
.rr-rating-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.rr-rating-pill.rating-low { border: 1px solid #ff5252; color: #ff5252; background: transparent; }
.rr-rating-pill.rating-med { border: 1px solid #ffab00; color: #ffab00; background: transparent; }
.rr-rating-pill.rating-high { border: 1px solid #00e676; color: #00e676; background: transparent; }

/* Badge "VOCÊ" */
.rr-me-badge {
    font-size: 0.6em;
    background: var(--primary-color);
    padding: 1px 4px;
    border-radius: 4px;
    color: #fff;
    margin-left: 5px;
    vertical-align: middle;
}

/* --- COMENTÁRIOS (Itens 8, 9, 10) --- */
.rr-comments-list {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 10px;
    padding-right: 5px;
}

.rr-comment-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.rr-comment-item:last-child { border-bottom: none; }

.rr-comment-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.rr-comment-header {
    display: flex; align-items: baseline; gap: 6px;
}
.rr-comment-author {
    font-weight: 600; font-size: 0.85rem; color: var(--text-main);
}
.rr-comment-time {
    font-size: 0.7rem; color: var(--text-muted);
}
.rr-comment-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 2px;
}

/* Ações do comentário */
.rr-comment-actions {
    margin-top: 4px;
    display: flex; gap: 12px;
}
.rr-comment-action {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.rr-comment-action:hover { color: var(--text-main); }
.rr-comment-action.delete { color: #ff5252; }

.rr-reply-tag {
    color: var(--primary-color);
    font-weight: 600;
}

/* Badge de Resposta no Input */
.rr-reply-badge {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 5px;
    display: inline-flex; align-items: center; gap: 5px;
}
.close-reply {
    cursor: pointer; font-weight: bold; padding: 0 4px;
}

/* Botão Icone Apenas (Lixeira) */
.btn-rr-icon-only {
    background: none; border: none; padding: 4px; cursor: pointer;
    opacity: 0.7; transition: opacity 0.2s;
}
.btn-rr-icon-only:hover { opacity: 1; }

/* --- CORREÇÃO COMENTÁRIOS E RESPOSTAS --- */

/* Trava o tamanho da foto para evitar o bug "Gigante" */
.rr-comment-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px; /* Garante que não esmague */
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--bg-body); /* Fundo caso a imagem falhe */
}

/* Container de Respostas (Aninhamento) */
.rr-replies-list {
    margin-left: 10px;
    padding-left: 10px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Ajuste visual do comentário */
.rr-comment-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    animation: fadeIn 0.3s ease;
}

/* Bolha do comentário (estilo Feed.js) */
.rr-comment-bubble {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 8px 12px;
    flex: 1;
    position: relative;
}

.rr-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.rr-comment-author {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-main);
    cursor: pointer;
}

.rr-comment-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
    word-break: break-word;
}

/* Ações (Responder, Excluir) */
.rr-comment-actions {
    display: flex;
    gap: 15px;
    margin-top: 4px;
    margin-left: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.rr-action-link {
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s;
}
.rr-action-link:hover { color: var(--primary-color); }
.rr-action-link.delete { color: #ff5252; opacity: 0.8; }

/* Input de Resposta (Invisível por padrão) */
.rr-reply-input-container {
    display: none;
    margin-top: 8px;
    margin-left: 42px; /* Alinha com texto */
}
.rr-reply-input-container.open { display: flex; gap: 8px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.rr-mini-avatar {
    max-height: 32px;
}

