/* Desktop Navigation */
.mobile-nav {
    display: none;
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* Smart Profile Dropdown Positioning */
.nav-dropdown:last-child .dropdown-menu {
    position: absolute;
    right: 0;
    left: auto;
    top: 100%;
    min-width: 280px;
    max-width: 90vw;
    transform: translateX(0);
    margin-top: 0.5rem;
}

@media (max-width: 1200px) {
    .nav-dropdown:last-child .dropdown-menu {
        right: -20px;
    }
}

@media (max-width: 992px) {
    .nav-dropdown:last-child .dropdown-menu {
        right: -40px;
        min-width: 260px;
    }
}

@media (max-width: 576px) {
    .nav-dropdown:last-child .dropdown-menu {
        right: -60px;
        min-width: 240px;
        max-width: 85vw;
    }
}

@media (max-width: 400px) {
    .nav-dropdown:last-child .dropdown-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        min-width: 220px;
    }
}

/* Mobile Navigation Fix */
@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }
    
    .mobile-nav {
        display: block;
    }
    
    .mobile-menu {
        display: block !important;
    }
    
    .nav {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: white;
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        transition: left 0.3s ease;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        z-index: 999;
        overflow-y: auto;
    }
    
    .nav.active {
        left: 0;
    }
    
    .nav-section {
        width: 100%;
        padding: 1rem 1rem 0.5rem 1rem;
        font-weight: bold;
        font-size: 0.9rem;
        color: #667eea;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-top: 2px solid #f0f0f0;
        margin-top: 1rem;
        background: #f8f9fa;
    }
    
    .nav-section:first-of-type {
        margin-top: 0;
        border-top: none;
    }
    
    .nav-link {
        width: 100% !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.95rem !important;
        display: flex !important;
        align-items: center;
        background: white;
        border-radius: 4px;
        margin-bottom: 1px;
        border-left: 3px solid transparent;
        transition: all 0.2s ease;
    }
    
    .tool-link {
        padding-left: 1.5rem !important;
        font-size: 0.9rem !important;
        color: #555 !important;
    }
    
    .nav-link:hover, .tool-link:hover {
        background: #f0f7ff !important;
        border-left-color: #007bff !important;
        color: #007bff !important;
    }
    
    .nav-dropdown {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }
    
    .nav-dropdown > .nav-link {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: white !important;
        font-weight: 600;
    }
    
    .nav-dropdown > .nav-link::after {
        content: '▼';
        font-size: 0.8rem;
        transition: transform 0.3s ease;
    }
    
    .nav-dropdown.mobile-active > .nav-link::after {
        transform: rotate(180deg);
    }
    
    .nav-dropdown .dropdown-menu {
        position: static !important;
        display: none !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        background: #f8f9fa !important;
        border-radius: 0 0 6px 6px !important;
        padding: 0.5rem 0 !important;
        min-width: auto !important;
    }
    
    .nav-dropdown.mobile-active .dropdown-menu {
        display: block !important;
        animation: slideDown 0.3s ease;
    }
    
    .nav-dropdown.active .dropdown-menu {
        display: block !important;
    }
    
    @keyframes slideDown {
        from { opacity: 0; max-height: 0; }
        to { opacity: 1; max-height: 300px; }
    }
    
    .dropdown-item {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
        border-bottom: 1px solid #e9ecef !important;
        transition: all 0.2s ease !important;
        border-left: none !important;
        transform: none !important;
    }
    
    .dropdown-item:last-child {
        border-bottom: none !important;
    }
    
    .dropdown-item:hover {
        background: #e9ecef !important;
        padding-left: 2rem !important;
        color: #007bff !important;
    }
}