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

.profile-section {
    position: relative;
    display: inline-block;
}

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

.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-14);
    color: var(--text-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);
}

.theme-toggle-item {
    padding: 8px 15px;
}

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

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

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

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

.item-dropdown-menu .dropdown-profile-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    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(--text-primary);
    margin-bottom: 2px;
    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-14);
    color: var(--text-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);
}

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

.item-dropdown-menu .dropdown-footer {
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
}

.item-dropdown-menu .footer-links {
    gap: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
}

.item-dropdown-menu .footer-link {
    font-size: var(--font-13);
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.item-dropdown-menu .footer-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

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

#themeSelector {
    min-width: 120px;
}

.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);
}

/* 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 */
@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: 0 -4px 12px rgba(0, 0, 0, 0.15);
        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 */
    }

    /* Handle container to match bottom_sheet.css structure */
    .bottom-sheet-handle {
        display: flex;
        justify-content: center;
        padding: 10px 0;
        width: 100%;
    }

    .bottom-sheet-handle .handle-two {
        width: 40px;
        height: 4px;
        background-color: var(--border-color);
        border-radius: 2px;
    }

    .item-dropdown-item {
        font-size: var(--font-15);
        padding: 12px 15px;
        /* Slightly larger targets for mobile */
    }

    /* 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;
    }
}

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