/* User Header Styles for Authenticated Users */

.user-header-section {
    align-items: center;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

/* Messages Icon */
.message-link {
    color: #333 !important;
    text-decoration: none !important;
    font-size: 1.25rem;
    padding: 0;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.message-link:hover {
    color: #5598E9 !important;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    transform: none;
}

.message-link:focus {
    color: #5598E9 !important;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.message-link:active {
    color: #5598E9 !important;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.message-badge {
    position: absolute;
    top: 15px;
    right: 25px;
    background: #dc3545;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    line-height: 1;
    z-index: 10;
}

/* Premium Crown Badge */
.premium-crown-badge {
    position: absolute;
    top: -4px;
    right: 12px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
    line-height: 1;
    z-index: 1000;
    transition: all 0.3s ease;
    animation: premiumGlow 2s ease-in-out infinite alternate;
}

.premium-crown-badge i {
    font-size: 0.65rem;
    color: #333;
}

.premium-crown-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.6);
}

/* Premium crown glow animation */
@keyframes premiumGlow {
    from {
        box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
    }
    to {
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6);
    }
}

/* Enhanced animation keyframes for dynamic crown updates */
@keyframes crownAppear {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-15deg);
    }
    30% {
        opacity: 0.7;
        transform: scale(1.2) rotate(5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes crownDisappear {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    30% {
        opacity: 0.7;
        transform: scale(1.2) rotate(-5deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) rotate(15deg);
    }
}

/* Animation classes for JavaScript control */
.premium-crown-badge.appear-animation {
    animation: crownAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.premium-crown-badge.disappear-animation {
    animation: crownDisappear 0.4s ease-in forwards;
}

/* User Avatar - Professional 80x80 */
.user-avatar {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0; /* Prevent avatar from shrinking */
}

/* Ensure fallback avatar is hidden by default */
.user-avatar .default-avatar[style*="display: none"] {
    display: none !important;
}

/* Force fallback avatar to be hidden when image is present and loaded */
.user-avatar img[style*="display: block"] + .default-avatar {
    display: none !important;
}

.user-avatar:hover {
    transform: scale(1.08);
}

.user-avatar img {
    transition: all 0.3s ease;
    display: block;
}

.user-avatar:hover img {
    box-shadow: 0 4px 18px rgba(0,0,0,0.25) !important;
}

.default-avatar {
    background: linear-gradient(135deg, #5598E9, #4A85D6);
    transition: all 0.3s ease;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.user-avatar:hover .default-avatar {
    /* box-shadow: 0 4px 18px rgba(0,0,0,0.25) !important;
    transform: scale(1.03); */
}

/* User Menu Dropdown */
.user-menu .dropdown-toggle {
    color: #333 !important;
    font-weight: 500;
    border: none !important;
    background: none !important;
    padding: 0.5rem 0;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.user-menu .dropdown-toggle:hover {
    color: #5598E9 !important;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.user-menu .dropdown-toggle:focus {
    color: #333 !important;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.user-menu .dropdown-toggle:active {
    color: #333 !important;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.user-menu .dropdown-toggle::after {
    display: none; /* Hide default Bootstrap arrow */
}

/* User Name Typography */
.user-name {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.5;
    color: #495057;
    letter-spacing: -0.01em;
    transition: color 0.3s ease;
}

.user-menu .dropdown-toggle:hover .user-name {
    color: #5598E9;
}

.user-menu .dropdown-menu {
    border: 1px solid rgba(85, 152, 233, 0.15);
    box-shadow: 0 8px 24px rgba(85, 152, 233, 0.12);
    border-radius: 12px;
    padding: 0.75rem 0;
    min-width: 200px;
    margin-top: 0.75rem;
    background: #ffffff;
    font-family: 'Montserrat', sans-serif;
    z-index: 9999;
}

.user-menu .dropdown-item {
    padding: 0.875rem 1.5rem;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    transition: all 0.3s ease;
    border: none !important;
    background: none !important;
    width: 100%;
    text-align: left;
    color: #495057 !important;
    display: flex;
    align-items: center;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
    letter-spacing: -0.01em;
}

.user-menu .dropdown-item:hover {
    background-color: rgba(85, 152, 233, 0.08) !important;
    color: #5598E9 !important;
    text-decoration: none !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0px !important;
}

.user-menu .dropdown-item:focus {
    background-color: rgba(85, 152, 233, 0.08) !important;
    color: #5598E9 !important;
    text-decoration: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 0px !important;
}

.user-menu .dropdown-item:active {
    background-color: rgba(85, 152, 233, 0.12) !important;
    color: #0D325E !important;
    text-decoration: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    outline: none !important;
}

.user-menu .dropdown-item i {
    width: 18px;
    height: 18px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    color: #6c757d;
    transition: color 0.3s ease;
}

.user-menu .dropdown-item:hover i,
.user-menu .dropdown-item:focus i {
    color: #5598E9;
}

.user-menu .dropdown-item:active i {
    color: #0D325E;
}

.user-menu .dropdown-divider {
    margin: 0.75rem 0;
    border-top: 1px solid rgba(85, 152, 233, 0.15);
    opacity: 1;
}

/* Guest Header */
.guest-header-section .btn {
    padding: 0.5rem 1.25rem;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
}

.guest-header-section .btn-outline-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(85, 152, 233, 0.3);
}

.guest-header-section .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(85, 152, 233, 0.4);
}

/* Responsive Design */
@media (max-width: 1199.98px) {
    .user-header-section {
        flex-direction: column;
        gap: 1rem;
        border-top: 1px solid #eee;
    }
    
    .user-avatar img,
    .default-avatar {
        /* width: 70px !important;
        height: 70px !important; */
        font-size: 1.8rem !important;
    }
    
    /* Mobile: Ensure only one avatar shows at a time */
    .user-avatar .default-avatar[style*="display: none"] {
        display: none !important;
    }
    
    .user-avatar img[style*="display: block"] + .default-avatar {
        display: none !important;
    }
    
    .user-menu .dropdown-toggle {
        justify-content: center;
        width: 100%;
        text-align: center;
    }
    
    .guest-header-section {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .guest-header-section .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 767.98px) {
    .messages-icon .badge {
        font-size: 0.7rem;
        min-width: 1.1em;
        height: 1.1em;
    }
    
    .premium-crown-badge {
        width: 18px !important;
        min-width: 18px !important;
        height: 18px !important;
        font-size: 0.7rem !important;
        top: 0px !important;
        right: -2px !important;
    }
    
    .premium-crown-badge i {
        font-size: 0.4rem !important;
    }
    
    .user-header-section {
        gap: 0.75rem;
        padding: 0 !important;
    }
    
    .user-avatar img,
    .default-avatar {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.5rem !important;
        border-width: 2px !important;
        box-shadow: none !important;
    }
    
    /* Mobile: Ensure fallback avatar is properly hidden */
    .user-avatar .default-avatar[style*="display: none"] {
        display: none !important;
    }
    
    .user-avatar img[style*="display: block"] + .default-avatar {
        display: none !important;
    }
    
    .user-name {
        font-size: 0.9rem;
    }

    .user-menu .dropdown-menu {
        margin-top: 0.75rem !important;
    }
}

@media (max-width: 575.98px) {
    .premium-crown-badge {
        width: 16px !important;
        min-width: 16px !important;
        height: 16px !important;
        font-size: 0.65rem !important;
        top: 0px !important;
        right: 5px !important;
    }
    
    .premium-crown-badge i {
        font-size: 0.45rem !important;
    }
    
    .user-avatar img,
    .default-avatar {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.3rem !important;
        border-width: 2px !important;
        box-shadow: none !important;
    }
    
    .user-header-section {
        gap: 0.5rem;
        padding: 10px 10px 0px !important;
        margin-top: 20px !important;
    }
    
    /* Extra Small Mobile: Ensure fallback avatar is properly hidden */
    .user-avatar .default-avatar[style*="display: none"] {
        display: none !important;
    }
    
    .user-avatar img[style*="display: block"] + .default-avatar {
        display: none !important;
    }

    .user-avatar:hover img {
        box-shadow: none !important;
    }

    
}

/* Animation for dropdown - DISABLED FOR TESTING */
/*
.user-menu .dropdown-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.user-menu .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
*/

