/* ===========================================
   Dropdown Menu Styles
   =========================================== */
.item-dropdown-container,
.profile-section {
    position: relative;
    display: inline-block;
}

.item-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 10;
    display: none;
    min-width: 200px;
    margin: 5px 0 0;
    font-size: var(--font-14);
    color: var(--black-primary);
    text-align: left;
    list-style: none;
    background-color: var(--white-primary);
    background-clip: padding-box;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.item-dropdown-menu.show {
    display: block !important;
    animation: fadeIn 0.2s ease;
}

/* Position dropdown above when there's not enough space below */
.item-dropdown-menu.show-above {
    top: auto;
    bottom: 100%;
    margin: 0 0 4px;
}

.item-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 15px;
    clear: both;
    font-size: var(--font-15);
    color: var(--black-secondary);
    text-align: inherit;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    font-weight: var(--font-weight-normal);
    font-family: var(--fontB);
    line-height: var(--line-height-normal);
}

.item-dropdown-menu .profile-dropdown-icon {
    width: 22px;
    height: 22px;
    fill: var(--black-secondary);
}

.item-dropdown-item:hover {
    background-color: var(--white-secondary);
}

/* Specific styles for Profile Dropdown */
.item-dropdown-menu .dropdown-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.item-dropdown-menu .dropdown-profile-image {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-circle);
    object-fit: cover;
    margin-right: 12px;
}

.item-dropdown-menu .dropdown-user-info {
    flex: 1;
    min-width: 0;
}

.item-dropdown-menu .full-name {
    font-weight: var(--font-weight-medium);
    font-size: var(--font-15);
    color: var(--black-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--fontH);
    line-height: var(--line-height-normal);
}

.item-dropdown-menu .user-name {
    font-size: var(--font-13);
    color: var(--black-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: var(--font-weight-normal);
    font-family: var(--fontBa);
    line-height: var(--line-height-normal);
    margin-top: 2px;
}

.item-dropdown-menu .user-email {
    display: block;
    margin-top: 2px;
    font-size: var(--font-13);
    color: var(--black-secondary);
}

/* Dropdown Widths */
#profileDropdown {
    width: 240px;
}

.dropdown-feedback,
.dropdown-logout {
    border-top: 1px solid var(--border-color);
}

.item-dropdown-divider {
    height: 1px;
    margin: 8px 0;
    overflow: hidden;
    background-color: var(--border-color);
}

.item-dropdown-menu .logout-item {
    color: #ef4444;
}

.item-dropdown-menu .logout-item .dropdown-text {
    color: inherit;
}

.item-dropdown-menu .logout-item .profile-dropdown-icon {
    fill: currentColor;
}

/* Specific item groupings as requested */
.item-dropdown-item.has-top-border {
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    padding-top: 14px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */

.item-dropdown-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   RESPONSIVE GLOBAL LAYOUT (Breakpoints)
   ============================================================ */

@media (max-width: 768px) {

    /* Hide profile image and dropdown on mobile */
    .profile-section {
        display: none;
    }

    .item-dropdown-menu {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        min-width: 100%;
        max-height: 80vh;
        margin: 0;
        border-radius: 15px 15px 0 0;
        border: none;
        box-shadow: var(--box-shadow);
        transform: translateY(100%);
        transition: none !important;
        /* Removed animation/effect as requested */
        display: block !important;
        /* Always display but use transform for visibility */
        visibility: hidden;
        padding-bottom: env(safe-area-inset-bottom, 20px);
        overflow-y: auto;
        z-index: 2000 !important;
        /* Higher z-index to ensure it is on top */
        padding: 0 0 12px 0;
    }

    .item-dropdown-menu.show {
        transform: translateY(0);
        visibility: visible;
        animation: none;
        /* Disable desktop fadeIn */
    }

    /* Global overlay for dropdowns on mobile - matching bottom_sheet.css */
    .dropdown-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--overlay-bg);
        z-index: 1000;
        /* Matching bottom-sheet-overlay */
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .dropdown-overlay.show {
        display: block;
        opacity: 1;
    }
}