/* Base Navbar Styles */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 2000;
    transition: transform 0.3s ease, all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    border-bottom-color: transparent;
}

header.hidden {
    transform: translateY(-100%);
}

.navbar {
    max-width: 100%;
    margin: 0 auto;
    padding: 6px 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main, #0B192C);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.8px;
    transition: transform 0.3s ease;
    margin-right: 1rem;
}

.logo:hover {
    transform: scale(1.02);
}

.logo-ai {
    background: linear-gradient(135deg, #0052CC 0%, #00C6FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-left: -2px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(241, 245, 249, 0.6);
    padding: 3px 6px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.5);
    flex-wrap: wrap;
    justify-content: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted, #475569);
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.75rem;
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: 999px;
}

.nav-links a:hover {
    color: var(--primary, #0052CC);
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Info Pill Button Styles - Increased Specificity */
.nav-links a.info-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px 7px 10px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #0052CC, #0070f3);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow: 0 4px 14px rgba(0, 82, 204, 0.35);
    text-decoration: none;
    line-height: normal;
    margin-left: 6px;
    transition: all 0.3s ease;
}

/* Nav Dropdown */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropbtn {
    background-color: transparent;
    color: var(--text-main, #334155);
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 999px;
    transition: all 0.2s;
    font-family: inherit;
}

/* Updated hover state for non-scrolled (transparent header) */
.nav-dropdown:hover .nav-dropbtn {
    color: var(--primary, #0052CC);
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Updated hover state for scrolled header */
.scrolled .nav-dropdown:hover .nav-dropbtn {
    color: var(--primary, #0052CC);
    background: #F0F9FF;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-radius: 16px;
    z-index: 1000;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Invisible bridge to prevent hover loss */
.nav-dropdown-content::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    height: 15px;
    background: transparent;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.nav-dropdown-content a {
    color: #334155 !important;
    padding: 10px 16px !important;
    text-decoration: none;
    display: block;
    font-size: 0.9rem !important;
    border-radius: 10px !important;
    font-weight: 500 !important;
    text-align: center; /* Aggiunto per centrare i testi dei sottomenu */
}

.nav-dropdown-content a:hover {
    background-color: #F8FAFC !important;
    color: var(--primary, #0052CC) !important;
}

.info-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px 7px 10px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #0052CC, #0070f3);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow: 0 4px 14px rgba(0, 82, 204, 0.35);
    text-decoration: none;
    line-height: normal;
    margin-left: 6px;
    transition: all 0.3s ease;
}

.nav-links a.info-pill:hover {
    background: linear-gradient(135deg, #003D99, #0052CC);
    box-shadow: 0 6px 20px rgba(0, 82, 204, 0.45);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Chat Pill Button Styles */
.nav-links button.chat-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px 7px 10px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
    cursor: pointer;
    line-height: normal;
    margin-left: 6px;
    transition: all 0.3s ease;
}

.nav-links button.chat-pill:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
    color: #ffffff;
    transform: translateY(-1px);
}

.chat-pill-circle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
}

.chat-pill-text {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
}

.info-pill-circle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
}

.info-pill-mini {
    font-size: 0.48rem;
    letter-spacing: 0.2em;
    margin-top: 2px;
}

.info-pill-text {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
}

/* Hamburger Styles */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.8);
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    padding: 8px;
    z-index: 2002;
    margin-left: auto;
    transition: all 0.3s ease;
}

.hamburger:hover {
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.hamburger span {
    width: 100%;
    height: 2.5px;
    background: var(--text-main, #0B192C);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center;
}

/* Mobile Menu Styles */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%; /* Reduced width */
    max-width: 280px; /* Reduced max-width further */
    height: 100vh;
    background: rgba(255, 255, 255, 0.98); /* Increased checking opacity */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -10px 0 40px rgba(0,0,0,0.1);
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2001;
    padding: 45px 0 20px 0; /* Reduced top padding */
    display: flex;
    flex-direction: column;
    gap: 0; /* No gap between items */
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    overflow-y: auto;
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav > * {
    padding-left: 4px; /* Reduced side padding */
    padding-right: 4px;
}

.mobile-nav a {
    font-size: 0.95rem; /* Smaller font */
    font-weight: 600;
    color: var(--text-main, #0f172a);
    text-decoration: none;
    padding: 8px 12px; /* reduced link padding significantly */
    border-radius: 8px; /* smaller radius */
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px; /* Reduced icon gap */
    margin-bottom: 2px; /* Tiny margin between links */
}

.mobile-nav a:hover, .mobile-nav a:active {
    color: var(--primary, #0052CC);
    background: #F0F9FF;
    border-color: #BAE6FD;
    transform: translateX(4px);
}

/* Close menu button - inside mobile-nav at top */
.mobile-nav .close-menu {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    color: #64748B;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

#mobileCategoryLinks {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding-right: 6px;
}

.mobile-nav .close-menu:hover {
    background: #E2E8F0;
    color: #0F172A;
    transform: rotate(90deg);
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.mobile-overlay.active {
    visibility: visible;
    opacity: 1;
}

/* Media Query for Responsive Navbar */
@media (max-width: 992px) {
    .nav-links {
        display: none;
    }
    .hamburger {
        display: flex;
    }
    .navbar {
        padding: 8px 12px;
    }
}

@media (max-width: 768px) {
    .logo {
        font-size: 1.1rem;
    }
    .nav-links a {
        font-size: 0.7rem;
        padding: 4px 7px;
    }
}

/* Fix for menu visibility on desktop */
@media (min-width: 993px) {
    .mobile-nav, .mobile-overlay {
        display: none !important;
    }
}

.mobile-nav-dropdown-title { margin-top: 5px !important; margin-bottom: 2px !important; padding-left: 8px !important; font-size: 0.8rem !important; }
