/* Un solo menu del profilo per tutte le pagine. Richiede theme.css. */
.profile-menu {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.profile-menu__trigger {
    box-sizing: border-box;
    width: 46px;
    height: 46px;
    padding: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.profile-menu__trigger:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.profile-menu__panel {
    box-sizing: border-box;
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    width: 260px;
    max-width: calc(100vw - 32px);
    padding: 8px;
    background: var(--surface);
    box-shadow: var(--surface-shadow), 0 12px 28px rgba(17, 24, 39, 0.14);
    border-radius: var(--surface-radius);
    overflow: hidden;
    z-index: 1001;
}

.profile-menu__panel[hidden] { display: none; }
.profile-menu__panel:not([hidden]) { animation: profileMenuIn 0.2s ease; }

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

.profile-menu__header {
    padding: 12px 12px 16px;
    color: #111827;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-wrap: anywhere;
}

.profile-menu__label {
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.profile-menu__name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.profile-menu__item {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 12px;
    border-radius: var(--surface-box-radius);
    background: var(--surface-recessed);
    box-shadow: var(--surface-recessed-shadow);
    color: #374151;
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
    border: 0;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.profile-menu__item + .profile-menu__item { margin-top: 8px; }
.profile-menu__item svg { flex-shrink: 0; width: 20px; height: 20px; }

.profile-menu__item:hover,
.profile-menu__item:focus-visible {
    background: linear-gradient(180deg, #e4e0fb, #eeeaff);
    color: #5b46a2;
}

.profile-menu__item--logout { color: #dc2626; }
.profile-menu__item--logout:hover,
.profile-menu__item--logout:focus-visible {
    background: linear-gradient(180deg, #f8dde3, #fcebed);
    color: #dc2626;
}

.profile-menu__trigger:focus-visible,
.profile-menu__item:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
    .profile-menu__panel:not([hidden]) { animation: none; }
    .profile-menu__trigger { transition: none; }
}
