.profile-container {
    width: 100%;
    position: relative;
    padding: 0;
    margin: 0;
}

.sidebar-info-links {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    padding: 0.25rem 0.75rem 0.45rem;
    gap: 0.4rem;
    white-space: nowrap;
}

#sidebar.deployed .sidebar-info-links {
    display: flex;
}

.sidebar-info-links a {
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.2;
    text-decoration: none;
    opacity: 0.72;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.sidebar-info-links > span {
    color: var(--text-muted);
    font-size: 0.62rem;
    opacity: 0.45;
}

.sidebar-info-links a:hover,
.sidebar-info-links a:focus-visible {
    background: transparent !important;
    color: var(--text-muted);
    opacity: 0.72;
}

.profile {
    display: flex;
    align-items: center;
    padding: 0.5em 1.25em; /* Match sidebar links padding */
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    color: var(--text-color);
    text-decoration: none;
    box-sizing: border-box;
    width: 100%;
    user-select: none;
}

.profile:hover {
    background-color: var(--primary-background);
}

.profile .avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1em;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

.profile .avatar .sidebar-avatar-pdp {
    width: 2rem;
    height: 2rem;
    font-size: 0.82rem;
}

.sidebar-notif-dot {
    position: absolute;
    top: -0.15rem;
    right: -0.15rem;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    background: #ff3b30;
    border: 2px solid var(--header-background);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    z-index: 2;
}

.sidebar-notif-dot.is-hidden {
    display: none;
}

.profile > span {
    white-space: nowrap;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, max-width 0.3s ease;
    pointer-events: none;
    font-size: 0.95rem;
    font-weight: 500;
}

#sidebar.deployed .profile > span {
    opacity: 1;
    max-width: 200px;
    transform: translateX(0);
    pointer-events: auto;
}

/* Dropdown Menu */
.profile-menu {
    position: absolute;
    bottom: 100%;
    left: 10px;
    width: min(240px, calc(100vw - 2rem));
    background-color: var(--card-bg); /* Use card-bg for menus */
    border: 1px solid var(--border-hard);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    z-index: 10001;
    margin-bottom: 12px;
    backdrop-filter: none;
    /* Animation */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.profile-container.active .profile-menu {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.profile-menu a,
.profile-menu .profile-menu-link {
    padding: 0.6rem 1.25rem; /* Match sidebar links horizontal padding */
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.9rem;
    border-radius: var(--border-radius-sm, 8px);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s, color 0.2s;
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    justify-content: flex-start;
    overflow: hidden;
    font-family: inherit;
    line-height: inherit;
}

.profile-menu-notif-link {
    display: flex !important;
    align-items: center;
    gap: 12px;
}

.profile-menu-notif-link > svg {
    flex-shrink: 0;
}

.profile-menu a:hover,
.profile-menu .profile-menu-link:hover {
    background-color: var(--hover-bg);
}

.profile-menu a:hover svg,
.profile-menu .profile-menu-link:hover svg {
    opacity: 1;
}

.profile-menu a svg,
.profile-menu .profile-menu-link svg {
    width: 18px;
    height: 18px;
    opacity: 0.8;
    stroke: currentColor;
    transition: all 0.2s ease;
}

.profile-menu a svg:not([fill="none"]),
.profile-menu .profile-menu-link svg:not([fill="none"]) {
    fill: currentColor;
}

.profile-menu a.has-unread-notif {
    color: var(--primary-color);
}

.profile-menu-notif-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.profile-menu-label {
    display: inline-block;
    flex: 1;
    min-width: 0;
    color: inherit;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 1;
}

.profile-menu-notif-dot {
    margin-left: auto;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #ff3b30;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.profile-menu-notif-dot.is-hidden {
    display: none;
}

.profile-menu-notif-badge {
    margin-left: auto;
    min-width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    background: #ff3b30;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.28rem;
    line-height: 1;
    flex-shrink: 0;
}

.profile-menu-notif-badge.is-hidden {
    display: none;
}

.profile-menu a.logout {
    color: #ff6b6b;
    margin-top: 4px;
    border-top: 1px solid var(--border-hard);
    padding-top: 0.75rem;
}

.profile-menu a.logout:hover {
    background-color: rgba(255, 107, 107, 0.1);
}

.profile-menu a.logout svg {
    stroke: currentColor;
}

.profile-menu-theme-switcher {
    position: relative;
    margin: 0;
    padding: 0;
}

.profile-menu-theme-trigger {
    font-weight: 400;
    position: relative;
    user-select: none;
    padding-right: 2.6rem !important;
}

/* Ensure THEME trigger doesn't have default styles */
.profile-menu-link {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    text-decoration: none;
    cursor: pointer;
}

/* Theme-specific styles matched with main items */

.profile-menu-theme-chevron {
    display: block;
    width: 16px;
    height: 16px;
    opacity: 0.6;
    position: absolute;
    right: 1.25rem; /* Match the link's horizontal padding */
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    stroke: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.profile-menu-theme-current {
    flex: 1;
    min-width: 0;
    display: inline-flex !important;
    align-items: center;
    color: inherit;
    font-size: 0.9rem !important;
    white-space: nowrap;
    opacity: 1 !important;
    max-width: none !important;
    transform: none !important;
    pointer-events: auto !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu-theme-switcher.is-open .profile-menu-theme-chevron {
    transform: translateY(-50%) translateX(4px);
    opacity: 1;
}

.profile-menu-theme-panel {
    position: absolute;
    left: calc(100% + 0.7rem);
    top: auto;
    bottom: -0.2rem;
    display: none;
    flex-direction: column;
    z-index: 10002;
    background-color: var(--card-bg);
    border: 1px solid var(--border-hard);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    gap: 0.35rem;
    width: 280px;
    min-height: min(320px, calc(100vh - 2rem));
    max-height: min(320px, calc(100vh - 2rem));
    overflow: hidden;
    backdrop-filter: none;
}

.profile-menu-theme-switcher.is-open .profile-menu-theme-panel {
    display: flex;
}

.profile-menu-theme-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.4rem 0.5rem;
}

.profile-menu-theme-search {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-primary);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    color: var(--text-color);
    outline: none;
    box-shadow: none;
    transition: border-color 0.2s;
}

.profile-menu-theme-search:focus {
    border-color: var(--primary-color);
}

.profile-menu-theme-search::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.profile-menu-theme-scroll {
    flex: 1;
    min-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 0.2rem;
    scroll-behavior: smooth;
}

.profile-menu-theme-scroll::-webkit-scrollbar {
    width: 4px;
}

.profile-menu-theme-scroll::-webkit-scrollbar-thumb {
    background: var(--border-hard);
    border-radius: 10px;
}

.profile-menu-theme-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.profile-menu-theme-group-title {
    margin: 0;
    padding: 0 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    opacity: 0.8;
}

/* Deprecated, now using .profile-menu-theme-item with .is-active */

.profile-menu-theme-item {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.9rem;
    padding: 0.6rem 1.25rem; /* Consistently match padding */
    border-radius: var(--border-radius-sm, 8px);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s ease;
}

.profile-menu-theme-item:hover,
.profile-menu-theme-item.is-active {
    background-color: var(--hover-bg);
}

.profile-menu-theme-dot {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-hard);
    position: relative;
    flex-shrink: 0;
}

.profile-menu-theme-dot svg {
    width: 100%;
    height: 100%;
    padding: 0.28rem;
    opacity: 0.9;
}

.profile-menu-theme-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.profile-menu-theme-status {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    opacity: 0.8;
}

.profile-menu-theme-item.is-hidden {
    display: none;
}

#profile-theme-recent-list .profile-menu-theme-item.is-history-hidden {
    display: none;
}

.profile-menu-theme-empty {
    margin: 0;
    padding: 0.45rem 1.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.8;
}

@media (max-width: 768px) {
    .profile-menu {
        width: min(220px, calc(100vw - 1.5rem));
        left: 20px;
        bottom: 80px;
        /* Adjust for bottom bar or similar if exists, but mostly standard */
    }

    .profile-menu-theme-panel {
        position: fixed;
        left: 2.25rem;
        right: auto;
        bottom: 94px;
        top: auto;
        width: 260px;
        min-height: 220px;
        max-height: min(280px, calc(100vh - 1.5rem));
    }
}
