/**
 * Enhanced User Profile Dropdown Styles
 * Gantt-Specific Settings Design (Example 3 Style)
 */

/* ============================================
   USER PROFILE BUTTON (Top-Right Corner)
   ============================================ */

.user-profile-dropdown {
    position: relative;
    display: inline-block;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    transition: all 0.2s ease;
}

.user-profile-btn:hover {
    background: #f6f8fa;
    border-color: #d1d5da;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.user-name {
    color: #24292e;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    color: #6a737d;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.user-profile-btn:hover .dropdown-arrow {
    transform: translateY(2px);
}

/* ============================================
   DROPDOWN MENU
   ============================================ */

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 320px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 50000; /* Above excel toolbar (10001) and dependency popup (100000) */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.profile-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Custom Scrollbar for Dropdown */
.profile-dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.profile-dropdown-menu::-webkit-scrollbar-track {
    background: #f6f8fa;
    border-radius: 4px;
}

.profile-dropdown-menu::-webkit-scrollbar-thumb {
    background: #d1d5da;
    border-radius: 4px;
}

.profile-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #959da5;
}

/* ============================================
   HEADER SECTION (User Info)
   ============================================ */

.dropdown-header {
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px 8px 0 0;
}

.dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 1px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.dropdown-user-details {
    flex: 1;
    color: white;
}

.dropdown-user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.dropdown-user-email {
    font-size: 13px;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.dropdown-admin-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ============================================
   DIVIDER
   ============================================ */

.dropdown-divider {
    height: 1px;
    background: #e1e4e8;
    margin: 8px 0;
}

/* ============================================
   SECTIONS
   ============================================ */

.dropdown-section {
    padding: 8px 0;
}

.section-title {
    padding: 8px 16px 6px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6a737d;
}

/* ============================================
   MENU ITEMS
   ============================================ */

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 14px;
    color: #24292e;
}

.menu-item:hover {
    background: #f6f8fa;
}

.menu-item:active {
    background: #e1e4e8;
}

.menu-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.menu-label {
    flex: 1;
    font-weight: 400;
}

.menu-value {
    font-size: 13px;
    color: #6a737d;
    font-weight: 500;
}

/* Logout/Sign Out Item - Special Styling */
.logout-item {
    color: #d73a49;
    font-weight: 500;
}

.logout-item:hover {
    background: #ffeef0;
}

.logout-item .menu-icon {
    opacity: 0.9;
}

/* ============================================
   TOGGLE SWITCHES
   ============================================ */

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.menu-toggle:hover {
    background: #f6f8fa;
}

.toggle-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #d1d5da;
    border-radius: 12px;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch.active {
    background: #28a745;
}

.toggle-switch.active::after {
    left: 22px;
}

/* Hover effect for toggle */
.menu-toggle:hover .toggle-switch {
    opacity: 0.9;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .profile-dropdown-menu {
        min-width: 280px;
        right: -16px; /* Adjust for mobile spacing */
    }

    .user-name {
        max-width: 100px;
    }
}

/* ============================================
   ANIMATION KEYFRAMES
   ============================================ */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ADMIN SECTION HIGHLIGHT
   ============================================ */

.dropdown-section:has(#admin-panel-btn) {
    background: linear-gradient(90deg, transparent 0%, rgba(255, 193, 7, 0.05) 100%);
}

.dropdown-section:has(#admin-panel-btn) .section-title {
    color: #ff9800;
}

#admin-panel-btn {
    font-weight: 500;
}

#admin-panel-btn:hover {
    background: rgba(255, 193, 7, 0.08);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.menu-item:focus,
.menu-toggle:focus {
    outline: 2px solid #0366d6;
    outline-offset: -2px;
}

.user-profile-btn:focus {
    outline: 2px solid #0366d6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .profile-dropdown-menu {
        border: 2px solid #000;
    }

    .dropdown-header {
        background: #0366d6;
    }

    .menu-item:hover,
    .menu-toggle:hover {
        background: #000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .profile-dropdown-menu,
    .toggle-switch,
    .toggle-switch::after,
    .menu-item,
    .menu-toggle {
        transition: none;
    }
}

/* ============================================
   COMPACT STYLE (matches left sidebar)
   ============================================ */

.profile-dropdown-menu.compact {
    min-width: auto;
    width: 160px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 6px 0;
}

.profile-dropdown-menu.compact .dropdown-header {
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px 6px 0 0;
}

.profile-dropdown-menu.compact .dropdown-user-info {
    gap: 8px;
}

.profile-dropdown-menu.compact .user-avatar-large {
    width: 24px;
    height: 24px;
    font-size: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.profile-dropdown-menu.compact .dropdown-user-details {
    min-width: 0;
}

.profile-dropdown-menu.compact .dropdown-user-name {
    font-size: 11px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-menu.compact .dropdown-user-email {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-menu.compact .dropdown-admin-badge {
    font-size: 8px;
    padding: 1px 4px;
    border-radius: 3px;
    background: #007bff;
    color: white;
    margin-top: 2px;
    display: inline-block;
}

.profile-dropdown-menu.compact .dropdown-divider {
    margin: 4px 0;
    background: #eee;
}

.profile-dropdown-menu.compact .menu-item.compact {
    padding: 6px 12px;
    gap: 8px;
    font-size: 11px;
    color: #333;
}

.profile-dropdown-menu.compact .menu-item.compact:hover {
    background: #f5f5f5;
}

.profile-dropdown-menu.compact .menu-item.compact .menu-icon {
    font-size: 11px;
    width: 14px;
    opacity: 0.8;
}

.profile-dropdown-menu.compact .menu-item.compact .menu-label {
    font-size: 11px;
}

.profile-dropdown-menu.compact .menu-item.compact.logout-item {
    color: #d32f2f;
}

.profile-dropdown-menu.compact .menu-item.compact.logout-item:hover {
    background: #ffebee;
}
