<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>System Logs - Fixture Manager</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f5f5f5;
        }
        .header {
            background-color: #007bff;
            color: white;
            padding: 1rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .logo {
            font-size: 1.5rem;
            font-weight: bold;
        }
        .nav {
            display: flex;
            gap: 1rem;
        }
        .nav a {
            color: white;
            text-decoration: none;
            padding: 0.5rem 1rem;
            border-radius: 4px;
            transition: background-color 0.3s;
        }
        .nav a:hover {
            background-color: rgba(255,255,255,0.1);
        }
        .container { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
        .btn { padding: 8px 16px; background-color: #007bff; color: white; text-decoration: none; border-radius: 4px; display: inline-block; margin: 0.5rem 0; }
        .log-container { max-height: 600px; overflow-y: auto; background: #f8f9fa; padding: 1rem; border-radius: 4px; margin-top: 1rem; }
        .log-entry { margin-bottom: 1rem; padding: 1rem; background: white; border-radius: 4px; border-left: 4px solid #007bff; }
        .log-error { border-left-color: #dc3545; }
        .log-warning { border-left-color: #ffc107; }
        .log-info { border-left-color: #17a2b8; }
        .log-header { font-weight: bold; margin-bottom: 0.5rem; }
        .log-time { color: #666; font-size: 0.9rem; }
        .log-message { margin-top: 0.5rem; }
    </style>
</head>
<body>
    <div class="header">
        <div class="logo">🥊 Fixture Manager</div>
        <div class="nav">
            <a href="{{ url_for('main.dashboard') }}">Dashboard</a>
            <a href="{{ url_for('main.fixtures') }}">Fixtures</a>
            <a href="{{ url_for('main.uploads') }}">Uploads</a>
            <a href="{{ url_for('main.statistics') }}">Statistics</a>
            {% if current_user.is_admin %}
                <a href="{{ url_for('main.admin_panel') }}">Admin</a>
            {% endif %}
            <a href="{{ url_for('auth.logout') }}">Logout</a>
        </div>
    </div>

    <div class="container">
        <h1>System Logs</h1>
        <a href="{{ url_for('main.admin_panel') }}" class="btn">← Back to Admin Panel</a>
        
        {% if logs %}
        <div class="log-container">
            {% for log in logs %}
            <div class="log-entry log-{{ log.level.lower() if log.level else 'info' }}">
                <div class="log-header">
                    <span style="text-transform: uppercase;">{{ log.level or 'INFO' }}</span>
                    {% if log.module %}
                    - {{ log.module }}
                    {% endif %}
                </div>
                <div class="log-time">{{ log.created_at.strftime('%Y-%m-%d %H:%M:%S') if log.created_at else 'N/A' }}</div>
                <div class="log-message">{{ log.message or 'No message' }}</div>
            </div>
            {% endfor %}
        </div>
        {% else %}
        <p>No logs found.</p>
        {% endif %}
    </div>
</body>
</html>