<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>environment impact</title>
    <style>
        @font-face {
            font-family: 'Vazir';
            src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font/dist/Vazir.woff2') format('woff2');
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Vazir', sans-serif;
        }

        .auth-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
            z-index: 9999;
            display: flex;
            justify-content: center;
            align-items: center;
            transition: all 0.5s ease-in-out;
        }

        .auth-container {
            background: rgba(255, 255, 255, 0.95);
            padding: 2.5rem;
            border-radius: 20px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.2);
            width: 90%;
            max-width: 420px;
            transform: translateY(0);
            transition: all 0.4s ease;
        }

        .auth-container:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.3);
        }

        .auth-header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .auth-header h1 {
            color: #2c3e50;
            font-size: 1.5rem;
            margin-bottom: 1rem;
        }

        .auth-header .icon {
            font-size: 3rem;
            margin-bottom: 1rem;
            background: linear-gradient(45deg, #2ecc71, #3498db);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .input-group {
            position: relative;
            margin-bottom: 2rem;
        }

        .password-input {
            width: 100%;
            padding: 15px;
            border: 2px solid #e0e0e0;
            border-radius: 12px;
            font-size: 1.1rem;
            text-align: center;
            direction: ltr;
            transition: all 0.3s ease;
            background: rgba(255, 255, 255, 0.9);
        }

        .password-input:focus {
            border-color: #3498db;
            outline: none;
            box-shadow: 0 0 15px rgba(52,152,219,0.15);
        }

        .submit-btn {
            width: 100%;
            padding: 15px;
            border: none;
            border-radius: 12px;
            background: linear-gradient(45deg, #2ecc71, #3498db);
            color: white;
            font-size: 1.1rem;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .submit-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(46,204,113,0.3);
        }

        .submit-btn:active {
            transform: translateY(1px);
        }

        .error-message {
            color: #e74c3c;
            margin-top: 1rem;
            text-align: center;
            display: none;
            animation: shake 0.5s ease-in-out;
        }

        .loader {
            display: none;
            width: 25px;
            height: 25px;
            border: 3px solid #ffffff;
            border-radius: 50%;
            border-top-color: transparent;
            animation: spin 1s linear infinite;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            20%, 60% { transform: translateX(-10px); }
            40%, 80% { transform: translateX(10px); }
        }

        @keyframes spin {
            100% { transform: translate(-50%, -50%) rotate(360deg); }
        }

        .fade-out {
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.5s ease-in-out, visibility 0.5s;
        }

        .success-message {
            display: none;
            color: #2ecc71;
            text-align: center;
            margin-top: 1rem;
        }

        @media (max-width: 480px) {
            .auth-container {
                padding: 1.5rem;
            }

            .auth-header h1 {
                font-size: 1.2rem;
            }
        }
    </style>
</head>
<body>
    <div class="auth-overlay" id="authOverlay">
        <div class="auth-container">
            <div class="auth-header">
                <div class="icon">♻️</div>
                <h1>🔐👁️ password</h1>
            </div>
            <form id="authForm" onsubmit="return validateAccess(event)">
                <div class="input-group">
                    <input type="password" 
                           class="password-input" 
                           id="accessCode"
                           placeholder="enter your password 🔑"
                           autocomplete="off"
                           required>
                </div>
                <button type="submit" class="submit-btn" id="submitBtn">
                    <span class="btn-text">🔑👍</span>
                    <span class="loader"></span>
                </button>
                <div class="error-message" id="errorMsg">🤦do it again</div>
                <div class="success-message" id="successMsg">🔴🟠🟡🟢🔵👍</div>
            </form>
        </div>
    </div>

    <script>
        (function() {
            const CORRECT_PASSWORD = '590245';
            const AUTH_KEY = 'eco_platform_auth';
            
            // Check if already authenticated
            if (sessionStorage.getItem(AUTH_KEY) === 'true') {
                document.getElementById('authOverlay').classList.add('fade-out');
                setTimeout(() => {
                    document.getElementById('authOverlay').style.display = 'none';
                }, 500);
                return;
            }

            function validateAccess(event) {
                event.preventDefault();
                
                const accessCode = document.getElementById('accessCode');
                const submitBtn = document.getElementById('submitBtn');
                const btnText = submitBtn.querySelector('.btn-text');
                const loader = submitBtn.querySelector('.loader');
                const errorMsg = document.getElementById('errorMsg');
                const successMsg = document.getElementById('successMsg');

                // Reset states
                errorMsg.style.display = 'none';
                successMsg.style.display = 'none';
                btnText.style.display = 'none';
                loader.style.display = 'block';
                submitBtn.disabled = true;

                // Simulate server verification
                setTimeout(() => {
                    if (accessCode.value === CORRECT_PASSWORD) {
                        successMsg.style.display = 'block';
                        sessionStorage.setItem(AUTH_KEY, 'true');
                        
                        setTimeout(() => {
                            document.getElementById('authOverlay').classList.add('fade-out');
                            setTimeout(() => {
                                document.getElementById('authOverlay').style.display = 'none';
                            }, 500);
                        }, 1000);
                    } else {
                        errorMsg.style.display = 'block';
                        btnText.style.display = 'block';
                        loader.style.display = 'none';
                        submitBtn.disabled = false;
                        
                        // Clear input and focus
                        accessCode.value = '';
                        accessCode.focus();
                    }
                }, 1500);

                return false;
            }

            // Attach form submit handler
            document.getElementById('authForm').addEventListener('submit', validateAccess);

            // Prevent form resubmission on page refresh
            if (window.history.replaceState) {
                window.history.replaceState(null, null, window.location.href);
            }
        })();
    </script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        :root {
            --menu-gradient-1: #2193b0;
            --menu-gradient-2: #6dd5ed;
        }

        .menu-wrapper {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 9999;
        }

        .hamburger-menu {
            width: 45px;
            height: 45px;
            cursor: pointer;
            background: linear-gradient(145deg, var(--menu-gradient-1), var(--menu-gradient-2));
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            box-shadow: 0 4px 15px rgba(0,0,0,0.2);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .hamburger-menu:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 20px rgba(0,0,0,0.25);
        }

        .menu-icon {
            width: 26px;
            height: 20px;
            position: relative;
        }

        .menu-icon span {
            display: block;
            position: absolute;
            height: 3px;
            width: 100%;
            background: white;
            border-radius: 3px;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .menu-icon span:nth-child(1) { top: 0; }
        .menu-icon span:nth-child(2) { top: 8px; width: 80%; }
        .menu-icon span:nth-child(3) { top: 16px; }

        .menu-open span:nth-child(1) {
            transform: rotate(45deg) translate(7px, 7px);
        }

        .menu-open span:nth-child(2) {
            opacity: 0;
            transform: translateX(-10px);
        }

        .menu-open span:nth-child(3) {
            transform: rotate(-45deg) translate(7px, -7px);
        }

        .menu-items {
            position: fixed;
            top: 75px;
            right: 20px;
            background: linear-gradient(145deg, var(--menu-gradient-1), var(--menu-gradient-2));
            padding: 15px;
            border-radius: 15px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.2);
            opacity: 0;
            transform: translateY(-20px) scale(0.95);
            pointer-events: none;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            min-width: 200px;
        }

        .menu-items.show {
            opacity: 1;
            transform: translateY(0) scale(1);
            pointer-events: all;
        }

        .menu-items a {
            display: flex;
            align-items: center;
            color: white;
            text-decoration: none;
            padding: 12px 20px;
            margin: 8px 0;
            border-radius: 8px;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            font-family: Arial, sans-serif;
            font-size: 15px;
            letter-spacing: 0.5px;
            position: relative;
            overflow: hidden;
        }

        .menu-items a:before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: rgba(255,255,255,0.1);
            transform: translateX(-100%);
            transition: transform 0.3s ease;
        }

        .menu-items a:hover:before {
            transform: translateX(0);
        }

        .menu-items a i {
            margin-right: 10px;
            font-size: 18px;
        }

        .menu-items a:hover {
            background: rgba(255,255,255,0.15);
            transform: translateX(5px);
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        /* Added tooltip styles */
        .menu-items a .tooltip {
            position: absolute;
            background: rgba(0,0,0,0.8);
            color: white;
            padding: 5px 10px;
            border-radius: 5px;
            font-size: 12px;
            right: 100%;
            top: 50%;
            transform: translateY(-50%);
            margin-right: 10px;
            opacity: 0;
            pointer-events: none;
            transition: all 0.3s ease;
        }

        .menu-items a:hover .tooltip {
            opacity: 1;
        }

        @media (max-width: 768px) {
            .menu-items {
                width: calc(100vw - 40px);
                right: 50%;
                transform: translateX(50%) translateY(-20px) scale(0.95);
            }

            .menu-items.show {
                transform: translateX(50%) translateY(0) scale(1);
            }
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
</head>
<body>
    <div class="menu-wrapper">
        <div class="hamburger-menu" onclick="toggleMenu(event)">
            <div class="menu-icon">
                <span></span>
                <span></span>
                <span></span>
            </div>
        </div>
        <div class="menu-items">
            <a href="#" onclick="loadContent('home'); return false;">
                <i class="fas fa-home"></i>Home
                <span class="tooltip">Go to Homepage</span>
            </a>
            <a href="#" onclick="loadContent('analysis'); return false;">
                <i class="fas fa-chart-bar"></i>New Analysis
                <span class="tooltip">Start New Analysis</span>
            </a>
            <a href="mailto:queenaicpu@gmail.com">
                <i class="fas fa-envelope"></i>Contact Developer
                <span class="tooltip">Email Developer</span>
            </a>
        </div>
    </div>

    <script>
        let currentContent = 'home';

        function toggleMenu(event) {
            event.stopPropagation();
            const menuIcon = document.querySelector('.menu-icon');
            const menuItems = document.querySelector('.menu-items');
            
            menuIcon.classList.toggle('menu-open');
            menuItems.classList.toggle('show');
        }

        function loadContent(page) {
            if (currentContent === page) return;
            
            currentContent = page;
            
            // Close menu after selection
            const menuIcon = document.querySelector('.menu-icon');
            const menuItems = document.querySelector('.menu-items');
            menuIcon.classList.remove('menu-open');
            menuItems.classList.remove('show');

            // Handle page content loading
            switch(page) {
                case 'home':
                    window.location.href = window.location.pathname;
                    break;
                case 'analysis':
                    // Trigger new analysis functionality
                    resetForm();
                    break;
                default:
                    console.log('Unknown page');
            }
        }

        function resetForm() {
            // Reset all form fields if they exist
            const forms = document.getElementsByTagName('form');
            if (forms.length > 0) {
                forms[0].reset();
            }
            
            // Clear any results or calculations
            const results = document.getElementById('results');
            if (results) {
                results.innerHTML = '';
            }
        }

        // Close menu when clicking outside
        document.addEventListener('click', function(event) {
            const menuWrapper = document.querySelector('.menu-wrapper');
            const menuItems = document.querySelector('.menu-items');
            const menuIcon = document.querySelector('.menu-icon');
            
            if (!menuWrapper.contains(event.target) && menuItems.classList.contains('show')) {
                menuItems.classList.remove('show');
                menuIcon.classList.remove('menu-open');
            }
        });

        // Prevent menu from closing when clicking inside menu items
        document.querySelector('.menu-items').addEventListener('click', function(event) {
            event.stopPropagation();
        });

        // Add keyboard navigation
        document.addEventListener('keydown', function(event) {
            if (event.key === 'Escape') {
                const menuItems = document.querySelector('.menu-items');
                const menuIcon = document.querySelector('.menu-icon');
                menuItems.classList.remove('show');
                menuIcon.classList.remove('menu-open');
            }
        });
    </script>
</body>
</html>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        .eco-header {
            height: 200px;
            background: linear-gradient(135deg, #b5e48c 0%, #184e77 100%);
            position: relative;
            overflow: hidden;
        }

        .cloud {
            position: absolute;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 50px;
            animation: floatCloud 20s infinite linear;
        }

        .cloud:nth-child(1) {
            width: 100px;
            height: 40px;
            top: 30px;
            left: -100px;
        }

        .cloud:nth-child(2) {
            width: 80px;
            height: 30px;
            top: 60px;
            left: -80px;
            animation-delay: -5s;
        }

        .turbine {
            position: absolute;
            bottom: 0;
        }

        .tower {
            width: 10px;
            height: 100px;
            background: #ddd;
            margin-left: 20px;
        }

        .blades {
            width: 80px;
            height: 80px;
            position: absolute;
            top: 0;
            left: -15px;
            animation: rotate 4s infinite linear;
        }

        .blade {
            position: absolute;
            width: 8px;
            height: 30px;
            background: #fff;
            left: 50%;
            top: 50%;
            transform-origin: bottom center;
        }

        .blade:nth-child(1) { transform: rotate(0deg); }
        .blade:nth-child(2) { transform: rotate(120deg); }
        .blade:nth-child(3) { transform: rotate(240deg); }

        .tree {
            position: absolute;
            bottom: 0;
        }

        .trunk {
            width: 20px;
            height: 60px;
            background: #5c4033;
        }

        .leaves {
            width: 60px;
            height: 60px;
            background: #2d5a27;
            border-radius: 50%;
            position: relative;
            top: -30px;
            left: -20px;
            animation: sway 3s infinite ease-in-out;
        }

        .sun {
            position: absolute;
            width: 60px;
            height: 60px;
            background: #ffd700;
            border-radius: 50%;
            top: 30px;
            right: 30px;
            box-shadow: 0 0 30px #ffd700;
            animation: glow 3s infinite alternate;
        }

        .recycling {
            position: absolute;
            bottom: 20px;
            right: 20px;
            font-size: 40px;
            color: #fff;
            animation: spin 10s infinite linear;
        }

        @keyframes floatCloud {
            from { transform: translateX(-100px); }
            to { transform: translateX(calc(100vw + 100px)); }
        }

        @keyframes rotate {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        @keyframes sway {
            0%, 100% { transform: rotate(-5deg); }
            50% { transform: rotate(5deg); }
        }

        @keyframes glow {
            from { box-shadow: 0 0 30px #ffd700; }
            to { box-shadow: 0 0 50px #ffd700; }
        }

        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        @media (max-width: 768px) {
            .eco-header {
                height: 150px;
            }
            .sun {
                width: 40px;
                height: 40px;
            }
            .tree .leaves {
                width: 40px;
                height: 40px;
            }
            .turbine .tower {
                height: 70px;
            }
            .blades {
                width: 60px;
                height: 60px;
            }
        }
    </style>
</head>
<body>
    <div class="eco-header">
        <div class="cloud"></div>
        <div class="cloud"></div>
        <div class="sun"></div>
        
        <div class="turbine" style="left: 10%">
            <div class="blades">
                <div class="blade"></div>
                <div class="blade"></div>
                <div class="blade"></div>
            </div>
            <div class="tower"></div>
        </div>
        
        <div class="turbine" style="left: 30%">
            <div class="blades">
                <div class="blade"></div>
                <div class="blade"></div>
                <div class="blade"></div>
            </div>
            <div class="tower"></div>
        </div>
        
        <div class="tree" style="left: 50%">
            <div class="leaves"></div>
            <div class="trunk"></div>
        </div>
        
        <div class="tree" style="left: 70%">
            <div class="leaves"></div>
            <div class="trunk"></div>
        </div>
        
        <div class="recycling">♻️</div>
    </div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Advanced Nutrition and Waste Tracking System</title>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f0f4f8;
        }
        h1 {
            color: #2c3e50;
            text-align: center;
            margin-bottom: 30px;
        }
        form {
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
        }
        input, select {
            width: 100%;
            padding: 8px;
            margin-bottom: 15px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        button {
            background-color: #3498db;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            transition: background-color 0.3s;
        }
        button:hover {
            background-color: #2980b9;
        }
        #results {
            margin-top: 30px;
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        .chart-container {
            position: relative;
            height: 300px;
            width: 100%;
            margin-bottom: 30px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
            font-weight: bold;
        }
        .recommendations {
            background-color: #e8f4fd;
            border-left: 4px solid #3498db;
            padding: 15px;
            margin-top: 20px;
            border-radius: 4px;
        }
    </style>
</head>
<body>
    <h1>🍎 Advanced Nutrition and Waste Tracking System</h1>
    <form id="nutritionForm">
        <label for="age">Age:</label>
        <input type="number" id="age" required>

        <label for="gender">Gender:</label>
        <select id="gender" required>
            <option value="male">Male</option>
            <option value="female">Female</option>
        </select>

        <label for="height">Height (cm):</label>
        <input type="number" id="height" required>

        <label for="weight">Weight (kg):</label>
        <input type="number" id="weight" required>

        <label for="activityLevel">Activity Level:</label>
        <select id="activityLevel" required>
            <option value="sedentary">Sedentary</option>
            <option value="light">Light Activity</option>
            <option value="moderate">Moderate Activity</option>
            <option value="active">Active</option>
            <option value="veryActive">Very Active</option>
        </select>

        <label for="consumptionPeriod">Consumption Period:</label>
        <select id="consumptionPeriod" required>
            <option value="daily">Daily</option>
            <option value="weekly">Weekly</option>
            <option value="monthly">Monthly</option>
        </select>

        <label for="water">Water and Beverages (liters):</label>
        <input type="number" id="water" step="0.1" required>

        <label for="fruits">Fruits (kg):</label>
        <input type="number" id="fruits" step="0.1" required>

        <label for="vegetables">Vegetables (kg):</label>
        <input type="number" id="vegetables" step="0.1" required>

        <label for="grains">Grains (kg):</label>
        <input type="number" id="grains" step="0.1" required>

        <label for="fastFood">Fast Food (number of meals):</label>
        <input type="number" id="fastFood" required>

        <label for="meatFish">Meat/Fish (kg):</label>
        <input type="number" id="meatFish" step="0.1" required>

        <label for="dairyEggs">Dairy/Eggs (kg):</label>
        <input type="number" id="dairyEggs" step="0.1" required>

        <label for="snacks">Snacks (kg):</label>
        <input type="number" id="snacks" step="0.1" required>

        <button type="button" onclick="calculateAdvanced()">Calculate Advanced Results</button>
    </form>

    <div id="results"></div>

    <script>
        function calculateAdvanced() {
            // Get form values
            const age = parseInt(document.getElementById('age').value);
            const gender = document.getElementById('gender').value;
            const height = parseInt(document.getElementById('height').value);
            const weight = parseFloat(document.getElementById('weight').value);
            const activityLevel = document.getElementById('activityLevel').value;
            const consumptionPeriod = document.getElementById('consumptionPeriod').value;
            const water = parseFloat(document.getElementById('water').value);
            const fruits = parseFloat(document.getElementById('fruits').value);
            const vegetables = parseFloat(document.getElementById('vegetables').value);
            const grains = parseFloat(document.getElementById('grains').value);
            const fastFood = parseInt(document.getElementById('fastFood').value);
            const meatFish = parseFloat(document.getElementById('meatFish').value);
            const dairyEggs = parseFloat(document.getElementById('dairyEggs').value);
            const snacks = parseFloat(document.getElementById('snacks').value);

            // Calculate BMR (Basal Metabolic Rate)
            let bmr;
            if (gender === 'male') {
                bmr = 88.362 + (13.397 * weight) + (4.799 * height) - (5.677 * age);
            } else {
                bmr = 447.593 + (9.247 * weight) + (3.098 * height) - (4.330 * age);
            }

            // Calculate TDEE (Total Daily Energy Expenditure)
            const activityFactors = {
                sedentary: 1.2,
                light: 1.375,
                moderate: 1.55,
                active: 1.725,
                veryActive: 1.9
            };
            const tdee = bmr * activityFactors[activityLevel];

            // Calculate total food consumption
            const totalFood = fruits + vegetables + grains + meatFish + dairyEggs + snacks;

            // Calculate waste estimation (assuming 30% of food becomes waste)
            const wasteEstimation = totalFood * 0.3;

            // Calculate carbon footprint (rough estimation)
            const carbonFootprint = (meatFish * 27 + dairyEggs * 13.5 + fruits * 0.9 + vegetables * 2 + grains * 1.4 + fastFood * 2.5) * (consumptionPeriod === 'daily' ? 365 : consumptionPeriod === 'weekly' ? 52 : 12);

            // Prepare results HTML
            let resultsHTML = `
                <h2>Advanced Analysis Results</h2>
                <table>
                    <tr><th>Metric</th><th>Value</th></tr>
                    <tr><td>BMI (Body Mass Index)</td><td>${(weight / Math.pow(height/100, 2)).toFixed(2)}</td></tr>
                    <tr><td>BMR (Basal Metabolic Rate)</td><td>${bmr.toFixed(2)} calories/day</td></tr>
                    <tr><td>TDEE (Total Daily Energy Expenditure)</td><td>${tdee.toFixed(2)} calories/day</td></tr>
                    <tr><td>Total Food Consumption</td><td>${totalFood.toFixed(2)} kg/${consumptionPeriod}</td></tr>
                    <tr><td>Estimated Food Waste</td><td>${wasteEstimation.toFixed(2)} kg/${consumptionPeriod}</td></tr>
                    <tr><td>Estimated Annual Carbon Footprint</td><td>${carbonFootprint.toFixed(2)} kg CO2e</td></tr>
                </table>

                <div class="chart-container">
                    <canvas id="foodConsumptionChart"></canvas>
                </div>

                <div class="chart-container">
                    <canvas id="nutritionBalanceChart"></canvas>
                </div>

                <div class="recommendations">
                    <h3>Recommendations</h3>
                    <ul>
                        <li>Aim for a balanced diet with plenty of fruits, vegetables, and whole grains.</li>
                        <li>Stay hydrated by drinking at least ${(weight * 0.033).toFixed(2)} liters of water per day.</li>
                        <li>Consider reducing meat consumption to lower your carbon footprint.</li>
                        <li>Try to minimize food waste by planning meals and properly storing leftovers.</li>
                    </ul>
                </div>
            `;

            // Display results
            document.getElementById('results').innerHTML = resultsHTML;

            // Create food consumption chart
            const ctx1 = document.getElementById('foodConsumptionChart').getContext('2d');
            new Chart(ctx1, {
                type: 'pie',
                data: {
                    labels: ['Fruits', 'Vegetables', 'Grains', 'Meat/Fish', 'Dairy/Eggs', 'Snacks'],
                    datasets: [{
                        data: [fruits, vegetables, grains, meatFish, dairyEggs, snacks],
                        backgroundColor: [
                            'rgba(255, 99, 132, 0.8)',
                            'rgba(75, 192, 192, 0.8)',
                            'rgba(255, 206, 86, 0.8)',
                            'rgba(54, 162, 235, 0.8)',
                            'rgba(153, 102, 255, 0.8)',
                            'rgba(255, 159, 64, 0.8)'
                        ]
                    }]
                },
                options: {
                    responsive: true,
                    plugins: {
                        title: {
                            display: true,
                            text: 'Food Consumption Distribution'
                        }
                    }
                }
            });

            // Create nutrition balance chart
            const ctx2 = document.getElementById('nutritionBalanceChart').getContext('2d');
            new Chart(ctx2, {
                type: 'radar',
                data: {
                    labels: ['Fruits', 'Vegetables', 'Grains', 'Meat/Fish', 'Dairy/Eggs', 'Water'],
                    datasets: [{
                        label: 'Your Consumption',
                        data: [fruits, vegetables, grains, meatFish, dairyEggs, water],
                        fill: true,
                        backgroundColor: 'rgba(54, 162, 235, 0.2)',
                        borderColor: 'rgb(54, 162, 235)',
                        pointBackgroundColor: 'rgb(54, 162, 235)',
                        pointBorderColor: '#fff',
                        pointHoverBackgroundColor: '#fff',
                        pointHoverBorderColor: 'rgb(54, 162, 235)'
                    }, {
                        label: 'Recommended',
                        data: [2, 3, 2, 0.5, 1, 2],
                        fill: true,
                        backgroundColor: 'rgba(255, 99, 132, 0.2)',
                        borderColor: 'rgb(255, 99, 132)',
                        pointBackgroundColor: 'rgb(255, 99, 132)',
                        pointBorderColor: '#fff',
                        pointHoverBackgroundColor: '#fff',
                        pointHoverBorderColor: 'rgb(255, 99, 132)'
                    }]
                },
                options: {
                    elements: {
                        line: {
                            borderWidth: 3
                        }
                    },
                    plugins: {
                        title: {
                            display: true,
                            text: 'Nutrition Balance'
                        }
                    }
                }
            });
        }
    </script>
<div class="advanced-controls">
    <style>
        .advanced-controls {
            max-width: 1200px;
            margin: 30px auto;
            padding: 20px;
            font-family: Arial, sans-serif;
        }

        .control-panel {
            background: linear-gradient(145deg, #2193b0, #6dd5ed);
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        }

        .control-buttons {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 15px;
            margin-bottom: 20px;
        }

        .ctrl-btn {
            padding: 12px 20px;
            border: none;
            border-radius: 8px;
            background: rgba(255,255,255,0.9);
            color: #2193b0;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
        }

        .ctrl-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            background: white;
        }

        .ctrl-btn i {
            margin-right: 10px;
        }

        .history-panel {
            background: white;
            border-radius: 12px;
            padding: 20px;
            margin-top: 20px;
            display: none;
            animation: slideDown 0.4s ease;
        }

        @keyframes slideDown {
            from { opacity: 0; transform: translateY(-20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .history-item {
            border-left: 4px solid #2193b0;
            margin: 10px 0;
            padding: 15px;
            background: #f8f9fa;
            border-radius: 0 8px 8px 0;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .history-item:hover {
            transform: translateX(5px);
            background: #f0f1f2;
        }

        .category-filters {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 15px;
        }

        .category-filter {
            padding: 8px 15px;
            border-radius: 20px;
            background: rgba(255,255,255,0.2);
            color: white;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .category-filter.active {
            background: white;
            color: #2193b0;
        }

        .loading {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255,255,255,0.3);
            border-radius: 50%;
            border-top-color: white;
            animation: spin 1s linear infinite;
            margin-right: 10px;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        @media (max-width: 768px) {
            .control-buttons {
                grid-template-columns: 1fr;
            }
        }
    </style>

    <div class="control-panel">
        <div class="category-filters">
            <div class="category-filter active" data-category="all">All Reports</div>
            <div class="category-filter" data-category="nutrition">Nutrition</div>
            <div class="category-filter" data-category="activity">Activity</div>
            <div class="category-filter" data-category="waste">Waste</div>
        </div>

        <div class="control-buttons">
            <button class="ctrl-btn" onclick="printReport()">
                <i class="fas fa-print"></i>Print Report
            </button>
            <button class="ctrl-btn" onclick="saveReport()">
                <i class="fas fa-save"></i>Save Report
            </button>
            <button class="ctrl-btn" onclick="toggleHistory()">
                <i class="fas fa-history"></i>View History
            </button>
            <button class="ctrl-btn" onclick="clearStorage()">
                <i class="fas fa-trash"></i>Clear Storage
            </button>
        </div>
    </div>

    <div id="historyPanel" class="history-panel"></div>

    <script>
        // Storage functions
        function saveReport() {
            const formData = collectFormData();
            if (!formData) return;

            const reports = JSON.parse(localStorage.getItem('nutritionReports') || '[]');
            const report = {
                id: Date.now(),
                date: new Date().toISOString(),
                category: 'nutrition',
                data: formData
            };

            reports.push(report);
            localStorage.setItem('nutritionReports', JSON.stringify(reports));
            showNotification('Report saved successfully!');
        }

        function collectFormData() {
            // Collect all form data
            const form = document.querySelector('form');
            if (!form) return null;

            const formData = {};
            const inputs = form.querySelectorAll('input, select');
            inputs.forEach(input => {
                formData[input.name || input.id] = input.value;
            });
            return formData;
        }

        function printReport() {
            const formData = collectFormData();
            if (!formData) return;

            const printWindow = window.open('', '_blank');
            printWindow.document.write(`
                <html>
                <head>
                    <title>Nutrition Report</title>
                    <style>
                        body { font-family: Arial; padding: 20px; }
                        .report-item { margin: 10px 0; }
                        .header { text-align: center; margin-bottom: 30px; }
                    </style>
                </head>
                <body>
                    <div class="header">
                        <h1>Nutrition and Waste Tracking Report</h1>
                        <p>Generated on: ${new Date().toLocaleString()}</p>
                    </div>
                    ${Object.entries(formData).map(([key, value]) => `
                        <div class="report-item">
                            <strong>${key}:</strong> ${value}
                        </div>
                    `).join('')}
                </body>
                </html>
            `);
            printWindow.document.close();
            printWindow.print();
        }

        function toggleHistory() {
            const historyPanel = document.getElementById('historyPanel');
            const reports = JSON.parse(localStorage.getItem('nutritionReports') || '[]');

            if (historyPanel.style.display === 'none' || !historyPanel.style.display) {
                historyPanel.style.display = 'block';
                displayHistory(reports);
            } else {
                historyPanel.style.display = 'none';
            }
        }

        function displayHistory(reports) {
            const historyPanel = document.getElementById('historyPanel');
            if (reports.length === 0) {
                historyPanel.innerHTML = '<p>No history available</p>';
                return;
            }

            historyPanel.innerHTML = reports.reverse().map(report => `
                <div class="history-item" onclick="loadReport('${report.id}')">
                    <h3>Report from ${new Date(report.date).toLocaleDateString()}</h3>
                    <p>Category: ${report.category}</p>
                </div>
            `).join('');
        }

        function loadReport(id) {
            const reports = JSON.parse(localStorage.getItem('nutritionReports') || '[]');
            const report = reports.find(r => r.id === parseInt(id));
            if (!report) return;

            // Fill form with report data
            Object.entries(report.data).forEach(([key, value]) => {
                const element = document.querySelector(`[name="${key}"], #${key}`);
                if (element) element.value = value;
            });

            showNotification('Report loaded successfully!');
        }

        function clearStorage() {
            if (confirm('Are you sure you want to clear all saved reports?')) {
                localStorage.removeItem('nutritionReports');
                showNotification('Storage cleared successfully!');
                if (document.getElementById('historyPanel').style.display === 'block') {
                    toggleHistory();
                }
            }
        }

        function showNotification(message) {
            const notification = document.createElement('div');
            notification.style.cssText = `
                position: fixed;
                bottom: 20px;
                right: 20px;
                background: #2193b0;
                color: white;
                padding: 15px 25px;
                border-radius: 8px;
                box-shadow: 0 4px 12px rgba(0,0,0,0.15);
                animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
                z-index: 1000;
            `;
            notification.textContent = message;
            document.body.appendChild(notification);
            setTimeout(() => notification.remove(), 3000);
        }

        // Category filter functionality
        document.querySelectorAll('.category-filter').forEach(filter => {
            filter.addEventListener('click', function() {
                document.querySelectorAll('.category-filter').forEach(f => f.classList.remove('active'));
                this.classList.add('active');
                const category = this.dataset.category;
                filterReports(category);
            });
        });

        function filterReports(category) {
            const reports = JSON.parse(localStorage.getItem('nutritionReports') || '[]');
            const filtered = category === 'all' ? reports : reports.filter(r => r.category === category);
            displayHistory(filtered);
        }
    </script>
</div>
<footer class="modern-footer">
  <style>
    @import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Raleway:wght@300;400;600&display=swap');
    
    .modern-footer {
      background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
      color: rgba(255,255,255,0.9);
      padding: 3rem 2rem;
      font-family: 'Raleway', sans-serif;
      text-align: center;
      position: relative;
      overflow: hidden;
      min-height: 250px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      box-shadow: 0 -10px 20px rgba(0,0,0,0.1);
    }

    .modern-footer::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.1) 0%, transparent 50%);
      animation: pulse 4s ease infinite;
    }

    .footer-text {
      position: relative;
      z-index: 1;
      line-height: 1.8;
      animation: fadeIn 1s ease-out;
    }

    .developer-name {
      font-family: 'Cinzel', serif;
      color: #4a90e2;
      font-weight: 700;
      font-size: 1.4em;
      margin: 0.5em 0;
      text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
      transition: all 0.3s ease;
    }

    .developer-name:hover {
      color: #66d9ef;
      transform: scale(1.05);
    }

    .title {
      color: #66d9ef;
      font-size: 1em;
      font-style: italic;
      letter-spacing: 1px;
      margin-bottom: 1em;
    }

    .ai-logo {
      width: 80px;
      height: 80px;
      margin: 1.5em auto;
      position: relative;
    }

    .ai-logo svg {
      width: 100%;
      height: 100%;
      filter: drop-shadow(0 0 8px rgba(102, 217, 239, 0.5));
      animation: float 3s ease-in-out infinite;
    }

    @keyframes float {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-10px); }
    }

    @keyframes pulse {
      0% { opacity: 0.5; }
      50% { opacity: 0.8; }
      100% { opacity: 0.5; }
    }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(20px); }
      to { opacity: 1; transform: translateY(0); }
    }

    @media (max-width: 768px) {
      .modern-footer {
        padding: 2rem 1rem;
      }
      
      .footer-text {
        font-size: 0.9em;
      }

      .developer-name {
        font-size: 1.2em;
      }

      .ai-logo {
        width: 60px;
        height: 60px;
      }
    }
  </style>

  <div class="footer-text">
    <div>All intellectual and material rights of this work are reserved for the developer</div>
    <div class="developer-name">Thank you, Reza Salehi (Albert)</div>
    <div class="title">AI Platforms & Data Developer</div>
    
    <div class="ai-logo">
      <svg viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path d="M50 10L90 30V70L50 90L10 70V30L50 10Z" stroke="#66d9ef" stroke-width="2"/>
        <path d="M50 10V90" stroke="#66d9ef" stroke-width="2"/>
        <path d="M90 30L10 70" stroke="#66d9ef" stroke-width="2"/>
        <path d="M10 30L90 70" stroke="#66d9ef" stroke-width="2"/>
        <circle cx="50" cy="50" r="10" fill="#4a90e2"/>
        <circle cx="50" cy="50" r="5" fill="#66d9ef"/>
        <circle cx="50" cy="10" r="3" fill="#66d9ef"/>
        <circle cx="90" cy="30" r="3" fill="#66d9ef"/>
        <circle cx="90" cy="70" r="3" fill="#66d9ef"/>
        <circle cx="50" cy="90" r="3" fill="#66d9ef"/>
        <circle cx="10" cy="70" r="3" fill="#66d9ef"/>
        <circle cx="10" cy="30" r="3" fill="#66d9ef"/>
      </svg>
    </div>
  </div>
</footer>
<head>
    <!-- Prevent page indexing by search engines -->
    <meta name="robots" content="noindex, nofollow">
    <meta name="googlebot" content="noindex, nofollow">
</head>
<body>
    <!-- Your page content goes here -->
<style>
    /* رفع مشکل RTL و تنظیم جهت متن به LTR */
    body {
        direction: ltr !important;
        text-align: left !important;
    }

    .login-container {
        direction: ltr !important;
        text-align: left !important;
    }

    .password-input input {
        direction: ltr !important;
        text-align: left !important;
    }

    .error-message, .success-message {
        direction: ltr !important;
        text-align: left !important;
    }
</style>
</body>
</html>