<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Eversync</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
    {% load static %}
    <link rel="icon" href="{% static 'favicon.ico' %}">
    <link rel="stylesheet" href="{% static 'index-style.css' %}" ">
    <script src='https://8x8.vc/vpaas-magic-cookie-bffe3f1241674331a318ea51c0f85ae7/external_api.js' async></script>
    <style>html, body {
        margin: 0;
        padding: 0;
        height: 100%;
        overflow: hidden; /* prevent scrolling */
    }
    
    body {
        display: flex;
        flex-direction: column;
    }
    
    .header {
        height: 80px; /* adjust to your navbar height */
        flex-shrink: 0;
    }
    
    #jaas-container {
        flex: 1;
        width: 100%;
    }
    </style>
    <script type="text/javascript">
        window.onload = () => {
        const api = new JitsiMeetExternalAPI("8x8.vc", {
            roomName: "vpaas-magic-cookie-bffe3f1241674331a318ea51c0f85ae7/EversyncGroup",
            parentNode: document.querySelector('#jaas-container'),
            userInfo: {
                displayName: "{{ user.username }}"
            }
        });
    
        api.addEventListener('readyToClose', () => {
            window.location.replace("{% url 'index' %}");
        });
        };
    </script>
  
  </head>
</head>
    
</head>
<body>
    <div class="header">
        <div class="header-content">
            <a href="/"><img src="{% static 'eversync2.png' %}" alt="Eversync Logo" style="height: 80px; margin-right: 10px; display: flex; align-items: center; gap: 5px;"></a>
            <a href="/" class="logo" >eversync</a>
            <div class="nav-links" style="position: relative;">
                <div class="dropdown">
                    <button class="dropdown-toggle" style="background: none; border: none; color: white; font-size: 16px; cursor: pointer;">
                        Welcome, {{ user.username }} <i class="fas fa-caret-down"></i>
                    </button>
                    <div class="dropdown-menu" style="display: none; position: absolute; right: 0; background-color: #333; border: 1px solid #444; border-radius: 4px; padding: 10px; width: 184px;">
                        
                        <form action="{% url 'manage' %}" method="post" style="margin: 0;">
                            {% csrf_token %}
                            <button type="submit" class="logout-button" style="background-color: transparent; color: white; border: none; cursor: pointer;">Manage Account</button>
                        </form>
                        
                        <form action="{% url 'logoutz' %}" method="post" style="margin: 0;">
                            {% csrf_token %}
                            <button type="submit" class="logout-button" style="background-color: transparent; color: white; border: none; cursor: pointer;">Log Out</button>
                        </form>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
    
<div id="jaas-container"></div>
  

        </div>
    </div>
<script>
    document.addEventListener('DOMContentLoaded', function () {
        const toggle = document.querySelector('.dropdown-toggle');
        const menu = document.querySelector('.dropdown-menu');
        toggle.addEventListener('click', function () {
            menu.style.display = menu.style.display === 'block' ? 'none' : 'block';
        });
    });
</script>
</body>
</html>