<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Edit Question</title>
<link rel="icon" type="image/png" href="/admin_assets/images/favicon.webp">

    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: #020617;
            display: flex;
        }

        /* SIDEBAR */
        .sidebar {
            width: 240px;
            height: 100vh;
            background: #0f172a;
            padding: 20px;
            position: fixed;
        }

        .logo {
            color: #fff;
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 30px;
        }

        .menu a {
            display: block;
            color: #94a3b8;
            padding: 12px;
            border-radius: 10px;
            margin-bottom: 10px;
            text-decoration: none;
        }

        .menu a:hover,
        .menu .active {
            background: #1e293b;
            color: #fff;
        }

        /* MAIN */
        .main {
            margin-left: 250px;
            padding: 40px;
            width: 100%;
        }

        /* HEADER */
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
        }

        .header h2 {
            color: #fff;
        }

        /* CARD */
        .card {
            max-width: 900px;
            margin: auto;
            background: #1e293b;
            padding: 30px;
            border-radius: 14px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        }

        /* FORM */
        .form-label {
            color: #cbd5f5;
            font-weight: 500;
            margin-bottom: 6px;
        }

        .form-control {
            width: 100%;
            padding: 10px;
            border-radius: 10px;
            border: none;
            background: #273449;
            color: #fff;
            margin-bottom: 15px;
        }

        .form-control:focus {
            outline: none;
            box-shadow: 0 0 0 2px #6366f1;
        }

        textarea {
            resize: none;
        }

        /* BUTTON */
        .btn-update {
            background: linear-gradient(45deg, #22c55e, #16a34a);
            border: none;
            padding: 12px 25px;
            border-radius: 25px;
            color: #fff;
            font-weight: 600;
            cursor: pointer;
            transition: 0.3s;
        }

        .btn-update:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(34,197,94,0.3);
        }
    </style>
</head>

<body>

    <!-- SIDEBAR -->
    <div class="sidebar">
        <div class="logo">Instructor Panel</div>

        <div class="menu">
            <a href="/mentor/dashboard">Dashboard</a>
            <a href="/mentor/content">Content</a>
            <a href="/mentor/models" class="active">3D Models</a>
            <a href="/mentor/quiz">Quiz</a>
            <a href="/mentor/quiz-list">Quiz Lists</a>
            <a href="/mentor/leaderboard">Leaderboard</a>
        </div>
    </div>

    <!-- MAIN -->
    <div class="main">

        <!-- HEADER -->
        <div class="header">
            <h2>✏️ Edit Question</h2>
            <div style="color:#fff;">Mentor Panel</div>
        </div>

        <!-- FORM CARD -->
        <div class="card">

            <form action="/mentor/update-question" method="POST">

                <input type="hidden" name="id" value="<%= question.id %>">
                <input type="hidden" name="quiz_id" value="<%= question.quiz_id %>">

                <!-- Question -->
                <label class="form-label">Question</label>
                <textarea name="question" class="form-control" rows="3" required>
<%= question.question %>
                </textarea>

                <!-- Options -->
                <div style="display:flex; gap:15px; flex-wrap:wrap;">

                    <div style="flex:1;">
                        <label class="form-label">Option 1</label>
                        <input type="text" name="option1" class="form-control"
                            value="<%= question.option1 %>" required>
                    </div>

                    <div style="flex:1;">
                        <label class="form-label">Option 2</label>
                        <input type="text" name="option2" class="form-control"
                            value="<%= question.option2 %>" required>
                    </div>

                    <div style="flex:1;">
                        <label class="form-label">Option 3</label>
                        <input type="text" name="option3" class="form-control"
                            value="<%= question.option3 %>" required>
                    </div>

                    <div style="flex:1;">
                        <label class="form-label">Option 4</label>
                        <input type="text" name="option4" class="form-control"
                            value="<%= question.option4 %>" required>
                    </div>

                </div>

                <!-- Correct Option -->
                <label class="form-label">Correct Option</label>
                <select name="correct_option" class="form-control" required>
                    <option value="1" <%=question.correct_option==1 ? "selected" : "" %>>Option 1</option>
                    <option value="2" <%=question.correct_option==2 ? "selected" : "" %>>Option 2</option>
                    <option value="3" <%=question.correct_option==3 ? "selected" : "" %>>Option 3</option>
                    <option value="4" <%=question.correct_option==4 ? "selected" : "" %>>Option 4</option>
                </select>

                <br>

                <button type="submit" class="btn-update">
                    Update Question
                </button>

            </form>

        </div>

    </div>

</body>

</html>