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

.profile-image {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    object-fit: cover;
    transition: all 0.3s ease;
    vertical-align: middle;
    border: 2px solid transparent;
}

[data-theme="dark"] .profile-image {
    filter: brightness(0) saturate(100%) invert(93%) sepia(8%) saturate(382%) hue-rotate(322deg) brightness(103%) contrast(93%);
    opacity: 0.9;
}

.profile-image:hover {
    transform: scale(1.05);
    border-color: var(--nav-text);
}

.dropdown-menu {
    position: fixed;
    top: 121px;
    right: 20px;
    background-color: var(--bg-color) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border-radius: 12px;
    min-width: 200px;
    display: none;
    z-index: 99999;
    border: 1px solid var(--border-color);
    transition: opacity 0.2s ease-out, background-color 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.dropdown-menu.show {
    display: block;
    opacity: 1;
    visibility: visible;
}

.dropdown-item {
    padding: 12px 20px;
    text-decoration: none;
    color: var(--nav-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: Poppins;
    letter-spacing: 2px;
    font-size: 14px;
    text-align: center;
    white-space: nowrap;
    background-color: var(--bg-color) !important;
    width: 100%;
    border: none;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: rgba(0, 153, 255, 0.1);
    color: var(--primary-color);
}

.dropdown-item:first-child {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.dropdown-item:last-child {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.dropdown-icon {
    width: 24px;
    height: 24px;
    display: block;
    margin: 0 auto;
}

[data-theme="dark"] .dropdown-icon {
    filter: brightness(0) saturate(100%) invert(93%) sepia(8%) saturate(382%) hue-rotate(322deg) brightness(103%) contrast(93%);
    opacity: 0.9;
}

[data-theme="dark"] .dropdown-item img,
[data-theme="dark"] .profile-container img {
    filter: invert(92%) sepia(11%) saturate(456%) hue-rotate(334deg) brightness(103%) contrast(94%);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--nav-bg) !important;
}

/* Desktop styles for wider screens */
@media (min-width: 800px) {
    .dropdown-menu {
        position: fixed;
        top: 121px;
        right: 20px;
        min-width: 200px;
    }
}

/* Mobile styles with adjusted breakpoint */
@media (max-width: 799px) {
    .profile-container {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 0;
        padding: 0;
        background-color: var(--bg-color) !important;
    }
    
    .dropdown-menu {
        position: static;
        width: 100%;
        margin: 0;
        padding: 0;
        border: none;
        box-shadow: none;
        background: none;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease-out;
    }
    
    .dropdown-menu.show {
        opacity: 1;
        visibility: visible;
        display: block;
    }
    
    .dropdown-item.mobile-menu-item {
        padding: 15px 20px;
        text-align: center;
        background-color: var(--bg-color) !important;
        border-top: 1px solid var(--border-color);
        margin: 0;
        font-family: Poppins;
        letter-spacing: 4px;
        font-size: 15px;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 60px;
        width: 100%;
    }
    
    .profile-image {
        width: 32px;
        height: 32px;
        margin: 15px 0;
    }

    .dropdown-icon {
        width: 28px;
        height: 28px;
        margin: 0 auto;
        padding: 0;
        display: block;
    }

    /* Center all menu items and icons */
    .header li a,
    .header li .profile-container,
    .dropdown-item.mobile-menu-item {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header li a img,
    .header li .profile-container img,
    .dropdown-icon {
        margin: 0 auto;
    }

    .dropdown-menu .dropdown-divider {
        display: none;
    }

    /* Remove any border radius in mobile view */
    .dropdown-item:first-child,
    .dropdown-item:last-child {
        border-radius: 0;
    }

    /* Match the hover effect with the main menu */
    .dropdown-item.mobile-menu-item:hover {
        background-color: var(--bg-color);
        color: var(--primary-color);
    }

    /* Ensure proper menu behavior */
    .header .menu {
        max-height: 0;
        transition: max-height .3s ease-out;
        overflow: hidden;
    }

    .header .menu-btn:checked ~ .menu {
        max-height: none;
        height: auto;
        overflow: visible;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }

    /* Fix the menu background */
    .header .menu,
    .header li,
    .dropdown-item.mobile-menu-item {
        background-color: #F5E6D3 !important;
    }

    /* Add transition class for view changes */
    .view-transition {
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease-out;
    }
}
