<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ShareIt - צ'אט תיאום</title>
    <link rel="stylesheet" href="../assets/css/chat.css">
</head>
<body>

    <!-- ===== HEADER ===== -->
    <header>
        <a href="../index.php">
            <img src="../assets/images/logo.png" alt="ShareIt" class="header-logo">
        </a>
        <nav class="header-nav">
            <a href="../index.php">דף הבית</a>
            <span class="nav-sep">|</span>
            <a href="profile.php">הפרופיל שלי</a>
            <span class="nav-sep">|</span>
            <a href="../api/logout.php">התנתקות</a>
        </nav>
    </header>

    <!-- ===== MAIN ===== -->
    <main class="chat-main">
        <div class="chat-card">
            <div class="card-top-bar"></div>

            <div class="chat-card-header">
                <div class="chat-icon">💬</div>
                <div>
                    <h2>תיאום איסוף פריט</h2>
                    <div class="chat-subtitle">שוחחו על מיקום ושעת האיסוף</div>
                </div>
            </div>

            <div id="chat-window">
                <div class="chat-loading">
                    <div class="dot-bounce"></div>
                    <div class="dot-bounce"></div>
                    <div class="dot-bounce"></div>
                </div>
            </div>

            <div class="chat-input-area">
                <form id="messageForm">
                    <input type="hidden" name="request_id" value="<?php echo (int)$_GET['id']; ?>">
                    <input
                        type="text"
                        name="message_text"
                        id="msgInput"
                        placeholder="כתבו הודעה ולחצו Enter..."
                        autocomplete="off"
                        required
                    >
                    <button type="submit" id="btn-send" title="שלח">&#10148;</button>
                </form>
            </div>
        </div>
    </main>

    <div id="toast"></div>

    <script>
        window.CHAT_REQUEST_ID = <?php echo (int)$_GET['id']; ?>;
    </script>
    <script src="../assets/js/chat.js"></script>
</body>
</html>
