/* ====================================================================
   ✅ User Menu Dropdown - قائمة المستخدم المنسدلة الاحترافية
   ==================================================================== */

.user-menu-container {
    position: relative;
    z-index: 1000;
}

/* ✅ زر القائمة الرئيسي */
.user-menu-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-menu-button:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.user-menu-button:active {
    transform: scale(0.98);
}

/* ✅ صورة المستخدم (Avatar) */
.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar .material-icons {
    color: white;
    font-size: 24px;
}

/* ✅ معلومات المستخدم */
.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 120px;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.user-role {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}

.dropdown-arrow {
    font-size: 20px !important;
    color: #9ca3af;
    transition: transform 0.2s ease;
}

/* ✅ القائمة المنسدلة */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
    z-index: 2000;
    animation: dropdownFadeIn 0.15s ease-out;
    overflow: hidden;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-header {
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
}

.dropdown-body {
    padding: 8px;
}

/* ✅ عناصر القائمة */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: #374151;
    font-size: 14px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: right;
}

.dropdown-item:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.dropdown-item .material-icons {
    font-size: 20px;
    color: #6b7280;
}

.dropdown-item:hover .material-icons {
    color: #4b5563;
}

/* ✅ العنصر النشط (المنشأة الحالية) */
.dropdown-item.active {
    background: #eff6ff;
    color: #1e40af;
    font-weight: 600;
}

.dropdown-item.active .material-icons {
    color: #3b82f6;
}

/* ✅ زر تسجيل الخروج */
.dropdown-item.logout-item {
    color: #dc2626;
    margin-top: 4px;
}

.dropdown-item.logout-item:hover {
    background: #fef2f2;
}

.dropdown-item.logout-item .material-icons {
    color: #dc2626;
}

/* ✅ الفاصل */
.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 0;
}

/* ✅ عنوان القسم */
.dropdown-section-title {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ✅ Responsive للأجهزة الصغيرة */
@media (max-width: 768px) {
    .user-menu-button {
        padding: 6px 10px;
        gap: 8px;
    }

    .user-info {
        display: none; /* إخفاء النص على الموبايل، فقط الأيقونة */
    }

    .dropdown-arrow {
        display: none; /* إخفاء السهم على الموبايل */
    }

    .user-dropdown-menu {
        left: auto;
        right: 0;
        min-width: 260px;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .user-avatar .material-icons {
        font-size: 20px;
    }
}

/* ✅ RTL Support */
[dir="rtl"] .user-dropdown-menu {
    left: 0;
    right: auto;
}

[dir="rtl"] .user-menu-button {
    flex-direction: row-reverse;
}

/* ✅ Close dropdown when clicking outside */
.user-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1999;
    background: transparent;
}



