<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Upload Fixture - 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: 800px;
            margin: 2rem auto;
            padding: 0 2rem;
        }
        .upload-section {
            background: white;
            padding: 2rem;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        .form-group {
            margin-bottom: 1.5rem;
        }
        label {
            display: block;
            margin-bottom: 0.5rem;
            color: #333;
            font-weight: bold;
        }
        input[type="file"], textarea {
            width: 100%;
            padding: 12px;
            border: 2px dashed #ddd;
            border-radius: 4px;
            background-color: #fafafa;
            cursor: pointer;
            box-sizing: border-box;
        }
        textarea {
            border: 1px solid #ddd;
            cursor: text;
            resize: vertical;
        }
        input[type="file"]:hover {
            border-color: #007bff;
        }
        .btn {
            padding: 12px 24px;
            background-color: #28a745;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 1rem;
            font-weight: bold;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        .btn:hover {
            background-color: #218838;
        }
        .btn-secondary {
            background-color: #6c757d;
            margin-left: 1rem;
        }
        .btn-secondary:hover {
            background-color: #545b62;
        }
        .alert {
            padding: 12px;
            margin-bottom: 1rem;
            border-radius: 4px;
        }
        .alert-error {
            background-color: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        .alert-success {
            background-color: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        .info-box {
            background-color: #e7f3ff;
            border: 1px solid #b3d9ff;
            padding: 1rem;
            border-radius: 4px;
            margin-bottom: 1.5rem;
        }
        .info-box h3 {
            margin-top: 0;
            color: #0066cc;
        }
        .file-requirements {
            font-size: 0.9rem;
            color: #666;
        }
        .file-requirements ul {
            margin: 0.5rem 0;
            padding-left: 1.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>
            <a href="{{ url_for('main.user_tokens') }}">API Tokens</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>Upload Fixture File</h1>
        
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="alert alert-{{ 'error' if category == 'error' else 'success' }}">
                        {{ message }}
                    </div>
                {% endfor %}
            {% endif %}
        {% endwith %}

        <div class="info-box">
            <h3>📋 File Requirements</h3>
            <div class="file-requirements">
                <p>Please ensure your fixture file meets the following requirements:</p>
                <ul>
                    <li><strong>File Format:</strong> CSV, XLSX, or XLS</li>
                    <li><strong>Required Columns:</strong>
                        <ul>
                            <li>Match Number (match #, match_number, match no, etc.)</li>
                            <li>Fighter 1 (fighter1, fighter 1, etc.)</li>
                            <li>Fighter 2 (fighter2, fighter 2, etc.)</li>
                            <li>Venue (venue, location, kampala township, etc.)</li>
                        </ul>
                    </li>
                    <li><strong>Optional:</strong> Outcome columns with numeric data</li>
                    <li><strong>Encoding:</strong> UTF-8 recommended for CSV files</li>
                </ul>
            </div>
        </div>

        <div class="upload-section">
            <form method="POST" enctype="multipart/form-data">
                {{ form.hidden_tag() }}
                
                <div class="form-group">
                    {{ form.fixture_file.label }}
                    {{ form.fixture_file() }}
                    <div class="file-requirements">
                        <small>Supported formats: .csv, .xlsx, .xls (Max size: 10MB)</small>
                    </div>
                </div>
                
                {% if form.description %}
                <div class="form-group">
                    {{ form.description.label }}
                    {{ form.description(class="form-control", rows="3", placeholder="Optional description for this fixture upload...") }}
                </div>
                {% endif %}
                
                <div class="form-group">
                    {{ form.submit(class="btn") }}
                    <a href="{{ url_for('main.dashboard') }}" class="btn btn-secondary">Cancel</a>
                </div>
            </form>
        </div>
    </div>
</body>
</html>