/* Navigation Bar Styles */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

[data-theme="dark"] .navbar {
    background: rgba(10, 10, 10, 0.95);
}

/* Navbar scrolled state */
.navbar.scrolled {
    height: 60px;
    box-shadow: var(--shadow-lg);
}

/* Navbar hidden state (scroll down) */
.navbar.hidden {
    transform: translateY(-100%);
}

.nav-container {
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo Styles */
.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
    z-index: 1001;
}

.nav-logo:hover {
    transform: scale(1.05);
}

.logo-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-dot {
    color: var(--accent-color);
    font-size: 2rem;
    margin-left: 2px;
}

/* Desktop Menu */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--accent-color);
}

.nav-link.active {
    color: var(--accent-color);
}

/* Animated underline */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Mobile Theme Toggle in Navbar */
.theme-toggle-mobile {
    display: none;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.theme-toggle-mobile:hover {
    transform: scale(1.1);
    border-color: var(--accent-color);
}

.theme-toggle-mobile svg {
    width: 20px;
    height: 20px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: absolute;
}

.theme-toggle-mobile .sun-icon {
    color: var(--text-primary);
}

.theme-toggle-mobile .moon-icon {
    color: var(--text-primary);
    opacity: 0;
    transform: rotate(180deg);
}

[data-theme="dark"] .theme-toggle-mobile .sun-icon {
    opacity: 0;
    transform: rotate(180deg);
}

[data-theme="dark"] .theme-toggle-mobile .moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Mobile Menu Toggle - Enhanced Animation */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 35px;
    height: 35px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
}

.hamburger {
    width: 28px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: absolute;
}

/* Hamburger default positions */
.hamburger:nth-child(1) {
    top: 8px;
}

.hamburger:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger:nth-child(3) {
    bottom: 8px;
}

/* Hover effect - lines spread apart slightly */
.nav-toggle:hover .hamburger:nth-child(1) {
    top: 6px;
}

.nav-toggle:hover .hamburger:nth-child(3) {
    bottom: 6px;
}

.nav-toggle:hover .hamburger {
    background: var(--accent-color);
}

/* Active state - X formation */
.nav-toggle.active .hamburger:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    background: var(--accent-color);
}

.nav-toggle.active .hamburger:nth-child(2) {
    opacity: 0;
    transform: translateY(-50%) scale(0);
}

.nav-toggle.active .hamburger:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
    background: var(--accent-color);
}

/* Add a circular background on hover */
.nav-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 45px;
    height: 45px;
    background: var(--bg-secondary);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.3s ease;
    z-index: -1;
}

.nav-toggle:hover::before {
    transform: translate(-50%, -50%) scale(1);
}

/* Responsive Styles */
@media screen and (max-width: 768px) {
    .navbar {
        height: 60px;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .theme-toggle-mobile {
        display: flex;
    }
    
    /* Hide desktop theme toggle on mobile */
    .theme-toggle-container {
        display: none;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 60px;
        flex-direction: column;
        background: var(--bg-primary);
        width: 100%;
        text-align: center;
        transition: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        box-shadow: var(--shadow-lg);
        padding: 2rem 0;
        gap: 0;
        border-top: 1px solid var(--border-color);
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    /* Fix: Set initial state for nav items */
    .nav-item {
        margin: 0.5rem 0;
        opacity: 1;  /* Start visible */
        transform: translateX(0);  /* Start in position */
    }
    
    /* Animate menu items ONLY when menu becomes active */
    .nav-menu.active .nav-item {
        animation: slideInFromLeft 0.5s ease forwards;
    }
    
    .nav-menu.active .nav-item:nth-child(1) { animation-delay: 0.1s; }
    .nav-menu.active .nav-item:nth-child(2) { animation-delay: 0.2s; }
    .nav-menu.active .nav-item:nth-child(3) { animation-delay: 0.3s; }
    .nav-menu.active .nav-item:nth-child(4) { animation-delay: 0.4s; }
    .nav-menu.active .nav-item:nth-child(5) { animation-delay: 0.5s; }
    
    @keyframes slideInFromLeft {
        from {
            opacity: 0;
            transform: translateX(-20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    .nav-link {
        display: block;
        padding: 1rem;
        font-size: 1.1rem;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
    }
    
    .nav-link::after {
        display: none;
    }
    
    /* Mobile menu link hover effect */
    .nav-link::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: var(--bg-secondary);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
        z-index: -1;
    }
    
    .nav-link:hover::before {
        width: 300px;
        height: 300px;
    }
    
    .nav-link.active {
        background: var(--bg-secondary);
        border-radius: 8px;
        color: var(--accent-color);
    }
}

/* Small Mobile */
@media screen and (max-width: 480px) {
    .nav-container {
        padding: 0 15px;
    }
    
    .nav-logo {
        font-size: 1.3rem;
    }
    
    .nav-link {
        font-size: 1rem;
    }
    
    .nav-toggle {
        width: 30px;
        height: 30px;
    }
    
    .hamburger {
        width: 24px;
        height: 2.5px;
    }
    
    .theme-toggle-mobile {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }
    
    .theme-toggle-mobile svg {
        width: 18px;
        height: 18px;
    }
}

/* Desktop Theme Toggle Position */
@media screen and (min-width: 769px) {
    .theme-toggle-mobile {
        display: none !important;
    }
    
    .theme-toggle-container {
        display: block;
        position: fixed;
        top: 85px;
        right: 30px;
        z-index: 999;
    }
}

/* Update hero section padding to account for navbar */
.hero {
    padding-top: 100px;
}

@media screen and (max-width: 768px) {
    .hero {
        padding-top: 80px;
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Add subtle shadow to navbar on mobile when menu is open */
@media screen and (max-width: 768px) {
    .navbar.menu-open {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
}