{% extends "base.html" %}
{% block title %}Nginx 사용자 관리 - 리얼컴 NAS UI{% endblock %}
{% block content %}
<div class="container" style="max-width: 600px; margin-top: 32px;">

  <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px;">
    <h2 style="margin:0;">웹 사용자 관리</h2>
    <a href="{{ url_for('nginx_users_add') }}" class="btn btn-success" style="padding: 8px 18px; border-radius: 2rem; font-weight: 500; box-shadow:0 2px 8px #21c9941a;">
      + 사용자 추가
    </a>
  </div>

  {% if users %}
  <div style="display: flex; flex-direction: column; gap: 16px;">
    {% for user in users %}
      <div style="
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #f9fafd;
        border-radius: 16px;
        padding: 16px 24px;
        box-shadow: 0 2px 10px #0001;
        border:1px solid #f1f3f8;">
        <div style="font-size: 1.12rem; font-weight: 600; color: #202234;">
          <i class="bi bi-person-badge" style="margin-right:10px; color:#46bb8a;"></i>
          {{ user }}
        </div>
        <div style="display: flex; gap: 10px;">
          <a href="{{ url_for('nginx_users_change_password', username=user) }}" class="btn btn-primary btn-sm" style="border-radius: 1rem; font-weight:500;">
            비밀번호 변경
          </a>
          <form method="post" action="{{ url_for('nginx_users_delete', username=user) }}" style="display:inline;" onsubmit="return confirm('사용자 {{ user }} 을(를) 삭제하시겠습니까?');">
            <button type="submit" class="btn btn-danger btn-sm" style="border-radius: 1rem; font-weight:500;">
              삭제
            </button>
          </form>
        </div>
      </div>
    {% endfor %}
  </div>
  {% else %}
    <div style="text-align:center; color:#bbb; padding: 56px 0 20px 0;">
      <i class="bi bi-emoji-neutral" style="font-size:44px; margin-bottom:12px;"></i>
      <div style="margin-top:10px; font-size:1.15rem;">등록된 사용자가 없습니다.</div>
    </div>
  {% endif %}
</div>
{% endblock %}
