<!DOCTYPE html>
<html lang="ko">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Dell Server 정보 및 MAC 주소 처리 시스템">

    <title>{% block title %}Dell Server Info, MAC 정보 처리{% endblock %}</title>

    <link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">

    <!-- Bootstrap 5.3.3 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">

    <!-- Bootstrap Icons -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
        integrity="sha384-tViUnnbYAV00FLIhhi3v/dWt3Jxw4gZQcNoSCxCIFNJVCx7/D55/wXsrNIRANwdD" crossorigin="anonymous">

    <!-- Custom CSS -->
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">

    {% block extra_css %}{% endblock %}
</head>

<body>
    <!-- Skip to main content (접근성) -->
    <a href="#main-content" class="visually-hidden-focusable">본문으로 건너뛰기</a>

    {# 플래시 메시지 (전역) #}
    {% with messages = get_flashed_messages(with_categories=true) %}
    {% if messages %}
    <div class="position-fixed end-0 p-3" style="z-index: 2000; top: 70px;">
        {% for cat, msg in messages %}
        <div class="alert alert-{{ cat }} alert-dismissible fade show shadow-lg" role="alert">
            <i class="bi bi-{{ 'check-circle' if cat == 'success' else 'exclamation-triangle' }} me-2"></i>
            {{ msg }}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
        {% endfor %}
    </div>
    {% endif %}
    {% endwith %}

    <!-- Navigation -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
        <div class="container-fluid">
            <a class="navbar-brand" href="{{ url_for('home.home') }}">
                <i class="bi bi-server me-2"></i>
                Dell Server Info
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="네비게이션 토글">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('home.home') }}">
                            <i class="bi bi-house-door me-1"></i>Home
                        </a>
                    </li>
                    {% if current_user.is_authenticated %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('main.index') }}">
                            <i class="bi bi-hdd-network me-1"></i>ServerInfo
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('xml.xml_management') }}">
                            <i class="bi bi-file-code me-1"></i>XML Management
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('jobs.jobs_page') }}">
                            <i class="bi bi-list-task me-1"></i>Job Monitor
                        </a>
                    </li>
                    {% if current_user.is_admin %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('admin.admin_panel') }}">
                            <i class="bi bi-shield-lock me-1"></i>Admin
                        </a>
                    </li>
                    {% endif %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('auth.logout') }}">
                            <i class="bi bi-box-arrow-right me-1"></i>Logout
                        </a>
                    </li>
                    {% else %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('auth.login') }}">
                            <i class="bi bi-box-arrow-in-right me-1"></i>Login
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('auth.register') }}">
                            <i class="bi bi-person-plus me-1"></i>Register
                        </a>
                    </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <!-- Main Content -->
    <main id="main-content"
        class="{% if request.endpoint in ['auth.login', 'auth.register', 'auth.reset_password'] %}container mt-5{% else %}container mt-4 container-card{% endif %}">
        {% block content %}{% endblock %}
    </main>

    <!-- Footer (선택사항) -->
    <footer class="mt-5 py-3 bg-light text-center">
        <div class="container">
            <small class="text-muted">&copy; 2025 Dell Server Info. All rights reserved.</small>
        </div>
    </footer>

    <!-- Bootstrap 5.3.3 JS Bundle (Popper.js 포함) -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
        crossorigin="anonymous"></script>

    <!-- Socket.IO (필요한 경우만) -->
    {% if config.USE_SOCKETIO %}
    <script src="https://cdn.socket.io/4.7.4/socket.io.min.js"
        integrity="sha384-Gr6Lu2Ajx28mzwyVR8CFkULdCU7kMlZ9UthllibdOSo6qAiN+yXNHqtgdTvFXMT4"
        crossorigin="anonymous"></script>
    {% endif %}

    {% block scripts %}{% endblock %}
</body>

</html>