/**
 * User Account Menu Styles
 * Premium dropdown menu with smooth animations
 */

/* User Account Menu Container */
.user-account-menu {
    position: relative;
    margin-left: 20px;
}

/* User Menu Toggle Button */
.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--user-menu-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--user-menu-border, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    color: var(--user-menu-text, #E5E7EB);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
}

/* Light theme overrides */
[data-theme="light"] .user-menu-toggle {
    --user-menu-bg: rgba(0, 0, 0, 0.05);
    --user-menu-border: rgba(0, 0, 0, 0.1);
    --user-menu-text: #1F2937;
}

.user-menu-toggle:hover {
    background: var(--user-menu-hover-bg, rgba(255, 255, 255, 0.08));
    border-color: var(--user-menu-hover-border, rgba(0, 217, 255, 0.3));
    transform: translateY(-1px);
}

[data-theme="light"] .user-menu-toggle:hover {
    --user-menu-hover-bg: rgba(0, 0, 0, 0.08);
    --user-menu-hover-border: rgba(0, 217, 255, 0.5);
}

.user-menu-toggle[aria-expanded="true"] {
    background: rgba(0, 217, 255, 0.1);
    border-color: rgba(0, 217, 255, 0.4);
}

/* User Avatar */
.user-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.2), rgba(0, 245, 160, 0.2));
    flex-shrink: 0;
}

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

.user-avatar .bi-person-circle {
    font-size: 24px;
    color: #00D9FF;
}

/* User Name */
.user-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dropdown Arrow */
.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.15s ease;
    color: #94A3B8;
}

.user-menu-toggle[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
    color: #00D9FF;
}

/* Dropdown Menu */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    background: var(--dropdown-bg, linear-gradient(135deg, #1A1F2E 0%, #151925 100%));
    border: 1px solid var(--dropdown-border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    box-shadow: var(--dropdown-shadow, 0 10px 40px rgba(0, 0, 0, 0.5)),
                0 2px 10px rgba(0, 217, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px) scale(0.98);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 1000;
    overflow: hidden;
}

[data-theme="light"] .user-dropdown-menu {
    --dropdown-bg: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
    --dropdown-border: rgba(0, 0, 0, 0.1);
    --dropdown-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.user-dropdown-menu[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Dropdown Header */
.dropdown-header {
    padding: 20px;
    background: var(--dropdown-header-bg, rgba(0, 217, 255, 0.05));
    border-bottom: 1px solid var(--dropdown-divider, rgba(255, 255, 255, 0.08));
}

[data-theme="light"] .dropdown-header {
    --dropdown-header-bg: rgba(0, 217, 255, 0.08);
    --dropdown-divider: rgba(0, 0, 0, 0.08);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-info strong {
    font-size: 16px;
    font-weight: 600;
    color: var(--dropdown-title, #FFFFFF);
}

[data-theme="light"] .user-info strong {
    --dropdown-title: #111827;
}

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

[data-theme="light"] .user-email {
    --dropdown-subtitle: #6B7280;
}

/* Dropdown Divider */
.dropdown-divider {
    height: 1px;
    background: var(--divider-gradient, linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent));
    margin: 0;
}

[data-theme="light"] .dropdown-divider {
    --divider-gradient: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.08), transparent);
}

/* Dropdown Navigation */
.dropdown-nav {
    padding: 8px;
}

/* Dropdown Items */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--dropdown-item-text, #CBD5E1);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .dropdown-item {
    --dropdown-item-text: #4B5563;
}

.dropdown-item:hover {
    background: var(--dropdown-item-hover, rgba(0, 217, 255, 0.1));
    color: var(--dropdown-item-hover-text, #FFFFFF);
    transform: translateX(4px);
}

[data-theme="light"] .dropdown-item:hover {
    --dropdown-item-hover: rgba(0, 217, 255, 0.12);
    --dropdown-item-hover-text: #111827;
}

.dropdown-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
    color: var(--dropdown-icon, #94A3B8);
    transition: color 0.2s ease;
}

[data-theme="light"] .dropdown-item i {
    --dropdown-icon: #9CA3AF;
}

.dropdown-item:hover i {
    color: #00D9FF;
}

/* Logout Item */
.logout-item {
    margin: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    margin-top: 8px;
}

.logout-item:hover {
    background: rgba(239, 68, 68, 0.1);
}

.logout-item:hover i {
    color: #EF4444;
}

/* Animation for menu items - removed for faster response */

/* Mobile Responsive */
@media (max-width: 768px) {
    .user-account-menu {
        margin-left: auto;
        margin-right: 10px;
    }
    
    .user-menu-toggle {
        padding: 6px 12px;
    }
    
    .user-name {
        display: none;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
    }
    
    .user-dropdown-menu {
        right: -10px;
        min-width: 240px;
    }
    
    .dropdown-header {
        padding: 16px;
    }
    
    .dropdown-item {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Tablet */
@media (max-width: 991px) and (min-width: 769px) {
    .user-name {
        max-width: 100px;
    }
}

/* Focus states for accessibility */
.user-menu-toggle:focus-visible {
    outline: 2px solid rgba(0, 217, 255, 0.5);
    outline-offset: 2px;
}

.dropdown-item:focus-visible {
    outline: 2px solid rgba(0, 217, 255, 0.5);
    outline-offset: -2px;
}

/* Overlay removed for cleaner dropdown UX */

/* Login/Signup Button for Logged Out Users - Match logged-in style */
.user-auth-menu {
    position: relative;
    margin-left: 20px;
}

.auth-menu-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--user-menu-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--user-menu-border, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    color: var(--user-menu-text, #E5E7EB);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

[data-theme="light"] .auth-menu-button {
    --user-menu-bg: rgba(0, 0, 0, 0.05);
    --user-menu-border: rgba(0, 0, 0, 0.1);
    --user-menu-text: #1F2937;
}

.auth-menu-button:hover {
    background: var(--user-menu-hover-bg, rgba(255, 255, 255, 0.08));
    border-color: var(--user-menu-hover-border, rgba(0, 217, 255, 0.3));
    transform: translateY(-1px);
    color: var(--user-menu-hover-text, #FFFFFF);
}

[data-theme="light"] .auth-menu-button:hover {
    --user-menu-hover-bg: rgba(0, 0, 0, 0.08);
    --user-menu-hover-border: rgba(0, 217, 255, 0.5);
    --user-menu-hover-text: #111827;
}

.auth-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.2), rgba(0, 245, 160, 0.2));
    flex-shrink: 0;
    overflow: hidden;
}

.auth-icon i {
    font-size: 24px;
    color: #00D9FF;
}

.auth-menu-button:hover .auth-icon {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.3), rgba(0, 245, 160, 0.3));
}

.auth-text {
    color: inherit;
}

/* Sidebar User Info - Match Header Style */
.history-user-info a.user-logged-in {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--sidebar-user-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--sidebar-user-border, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    color: var(--sidebar-user-text, #E5E7EB);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

[data-theme="light"] .history-user-info a.user-logged-in {
    --sidebar-user-bg: rgba(0, 0, 0, 0.05);
    --sidebar-user-border: rgba(0, 0, 0, 0.1);
    --sidebar-user-text: #1F2937;
}

.history-user-info a.user-logged-in:hover {
    background: var(--sidebar-user-hover-bg, rgba(255, 255, 255, 0.08));
    border-color: var(--sidebar-user-hover-border, rgba(0, 217, 255, 0.3));
    transform: translateY(-1px);
    color: var(--sidebar-user-hover-text, #FFFFFF);
}

[data-theme="light"] .history-user-info a.user-logged-in:hover {
    --sidebar-user-hover-bg: rgba(0, 0, 0, 0.08);
    --sidebar-user-hover-border: rgba(0, 217, 255, 0.5);
    --sidebar-user-hover-text: #111827;
}

.history-user-info .user-avatar-sidebar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.2), rgba(0, 245, 160, 0.2));
    overflow: hidden;
    flex-shrink: 0;
}

.history-user-info .user-avatar-sidebar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-user-info .user-avatar-sidebar i {
    font-size: 24px;
    color: #00D9FF;
}

.history-user-info a.user-logged-in span {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile Responsive for Auth Button */
@media (max-width: 768px) {
    .user-auth-menu {
        margin-left: auto;
        margin-right: 10px;
    }
    
    .auth-menu-button {
        padding: 6px 12px;
    }
    
    .auth-text {
        display: none;
    }
    
    .auth-icon {
        width: 28px;
        height: 28px;
    }
    
    .auth-icon i {
        font-size: 18px;
    }
    
    /* Sidebar adjustments for mobile */
    .history-user-info a.user-logged-in {
        padding: 6px 12px;
    }
    
    .history-user-info a.user-logged-in span {
        font-size: 13px;
    }
}