/**
 * SISTEMA DE PERFIL DE USUÁRIO - CSS CORRIGIDO
 * TopCasinoReviewsNow - Mantém consistência visual
 * 
 * ✅ Integração perfeita com design existente
 * ✅ Responsivo e acessível
 * ✅ Animações suaves
 * ✅ Compatibilidade com todos os elementos do menu
 */

/* ===== ÁREA DE PERFIL NA NAVBAR ===== */
.user-profile-section {
    position: relative;
    display: flex;
    align-items: center;
    animation: profileSlideIn 0.6s ease-out;
    margin-left: 15px; /* Espaçamento do elemento anterior */
}

.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

.user-dropdown-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color, #00ff88);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

/* ===== AVATAR DO USUÁRIO ===== */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    border: 2px solid rgba(0, 255, 136, 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.user-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-avatar .avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    background: var(--accent-color, #00ff88);
}

/* ===== INFORMAÇÕES DO USUÁRIO ===== */
.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex-grow: 1;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    line-height: 1.2;
}

/* REMOVIDO: .user-status para eliminar bolha "Online" */

/* ===== DROPDOWN DO USUÁRIO ===== */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ===== CABEÇALHO DO DROPDOWN ===== */
.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-header .user-avatar {
    width: 48px;
    height: 48px;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    min-width: 0;
}

.user-details .user-name {
    font-size: 16px;
    font-weight: 600;
    max-width: none;
}

.user-email {
    color: var(--text-secondary, #888888);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== DIVISOR ===== */
.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

/* ===== ITENS DO DROPDOWN ===== */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-primary, #ffffff);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-color, #00ff88);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    opacity: 0.7;
}

.dropdown-item:hover i {
    opacity: 1;
}

/* ===== BOTÃO DE LOGOUT ===== */
.logout-btn {
    color: #ff6b6b !important;
    font-family: inherit;
}

.logout-btn:hover {
    background: rgba(255, 107, 107, 0.1) !important;
    color: #ff5555 !important;
}

/* ===== ANIMAÇÕES ===== */
@keyframes profileSlideIn {
    from { 
        opacity: 0; 
        transform: translateY(-20px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .user-dropdown {
        position: fixed;
        top: 70px;
        left: 10px;
        right: 10px;
        width: auto;
    }
    
    .user-info {
        display: none;
    }
    
    .user-dropdown-trigger {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .user-profile-section {
        margin-left: 8px;
    }
}

@media (max-width: 480px) {
    .user-dropdown {
        top: 60px;
        left: 5px;
        right: 5px;
    }
    
    .dropdown-header {
        padding: 15px;
    }
    
    .dropdown-item {
        padding: 10px 15px;
    }
}

/* ===== COMPATIBILIDADE COM TEMAS ===== */
[data-theme="dark"] .user-dropdown {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .user-dropdown {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    color: #333333;
}

[data-theme="light"] .dropdown-item {
    color: #333333;
}

[data-theme="light"] .dropdown-header {
    background: rgba(0, 0, 0, 0.05);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .user-email {
    color: #666666;
}

/* ===== INTEGRAÇÃO COM NAVBAR EXISTENTE ===== */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navbar-actions .user-profile-section {
    margin-left: auto; /* Empurrar para o final */
}

/* ===== ESTADOS DE CARREGAMENTO ===== */
.user-profile-section.loading .user-avatar {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== ACESSIBILIDADE ===== */
.user-dropdown-trigger:focus {
    outline: 2px solid var(--accent-color, #00ff88);
    outline-offset: 2px;
}

.dropdown-item:focus {
    background: rgba(0, 255, 136, 0.1);
    outline: 1px solid rgba(0, 255, 136, 0.3);
}

/* ===== PREVENÇÃO DE CONFLITOS ===== */
.user-profile-section * {
    box-sizing: border-box;
}

.user-profile-section button {
    font-family: inherit;
}

.user-profile-section a {
    text-decoration: none;
}

/* ===== MELHORIAS VISUAIS ===== */
.user-dropdown-trigger .fas.fa-chevron-down {
    font-size: 12px;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.user-dropdown.active + .user-dropdown-trigger .fas.fa-chevron-down {
    transform: rotate(180deg);
}

.user-avatar:hover {
    border-color: var(--accent-color, #00ff88);
}

/* ===== ESTADOS DE LOGIN/LOGOUT ===== */
.user-logged-in .login-trigger,
.user-logged-in .register-btn {
    display: none !important;
}

.user-logged-out .user-profile-section {
    display: none !important;
}

/* ===== FORÇAR REMOÇÃO DE QUALQUER TEXTO "ONLINE" ===== */
.user-status,
.user-info .user-status,
[class*="status"],
[class*="online"] {
    display: none !important;
}

/* Garantir que não apareça texto "Online" em lugar nenhum */
.user-profile-section *:contains("Online"),
.user-profile-section *:contains("online") {
    display: none !important;
}