/* ===== HEADBAR UNIFORME PER TUTTE LE PAGINE ===== */
:root {
    --primary: #7f5af0;
    --secondary: #2cb67d;
    --bg: #16161a;
    --surface: #242629;
    --surface2: #1a1a22;
    --text: #fffffe;
    --text-muted: #94a1b2;
    --accent: #f5d90a;
    --danger: #ff5470;
    --radius: 18px;
    --shadow: 0 8px 32px 0 rgba(127,90,240,0.10);
}

/* Headbar Base */
.headbar {
    width: 100%;
    background: var(--surface2);
    box-shadow: 0 2px 12px 0 rgba(127,90,240,0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 62px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-sizing: border-box;
    overflow: visible;
}

.headbar .logo {
    font-size: 1.35em;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    letter-spacing: 1px;
    white-space: nowrap;
}

.headbar .nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.headbar .nav-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.08em;
    padding: 8px 18px;
    border-radius: 10px;
    transition: background 0.13s, color 0.13s;
    white-space: nowrap;
}

.headbar .nav-link:hover,
.headbar .nav-link.active {
    background: var(--primary);
    color: #fff;
}

.headbar .user-menu-container {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.headbar .user-btn {
    background: var(--primary);
    border: none;
    color: #fff;
    font-size: 1.08em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 18px;
    border-radius: 12px;
    transition: background 0.13s;
    min-width: 0;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 102;
}

.headbar .user-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90px;
    display: inline-block;
}

.headbar .user-btn:hover, 
.headbar .user-btn.active {
    background: #6d4ee6;
    color: #fff;
}

.headbar .user-dropdown {
    display: none;
    position: fixed;
    right: 32px;
    top: 70px;
    background: var(--surface);
    box-shadow: var(--shadow);
    border-radius: 12px;
    min-width: 180px;
    overflow: hidden;
    z-index: 1001;
    flex-direction: column;
    animation: fadeIn 0.18s;
}

.headbar .user-dropdown.show {
    display: flex;
}

.headbar .user-dropdown a {
    color: var(--text);
    text-decoration: none;
    padding: 14px 22px;
    font-size: 1.05em;
    font-weight: 500;
    background: none;
    border: none;
    text-align: left;
    transition: background 0.13s;
    cursor: pointer;
}

.headbar .user-dropdown a:hover {
    background: var(--primary);
    color: #fff;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.7em;
    margin-left: 10px;
    cursor: pointer;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px);}
    to { opacity: 1; transform: translateY(0);}
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 900px) {
    .headbar {
        padding: 0 20px;
    }
    
    .headbar .nav-links {
        gap: 12px;
    }
    
    .headbar .nav-link {
        font-size: 1em;
        padding: 7px 14px;
    }
}

@media (max-width: 700px) {
    .headbar {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        padding: 10px 10px;
        gap: 8px;
    }
    
    .headbar .nav-links {
        gap: 10px;
        width: 100%;
        justify-content: flex-start;
    }
    
    .headbar .nav-link {
        font-size: 1em;
        padding: 8px 12px;
    }
    
    .mobile-menu-btn {
        display: block;
        position: absolute;
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 600px) {
    .headbar {
        padding: 8px 8px;
    }
    
    .headbar .logo {
        font-size: 1.2em;
    }
    
    .headbar .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }
    
    .headbar .nav-link {
        width: 100%;
        text-align: left;
        padding: 12px 16px;
        border-radius: 0;
        border-bottom: 1px solid #23233a;
    }
    
    .headbar .nav-link:last-child {
        border-bottom: none;
    }
}

@media (max-width: 400px) {
    .headbar .logo {
        font-size: 1.1em;
    }
    
    .headbar .nav-link {
        font-size: 0.95em;
        padding: 10px 12px;
    }
}
