/**
 * User Menu Styles - Apple Style
 * 
 * Stile elegante per il menu utente ispirato al design Apple
 * Version: 1.1.0
 * 
 * Changelog:
 * - 1.1.0: Aggiunta area invisibile per collegare il pulsante al dropdown e ridotto lo spazio tra i due elementi
 */

/* ===== USER MENU STYLES ===== */
.user-menu {
    position: relative;
    margin-left: 1rem;
}

/* Apple Style Button */
.apple-style-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(209, 213, 219, 0.3);
    border-radius: 20px;
    padding: 0.4rem 0.75rem 0.4rem 0.4rem;
    font-size: 0.9rem;
    color: var(--dark);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.apple-style-button:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.apple-style-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* User Avatar */
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-name {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
}

.chevron-icon {
    margin-left: 0.25rem;
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.user-menu-toggle:hover .chevron-icon {
    opacity: 0.9;
}

.user-menu.active .chevron-icon {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% - 5px); /* Ridotto lo spazio tra pulsante e dropdown */
    right: 0;
    width: 220px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 
                0 2px 5px rgba(0, 0, 0, 0.05),
                0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    list-style: none;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.25s cubic-bezier(0.3, 0, 0.2, 1);
    overflow: hidden;
}

/* Aggiungiamo un'area invisibile per collegare il pulsante al dropdown */
.user-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 15px; /* Altezza dell'area di collegamento */
    background: transparent;
}

.user-menu.active .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown li {
    margin: 0;
    padding: 0;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    color: var(--dark);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.user-dropdown a svg {
    opacity: 0.7;
    transition: all 0.15s ease;
}

.user-dropdown a:hover {
    background: rgba(0, 0, 0, 0.05);
}

.user-dropdown a:hover svg {
    opacity: 1;
}

.dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 0.5rem 0;
}

/* Mobile User Menu */
.mobile-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.75rem 0;
    width: 100%;
}

.mobile-nav-link svg {
    margin-right: 0.75rem;
    opacity: 0.8;
}

.mobile-nav-logout {
    color: #ef4444 !important;
}

.mobile-nav-logout svg {
    color: #ef4444;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-top: 1rem;
}

.mobile-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gold);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.mobile-user-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
}

/* JavaScript Toggle */
.user-menu-toggle:focus {
    outline: none;
}

/* ===== WINE CLUB CART STYLES ===== */
.cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #d4af37;
    border: 2px solid #d4af37;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
    margin-right: 0.75rem;
    cursor: pointer;
    border: none;
    outline: none;
}

.cart-icon:hover {
    background: #c19d2e;
    border-color: #c19d2e;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
}

.cart-icon:active {
    transform: translateY(-1px);
    background: #b8941f;
    border-color: #b8941f;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.5);
}

.cart-icon:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.3);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #2c2c2c;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Mobile Wine Club Cart */
.wine-club-cart-mobile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
}

.wine-club-cart-mobile:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.mobile-cart-count {
    background: #2c2c2c;
    color: white;
    border: 2px solid #d4af37;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 18px;
    margin-left: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Media Queries */
@media (max-width: 768px) {
    .user-menu {
        display: none;
    }
    
    .cart-icon {
        display: none;
    }
}