/**
 * Custom Avatars CSS - Central de Ajuda Cloud
 * Estilos para avatars customizados com iniciais e degradês
 */

/* === AVATAR CUSTOMIZADO === */
.cg-custom-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    user-select: none;
    flex-shrink: 0;
    /* Força proporção circular */
    min-width: var(--avatar-size, 40px);
    min-height: var(--avatar-size, 40px);
    max-width: var(--avatar-size, 40px);
    max-height: var(--avatar-size, 40px);
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

/* Forçar círculo perfeito - sobrescreve qualquer CSS externo */
.cg-custom-avatar,
.cg-custom-avatar * {
    box-sizing: border-box !important;
}

.cg-custom-avatar {
    /* Importante para evitar distorção */
    flex: none !important;
    transform-origin: center !important;
}

.cg-custom-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* === TAMANHOS ESPECÍFICOS === */
.cg-custom-avatar.size-small {
    width: 32px;
    height: 32px;
    font-size: 11px;
    font-weight: 500;
    border-width: 1px;
}

.cg-custom-avatar.size-medium {
    width: 40px;
    height: 40px;
    font-size: 16px;
}

.cg-custom-avatar.size-large {
    width: 56px;
    height: 56px;
    font-size: 22px;
    border-width: 3px;
}

.cg-custom-avatar.size-xlarge {
    width: 72px;
    height: 72px;
    font-size: 28px;
    border-width: 3px;
}

/* === CONTEXTOS ESPECÍFICOS === */

/* Avatars na lista de tópicos (grid) */
.cg-topics-grid .cg-custom-avatar {
    margin-right: var(--spacing-sm);
}

/* Layout específico para cards da grid - COMPACTO */
.cg-card-user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 1;
    min-height: 32px;
}

.cg-card-user-info .cg-custom-avatar {
    margin-right: 0;
    flex-shrink: 0;
    flex-grow: 0;
    align-self: center;
    width: 28px !important;
    height: 28px !important;
    --avatar-size: 28px !important;
    font-size: 12px !important;
}

.cg-card-user-details {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    min-width: 0; /* Permite que o texto seja truncado se necessário */
    flex: 1;
}

.cg-card-username {
    font-weight: 600;
    color: var(--text-primary, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.cg-card-date {
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
    white-space: nowrap;
    line-height: 1.2;
    margin-top: 2px;
}

/* Proteção contra estilos globais que possam distorcer avatars */
.cg-custom-avatar,
* .cg-custom-avatar,
div.cg-custom-avatar {
    /* Força dimensões exatas */
    flex: none !important;
    width: var(--avatar-size, 40px) !important;
    height: var(--avatar-size, 40px) !important;
    min-width: var(--avatar-size, 40px) !important;
    min-height: var(--avatar-size, 40px) !important;
    max-width: var(--avatar-size, 40px) !important;
    max-height: var(--avatar-size, 40px) !important;
    border-radius: 50% !important;
    /* Impede stretching em containers flex */
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    align-self: center !important;
    /* Impede distorções de transform */
    transform-origin: center center !important;
    /* Garantia extra */
    object-fit: cover !important;
    background-size: cover !important;
    background-position: center !important;
}

/* Melhorias no layout do footer do card */
.cg-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.cg-card-meta-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Avatars na página do tópico */
.cg-topic-meta .cg-custom-avatar {
    margin-right: var(--spacing-sm);
}

/* Avatars nas respostas */
.cg-answer-meta .cg-custom-avatar {
    margin-right: var(--spacing-sm);
}

/* === CONTAINER DE AUTOR === */
.cg-author-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.cg-author-info .cg-custom-avatar + div {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Regras antigas removidas - agora usando layout horizontal específico */

/* Ajuste no header da resposta */
.cg-answer-header {
    margin-bottom: 12px;
}

/* === RESPONSIVO === */
@media (max-width: 768px) {
    .cg-custom-avatar.size-large {
        width: 48px;
        height: 48px;
        font-size: 19px;
    }
    
    .cg-custom-avatar.size-xlarge {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .cg-custom-avatar.size-medium {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .cg-custom-avatar.size-large {
        width: 44px;
        height: 44px;
        font-size: 17px;
    }
}

/* === EFEITOS ESPECIAIS === */
.cg-custom-avatar.animated {
    animation: pulse-soft 2s ease-in-out infinite;
}

@keyframes pulse-soft {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
}

/* === AVATAR OFFLINE/ONLINE === */
.cg-custom-avatar.status-online::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cg-custom-avatar.status-offline::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #94a3b8;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Para avatars com status, precisa de position relative */
.cg-author-info {
    position: relative;
}

/* === AVATAR ESPECÍFICO DAS RESPOSTAS - CLEAN === */
.cg-answer-author .cg-custom-avatar {
    width: 36px !important;
    height: 36px !important;
    --avatar-size: 36px !important;
    font-size: 14px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

/* === LAYOUT CLEAN - REGRAS SIMPLIFICADAS === */
/* Regras antigas removidas - layout controlado por answers.css */