<!DOCTYPE html>
<html>
<head>
  <title>탐색기 - {{ share_name }}</title>
  <style>
    body { font-family: 'Malgun Gothic', Arial, sans-serif; background:#fff; color:#222; }
    .folder { color: #007bff; font-weight: bold; cursor: pointer; }
    .file { color: #222; }
    .explorer { max-width: 650px; margin: 24px auto; }
    ul { list-style: none; padding:0; }
    li { margin: 7px 0; font-size: 16px;}
    .up { color:#777; }
  </style>
</head>
<body>
  <div class="explorer">
    <h2>공유폴더: {{ share_name }}</h2>
    <ul>
      {% for entry in entries %}
        {% if entry.is_dir %}
          {% if entry.is_parent %}
            <li class="up">
              <a href="{{ url_for('browse_share_explorer', share_name=share_name, path=entry.parent_path) }}">⬅ 상위 폴더로 이동</a>
            </li>
          {% else %}
            <li>
              <span class="folder">📁</span>
              <a href="{{ url_for('browse_share_explorer', share_name=share_name, path=(rel_path ~ '/' if rel_path else '') ~ entry.name) }}">
                {{ entry.name }}/
              </a>
            </li>
          {% endif %}
        {% else %}
          <li>
            <span class="file">📄</span>
            <a href="{{ url_for('file_download', share=share_name, path=(rel_path ~ '/' if rel_path else '') ~ entry.name) }}">
              {{ entry.name }}
            </a>
          </li>
        {% endif %}
      {% endfor %}
    </ul>
  </div>
</body>
</html>
