/* ═══════════════════════════════════════════════════════════════════════
   ToolzVerse — Enhanced Navbar Styles
   Smooth Animations, Mobile Responsiveness, Modern Interactions
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Smooth Scroll Behavior ───────────────────────────────────────────── */
html {
    scroll-behavior: smooth;
}

/* ── Navbar Enhancements ─────────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border);
    z-index: 2000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
}

/* Scrolled State */
.navbar.scrolled {
    height: 64px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.06);
}

.navbar.scrolled .nav-logo-img {
    height: 28px;
}

/* Logo Enhancements */
.nav-logo-img {
    height: 32px;
    width: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    object-fit: contain;
}

.nav-logo-img:hover {
    transform: scale(1.03);
    filter: drop-shadow(0 4px 12px rgba(37, 99, 235, 0.12));
}

/* Nav Links with Underline Animation */
.nav-link {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: var(--r-md);
    text-decoration: none;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--grad-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* Mega Menu Enhancements */
.mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    min-width: 680px;
    max-width: 90vw;
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 20px;
}

.nav-item-dropdown:hover .mega-menu,
.universe-trigger:focus + .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Search Input Animation */
.mega-search-input {
    width: 100%;
    padding: 16px 20px 16px 56px;
    font-size: 0.95rem;
    border: 2px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.mega-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    transform: scale(1.01);
}

/* Tool Item Hover Effects */
.mega-tool-item-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-radius: var(--r-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.mega-tool-item-legend::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.05), transparent);
    transition: left 0.6s;
}

.mega-tool-item-legend:hover::before {
    left: 100%;
}

.mega-tool-item-legend:hover {
    background: var(--bg-secondary);
    transform: translateX(8px);
}

.tool-hover-arrow {
    transition: all 0.3s ease;
    opacity: 0.5;
}

.mega-tool-item-legend:hover .tool-hover-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* Mobile Menu Enhancements */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3000;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
}

/* Mobile Accordion Animation */
.mobile-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-accordion-item.active .mobile-accordion-content {
    max-height: 500px;
}

.mobile-accordion-trigger {
    transition: all 0.3s ease;
}

.mobile-accordion-trigger i {
    transition: transform 0.3s ease;
}

.mobile-accordion-item.active .mobile-accordion-trigger i {
    transform: rotate(180deg);
}

/* Hamburger Animation */
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 24px;
    height: 20px;
    position: relative;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.nav-mobile-toggle.active .hamburger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-mobile-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nav-mobile-toggle.active .hamburger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Tool Links */
.mobile-tool-link {
    display: block;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--r-sm);
    transition: all 0.3s ease;
    transform: translateX(-10px);
    opacity: 0;
    animation: slideInLeft 0.4s forwards;
}

.mobile-accordion-item.active .mobile-tool-link {
    animation-delay: calc(var(--index, 0) * 0.05s);
}

@keyframes slideInLeft {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.mobile-tool-link:hover {
    background: var(--bg-secondary);
    color: var(--accent);
    padding-left: 24px;
}

/* Responsive Enhancements */
@media (max-width: 1024px) {
    .mega-menu {
        min-width: 600px;
    }
}

@media (max-width: 768px) {
    .navbar {
        height: 64px;
    }
    
    .nav-logo-img {
        height: 28px;
    }
    
    .navbar.scrolled {
        height: 56px;
    }
    
    .navbar.scrolled .nav-logo-img {
        height: 24px;
    }
    
    .mobile-menu {
        max-width: 100%;
    }
}

/* Loading State for Navbar */
.navbar.loading {
    pointer-events: none;
}

.navbar.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--grad-primary);
    animation: loadingShimmer 1.5s infinite;
}

@keyframes loadingShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Micro-interactions */
.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-mobile-toggle {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--r-sm);
    transition: all 0.3s ease;
}

.nav-mobile-toggle:hover {
    background: var(--bg-secondary);
}

/* Focus States for Accessibility */
.nav-link:focus,
.universe-trigger:focus,
.nav-mobile-toggle:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .navbar,
    .mega-menu,
    .mobile-menu,
    .nav-link,
    .tool-hover-arrow,
    .hamburger span {
        transition: none;
    }
    
    html {
        scroll-behavior: auto;
    }
}
