<!DOCTYPE html>
<html lang="pt-BR">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="robots" content="noindex, nofollow" />
  <title>{% block title %}Painel{% endblock %} · DNS Shield ISP</title>
  <link rel="stylesheet" href="{{ url_for('static', filename='css/app.css') }}" />
</head>
<body>
<div class="layout">
  <aside class="sidebar">
    <div class="brand">
      <span class="brand-mark">DS</span>
      <div>
        <strong>DNS Shield ISP</strong>
        <small>v{{ app_version }}</small>
      </div>
    </div>
    <nav>
      <a href="{{ url_for('dashboard.index') }}" class="{{ 'active' if request.endpoint == 'dashboard.index' }}">Dashboard</a>
      <a href="{{ url_for('blocks.index') }}" class="{{ 'active' if request.blueprint == 'blocks' }}">Bloqueios judiciais</a>
      <a href="{{ url_for('exceptions.index') }}" class="{{ 'active' if request.blueprint == 'exceptions' }}">Domínios liberados / Exceções</a>
      <a href="{{ url_for('federacao.index') }}" class="{{ 'active' if request.blueprint == 'federacao' }}">Federação entre provedores</a>

      <a href="{{ url_for('settings.index') }}" class="{{ 'active' if request.blueprint == 'settings' }}">Configurações</a>
      <a href="{{ url_for('logs.index') }}" class="{{ 'active' if request.blueprint == 'logs' }}">Logs e auditoria</a>
      <a href="{{ url_for('update.index') }}" class="{{ 'active' if request.blueprint == 'update' }}">Atualizações</a>
    </nav>
    <div class="sidebar-foot">
      <p>{{ provider.trade_name or 'Provedor não configurado' }}</p>
      <small>{{ dev_name }}<br />{{ dev_email }}</small>
    </div>
  </aside>

  <main class="main">
    <header class="topbar">
      <h1>{% block heading %}Painel{% endblock %}</h1>
      <div class="topbar-user">
        <span>{{ current_user }}</span>
        <form method="post" action="{{ url_for('auth.logout') }}">
          <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
          <button class="btn btn-ghost" type="submit">Sair</button>
        </form>
      </div>
    </header>

    {% with messages = get_flashed_messages(with_categories=true) %}
      {% if messages %}
        <div class="flashes">
          {% for category, message in messages %}
            <div class="flash flash-{{ category }}">{{ message }}</div>
          {% endfor %}
        </div>
      {% endif %}
    {% endwith %}

    <div class="content">
      {% block content %}{% endblock %}
    </div>

    <footer class="footer">
      DNS Shield ISP {{ app_version }} — desenvolvido por {{ dev_name }} ({{ dev_email }})
    </footer>
  </main>
</div>
<script src="{{ url_for('static', filename='js/app.js') }}"></script>
</body>
</html>
