{% load static %}
<div></div>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style type="text/css">
      * {
        font-size: 20px;
      }

      button {
        border: none;
        width: 200px;
        height: 40px;
        margin-top: 10px;
        background: black;
        color: white;
      }

      .btnn, .file-upload > input[type='file'] {
        border: none;
        height: 40px;
        margin-top: 10px;
      }

      .file-upload {
        display: inline-block;  
      }

      .file-upload > input[type='file'] {
        top: 0;
        right: 0;
        height: 100%;
        opacity: 0;
        cursor: pointer;
        width: 0;
        height: 0;
      }

      .file-upload > span {
        display: inline-block;
        padding: 5px 10px;
        background-color: #000;
        border-radius: 5px;
        border: 1px solid #aaa;
        color: #fff;
        cursor: pointer;
      }

      .post-container {
        width: 600px;
        height: 500px;
        border: 2px solid black;
        border-radius: 10px;
        margin: 0 auto;
        display: flex;
        padding: 10px;
      }

      .post-container > div {
        width: 250px;
        height: 500px;
      }

      .post-container label {
        font-size: 16px;
      }

      .post-container input, .post-container textarea {
        width: 100%;
        height: 35px;
        margin-bottom: 10px;
        padding: 5px;
        border: 1px solid #ccc;
        border-radius: 5px;
      }

      .post-container textarea {
        height: 200px;
      }

      .preview-container {
        width: 600px;
        border: 2px solid black;
        border-radius: 10px;
        margin: 20px auto 0;
        padding: 10px;
      }

      .preview-container label {
        font-size: 16px;
      }

      .preview-container textarea, .preview-container select, .preview-container button {
        margin-top: 10px;
        width: 100%;
        padding: 5px;
        border: 1px solid #ccc;
        border-radius: 5px;
      }

      .preview-container select {
        height: 40px;
      }

      .preview-container button {
        height: 40px;
        background: black;
        color: white;
        border: none;
        font-size: 20px;
      }
      
    </style>
    <title>make post</title>
  </head>
  <body>
    <div>
      <form method="POST" action="{% url 'postres' %}" enctype="multipart/form-data">
        {% csrf_token %}
        <div class="post-container">
          <div>
            <label for="post_name">Название статьи</label>
            <input id="post_name" name="postname" value="" required>
            
            <label for="log">log</label>
            <textarea id="log"></textarea>

            <label for="authtor">Автор</label>
            <input id="authtor" name="authtor" value="" style="width: 160px;">
          </div>
          <div>
            <label for="header">Заголовок (max 69)</label>
            <input id="header" name="header" value="" maxlength="69">

            <label for="text">Текст</label>
            <textarea id="text" name="text"></textarea>

            <label for="img">Картинка:</label>
            <label class="file-upload">
              <span>Выбрать картинку/картинки</span>
              <input type="file" accept="image/jpeg, image/png" id="img" name="imgg" multiple>
            </label>

            <button type="button" onclick="clear_all()">Очистить</button>
            <button>Добавить</button>
          </div>
        </div>
      </form>

      <form method="POST" action="{% url 'blog_preview' %}" enctype="multipart/form-data" target="_blank">
        {% csrf_token %}
        <textarea style="display: none" name="to_list" id="to_list">
        </textarea>

        <textarea style="display: none" name="postnamee" id="post_namee">
        </textarea>

        <textarea style="display: none" name="authtorr" id="authtorr">
        </textarea>
        <div class="preview-container">
          <div style="display: flex; flex-direction: column; margin-right: 20px;">
            <label for="desc">Описание</label>
            <textarea id="desc" name="desc"></textarea>
          </div>

          <div style="display: flex; flex-direction: column;">
            <label style="font-size: 16px;">Картинка для предпросмотра</label>
            <label class="file-upload" style="margin-top: 10px;">
              <span>Выбрать картинку</span>
              <input type="file" accept="image/jpeg, image/png" id="imgg_preview" name="imgg_preview">
            </label>

            <select name="papka" required>
              <option value=""> </option>
              <option value="history">История</option>
              <option value="places">Места</option>
              <option value="celebrity">Знаменитости</option>
              <option value="theaters_and_music">Театры и музыка</option>
            </select>

            <button type="submit">Перейти к предпросмотру</button>
          </div>
        </div>
      </form>
    </div>
    <script src="{% static 'loginedtest/script.js' %}"></script>
  </body>
</html>