/**
 * Modern Profile Dropdown Styles
 * GitHub/Google-inspired dropdown menu design
 */

/* Dropdown Container */
.profile-dropdown {
    position: fixed;
    background: var(--dropdown-bg, #ffffff);
    border: 1px solid var(--dropdown-border, rgba(0, 0, 0, 0.1));
    border-radius: 12px;
    box-shadow: 
        0 10px 50px rgba(0, 0, 0, 0.1),
        0 5px 20px rgba(0, 0, 0, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.05);
    min-width: 280px;
    max-width: 320px;
    z-index: 10000;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.profile-dropdown.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Dropdown Header */
.dropdown-header {
    padding: 16px;
    border-bottom: 1px solid var(--dropdown-divider, rgba(0, 0, 0, 0.06));
}

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

.user-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    line-height: 1.3;
}

.user-email {
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
    line-height: 1.3;
}

/* Dropdown Menu */
.dropdown-menu {
    padding: 6px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary, #1a1a1a);
    font-size: 14px;
    text-decoration: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    text-align: left;
    font-family: inherit;
    line-height: 1.4;
}

.dropdown-item:hover {
    background: var(--dropdown-hover, rgba(0, 0, 0, 0.04));
    color: var(--text-primary, #1a1a1a);
    transform: translateX(2px);
}

.dropdown-item:active {
    background: var(--dropdown-active, rgba(0, 0, 0, 0.08));
    transform: translateX(1px);
}

/* Dropdown Icons */
.dropdown-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--icon-color, #6b7280);
}

.dropdown-icon svg {
    width: 16px;
    height: 16px;
}

.dropdown-item:hover .dropdown-icon {
    color: var(--icon-hover, #374151);
}

/* Dropdown Arrow for Submenu */
.dropdown-arrow {
    margin-left: auto;
    display: flex;
    align-items: center;
    color: var(--text-secondary, #9ca3af);
}

/* Dropdown Divider */
.dropdown-divider {
    height: 1px;
    background: var(--dropdown-divider, rgba(0, 0, 0, 0.06));
    margin: 6px 0;
}

/* Language Submenu */
.dropdown-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 4px;
    background: var(--dropdown-bg, #ffffff);
    border: 1px solid var(--dropdown-border, rgba(0, 0, 0, 0.1));
    border-radius: 12px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.12),
        0 4px 16px rgba(0, 0, 0, 0.08);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 6px;
}

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

/* Language Options */
.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    color: var(--text-primary, #1a1a1a);
    text-align: left;
    font-family: inherit;
}

.language-option:hover {
    background: var(--dropdown-hover, rgba(0, 0, 0, 0.04));
}

.language-option.active {
    background: var(--dropdown-active-bg, rgba(59, 130, 246, 0.1));
    color: var(--color-primary, #3b82f6);
    font-weight: 500;
}

.language-flag {
    font-size: 18px;
    line-height: 1;
    width: 24px;
    text-align: center;
}

.language-name {
    flex: 1;
}

.checkmark {
    color: var(--color-primary, #3b82f6);
    font-weight: bold;
    margin-left: auto;
}

/* Scrollbar Styling */
.dropdown-submenu::-webkit-scrollbar {
    width: 6px;
}

.dropdown-submenu::-webkit-scrollbar-track {
    background: transparent;
}

.dropdown-submenu::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb, rgba(0, 0, 0, 0.2));
    border-radius: 3px;
}

.dropdown-submenu::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover, rgba(0, 0, 0, 0.3));
}

/* Dark Mode Support */
[data-theme="dark"] .profile-dropdown {
    --dropdown-bg: #1f2937;
    --dropdown-border: rgba(255, 255, 255, 0.1);
    --dropdown-divider: rgba(255, 255, 255, 0.1);
    --dropdown-hover: rgba(255, 255, 255, 0.08);
    --dropdown-active: rgba(255, 255, 255, 0.12);
    --dropdown-active-bg: rgba(59, 130, 246, 0.2);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --icon-color: #9ca3af;
    --icon-hover: #d1d5db;
    --scrollbar-thumb: rgba(255, 255, 255, 0.2);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.3);
    
    background: #1f2937;
    box-shadow: 
        0 10px 50px rgba(0, 0, 0, 0.5),
        0 5px 20px rgba(0, 0, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .dropdown-submenu {
    background: #1f2937;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .profile-dropdown {
        min-width: 260px;
        max-width: calc(100vw - 32px);
        right: 16px !important;
        left: auto !important;
    }
    
    .dropdown-submenu {
        position: fixed;
        left: 16px !important;
        right: 16px;
        top: 50% !important;
        transform: translateY(-50%) translateX(0) !important;
        margin-left: 0;
        width: auto;
        min-width: auto;
    }
    
    .dropdown-submenu.active {
        transform: translateY(-50%) !important;
    }
}

/* Animation for profile avatar when dropdown is open */
[data-dropdown-attached][aria-expanded="true"] {
    transform: scale(0.95);
    opacity: 0.8;
    transition: all 0.2s ease;
}

/* Ensure profile avatar is clickable */
.profile-avatar-nav {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.profile-avatar-nav:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* Focus styles for accessibility */
.dropdown-item:focus {
    outline: 2px solid var(--color-primary, #3b82f6);
    outline-offset: -2px;
}

.language-option:focus {
    outline: 2px solid var(--color-primary, #3b82f6);
    outline-offset: -2px;
}

/* Loading state */
.dropdown-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: var(--text-secondary, #6b7280);
}

/* Empty state */
.dropdown-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary, #6b7280);
    font-size: 14px;
}