/* User Profile Widget */
.user-profile-widget {
    position: relative;
    display: inline-block;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.profile-trigger:hover {
    background: #f8fafc;
}

.fa-solid {
    font-size: 20px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
}

.profile-dropdown {
    display: none;
}

.profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
}

.profile-overlay.is-open {
    display: block;
}

.profile-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.profile-sheet {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(360px, 92vw);
    background: white;
    box-shadow: -10px 0 25px rgba(0, 0, 0, 0.25);
    overflow: auto;
    transform: translateX(100%);
    transition: transform 160ms ease-out;
}

.profile-overlay.is-open .profile-sheet {
    transform: translateX(0);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #333;
    color: white;
    border-radius: 12px 12px 0 0;
}

.profile-avatar-large {
    font-size: 32px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px;
    border-radius: 50%;
}

.dropdown-user-name {
    font-weight: 600;
    font-size: 16px;
}

.dropdown-user-email {
    font-size: 13px;
    opacity: 0.9;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 16px;
    color: #333333;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.profile-menu-item:hover {
    background: #f8fafc;
}

.profile-logout {
    color: #ef4444;
    font-weight: 500;
}

.menu-badge {
    background: #333;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.login-widget {
    display: flex;
    gap: 12px;
}

.login-btn,
.register-btn {
    padding: 6px 12px;
    border-radius: 16px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.login-btn {
    color: #333;
    border: 1px solid #333;
    background: white;
}

.register-btn {
    background: #333;
    color: white;
    border: 1px solid #333;
}

/* User Menu Trigger */
.user-menu-trigger {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.user-menu-trigger:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Cart Trigger */
.cart-trigger {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
    font-size: 1.2rem;
    color: #333;
}

.cart-trigger:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-avatar {
    font-size: 24px;
    display: block;
}

/* Dropdown a nuvoletta */
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 260px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Freccia della nuvoletta */
.dropdown-arrow {
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
}

/* Sezioni menu */
.menu-section {
    padding: 0px;
}

.menu-header {
    padding: 16px 20px 12px;
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

/* Header utente autenticato */
.menu-header .user-info {
    margin-left: 12px;
}

.menu-header .user-avatar-large {
    font-size: 32px;
}

.user-email {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

/* Voci menu trasformate in bottoni "pillola" */
    .menu-item {
        display: flex;
        align-items: center;
        justify-content: center; /* Centra il testo come nella foto */
        gap: 12px;
        padding: 12px 12px;      /* Più spazio interno per renderli "cicciotti" */
        margin: 8px 8px;           /* Spazio tra un bottone e l'altro */
        text-decoration: none;
        cursor: pointer;
        transition: all 0.2s ease;
        border-radius: 6px;     /* Bordi arrotondati stile pillola */
        width: auto;             /* Occupa tutta la larghezza del contenitore */
        font-size: 16px;         /* Leggermente più grande per leggibilità */
        font-weight: 600;
        box-sizing: border-box;
        color: #2d2d2d;          /* Grigio scuro per gli elementi del menu */
    }

    /* Colore grigio scuro per gli elementi del menu utente */
    .user-menu .menu-item {
        color: #2d2d2d;
    }

    .user-menu .menu-item:hover {
        background-color: #f5f5f5;
        color: #1a1a1a;
    }

        /* Stile specifico per "Accedi" (Bianco con bordo nero) */
        .btn-login-style {
            background-color: white;
            color: #333;
            border: 2px solid #333;
        }

        /* Stile specifico per "Registrati" (Nero riempito) */
        .btn-register-style {
            background-color: #333;
            color: white;
            border: 2px solid #333;
        }

        /* Effetti Hover per renderli interattivi */
        .btn-login-style:hover {
            background-color: #f0f0f0;
        }

        .btn-register-style:hover {
            background-color: #000;
        }

.menu-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

.menu-logout {
    color: #c62828;
    font-weight: 500;
}

.menu-logout:hover {
    background-color: #ffebee;
}

/* Header account container */
.header-account {
    position: relative;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .user-name {
        display: none;
    }

    .login-widget {
        width: 100%;
        justify-content: center;
        gap: 10px;
        margin-top: 10px;
        flex-wrap: wrap;
    }

    .login-widget .login-btn,
    .login-widget .register-btn {
        padding: 10px 14px;
        border-radius: 6px;
        font-size: 14px;
        line-height: 1;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .user-profile-widget {
        margin-top: 10px;
    }

    .profile-trigger {
        padding: 10px 14px;
        min-height: 44px;
    }
}