<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Farmácia Municipal de Itamonte - {% block title %}Portal{% endblock %}</title>
    <!-- Local CSS: offline-first, no external CDNs -->
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>

    <!-- Responsive Navbar -->
    <nav class="navbar" id="main-nav">
        <div class="nav-brand">
            <a href="{{ url_for('index') }}" class="nav-logo">
                <img src="{{ url_for('static', filename='img/logo.png') }}" alt="Logo" style="height: 40px; width: auto;">
            </a>
            <div class="nav-title">
                <span class="nav-title-main">Farmácia Municipal</span>
                <span class="nav-title-sub">Itamonte</span>
            </div>
        </div>
        
        <ul class="nav-links">
            <li><a href="{{ url_for('index') }}" id="nav-home">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>
                Início
            </a></li>
            <li><a href="{{ url_for('medicamentos_view') }}" id="nav-meds">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z"></path><path d="m8.5 8.5 7 7"></path></svg>
                Medicamentos
            </a></li>
            <li><a href="{{ url_for('guia_insulina') }}" id="nav-insulina">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z"></path></svg>
                Guia de Insulina
            </a></li>
            <li><a href="{{ url_for('monitor_glicose') }}" id="nav-glicose">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg>
                Monitor de Glicose
            </a></li>
            <!-- Outros links que não estavam na imagem, mas precisamos manter -->
            <li><a href="{{ url_for('alto_custo') }}" id="nav-altocusto">Alto Custo (CEAF)</a></li>
            <li><a href="{{ url_for('estrategicos') }}" id="nav-estrategicos">Estratégicos</a></li>
            <li><a href="{{ url_for('tabagismo') }}" id="nav-tabagismo">Tabagismo</a></li>
            
            {% if session.get('role') == 'admin' %}
            <li><a href="{{ url_for('admin_dashboard') }}" id="nav-admin">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg>
                Admin
            </a></li>
            {% endif %}
        </ul>
        
        <div class="user-badge-container">
            <span class="user-name-simple">{{ session.get('nome_completo') }}</span>
            <a href="{{ url_for('logout') }}" class="btn-logout-icon" title="Sair">
                <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>
            </a>
        </div>
    </nav>

    <!-- Main Container -->
    <div class="container">
        {% block content %}{% endblock %}
    </div>

    <!-- Local JS: offline-first -->
    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
    {% block scripts %}{% endblock %}
</body>
</html>
