/* DROPDOWN MENU - FIXED FOR PROPER VISIBILITY CONTROL */

/* Dropdown Container */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Dropdown Menu */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    min-width: 220px;
    max-width: 280px;
    padding: 8px;
    margin-top: 10px;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Show dropdown when .show class is added */
.dropdown-menu.show {
    display: block !important;
}

/* Dropdown Header */
.dropdown-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.dropdown-header img {
    margin-bottom: 8px;
    display: block;
}

/* Dropdown Divider */
.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

/* Dropdown Links - DEFAULT VISIBLE */
.dropdown-menu a,
#user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 2px 0;
    min-height: 38px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.95rem;
}

.dropdown-menu a:hover,
#user-dropdown a:hover {
    background: var(--accent-color);
    color: white;
    transform: translateX(3px);
}

.dropdown-menu a i,
#user-dropdown a i {
    width: 18px;
    text-align: center;
    font-size: 1rem;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    .dropdown-menu {
        min-width: 200px;
        right: -10px;
        max-height: 60vh;
        /* Allow scrolling on mobile */
        overflow-y: auto;
    }

    .dropdown-menu a {
        padding: 8px 10px;
        /* Smaller padding on mobile */
        font-size: 0.85rem;
    }

    /* Badges in header */
    .dropdown-header span,
    .dropdown-header .badge {
        font-size: 0.7rem !important;
        padding: 2px 6px !important;
    }
}

/* General Dropdown Fixes for PC overflow */
.dropdown-menu {
    max-height: 75vh;
    overflow-y: auto;
    scrollbar-width: thin;
    /* Firefox */
}

/* Webkit scrollbar for dropdown */
.dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.dropdown-menu::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: var(--border-color);
}

.dropdown-menu a {
    /* Compact buttons */
    padding: 8px 12px;
    min-height: 32px;
    font-size: 0.9rem;
}

/* Compact Header */
.dropdown-header {
    padding: 8px;
}

.dropdown-header img {
    width: 35px !important;
    /* Slightly smaller avatar */
    height: 35px !important;
    margin-bottom: 5px;
}

/* Profile Badges Container in Dropdown */
.dropdown-header #dropdown-role {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
}

/* Badges styling if they are spans/badges */
.dropdown-header #dropdown-role span,
.dropdown-header .user-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}