/**
 * User Profile Header Styles
 * أنماط هيدر الملف الشخصي للمستخدم
 * Purple & Gold Color Scheme
 */

/* Color Variables */
:root {
    --purple-primary: #8B5CF6;
    --purple-secondary: #A855F7;
    --purple-dark: #7C3AED;
    --purple-light: #C4B5FD;
    --gold-primary: #F59E0B;
    --gold-secondary: #FBBF24;
    --gold-dark: #D97706;
    --gold-light: #FDE68A;
}

/* User Profile Menu - Desktop */
.user-profile-menu {
    position: relative;
    display: inline-block;
}

.user-profile-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(245, 158, 11, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 200px;
}

.user-profile-toggle:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(245, 158, 11, 0.2));
    border-color: var(--gold-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3), 0 4px 15px rgba(245, 158, 11, 0.2);
}

/* User Avatar */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--gold-primary);
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.user-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--purple-primary), var(--gold-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

/* User Info */
.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 400;
}

.dropdown-arrow {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    transition: transform 0.3s ease;
}

.user-profile-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* User Dropdown Menu */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 
        0 20px 40px rgba(139, 92, 246, 0.15),
        0 10px 20px rgba(245, 158, 11, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid rgba(139, 92, 246, 0.2);
    overflow: hidden;
}

.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Header */
.dropdown-header {
    padding: 24px;
    background: linear-gradient(135deg, var(--purple-primary), var(--gold-primary));
    color: white;
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--gold-secondary);
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

.user-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder-large {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.user-details h4 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
}

.user-details p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Dropdown Links */
.dropdown-links {
    list-style: none;
    margin: 0;
    padding: 12px 0;
}

.dropdown-links li {
    margin: 0;
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
}

.dropdown-link:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--purple-primary);
    transform: translateX(4px);
}

.dropdown-link i {
    width: 18px;
    text-align: center;
    opacity: 0.7;
}

.dropdown-link:hover i {
    opacity: 1;
}

/* Dropdown Divider */
.dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg, var(--purple-light), var(--gold-light), var(--purple-light));
    margin: 8px 0;
    opacity: 0.3;
}

/* Dropdown Footer */
.dropdown-footer {
    padding: 12px 24px 24px;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(217, 119, 6, 0.1);
    color: var(--gold-dark);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.logout-btn:hover {
    background: var(--gold-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Mobile User Profile */
.mobile-user-profile {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(245, 158, 11, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.mobile-user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--gold-primary);
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.mobile-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--purple-primary), var(--gold-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.mobile-user-details {
    flex: 1;
    min-width: 0;
}

.mobile-user-details h4 {
    margin: 0 0 4px 0;
    color: white;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-user-details p {
    margin: 0 0 4px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-user-role {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Mobile User Actions */
.mobile-user-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.mobile-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.mobile-action-btn.dashboard-btn:hover {
    background: var(--purple-primary);
}

.mobile-action-btn.profile-btn:hover {
    background: var(--purple-secondary);
}

.mobile-action-btn.logout-btn {
    background: rgba(217, 119, 6, 0.2);
    color: var(--gold-dark);
    margin-top: 8px;
}

.mobile-action-btn.logout-btn:hover {
    background: var(--gold-primary);
    color: white;
}

.mobile-action-btn i {
    width: 18px;
    text-align: center;
}

/* RTL Support */
[dir="rtl"] .user-profile-toggle {
    flex-direction: row-reverse;
}

[dir="rtl"] .user-dropdown-menu {
    right: auto;
    left: 0;
}

[dir="rtl"] .dropdown-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .dropdown-link {
    flex-direction: row-reverse;
}

[dir="rtl"] .dropdown-link:hover {
    transform: translateX(-4px);
}

[dir="rtl"] .mobile-user-info {
    flex-direction: row-reverse;
}

[dir="rtl"] .mobile-action-btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .mobile-action-btn:hover {
    transform: translateX(-4px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .user-profile-menu {
        display: none;
    }
    
    .mobile-user-profile {
        display: block;
    }
}

@media (min-width: 769px) {
    .mobile-user-profile {
        display: none;
    }
}

/* Animation for dropdown */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown-menu.active {
    animation: slideDown 0.3s ease;
}

/* Focus states for accessibility */
.user-profile-toggle:focus,
.dropdown-link:focus,
.mobile-action-btn:focus,
.logout-btn:focus {
    outline: 2px solid var(--purple-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .user-profile-toggle {
        border-color: white;
        background: rgba(0, 0, 0, 0.8);
    }
    
    .user-dropdown-menu {
        border-color: black;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    }
    
    .dropdown-link:hover {
        background: black;
        color: white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .user-profile-toggle,
    .dropdown-link,
    .mobile-action-btn,
    .logout-btn {
        transition: none;
    }
    
    .user-dropdown-menu {
        transition: opacity 0.1s ease;
    }
    
    .user-dropdown-menu.active {
        animation: none;
    }
}
