<%- include('partials/layout_start', { activePage: 'countries', pageTitle: 'Manage Countries (For Map)' }) %>

<div class="admin-section">
    <div style="max-width: 600px;">
        <form action="/admin/country/add" method="POST" style="margin-bottom: 30px; background: #1e293b; padding: 20px; border-radius: 8px; border: 1px solid #334155;">
            <h4 style="margin-top: 0; margin-bottom: 15px;">Add New Country</h4>
            <div style="display:flex; gap:15px; margin-bottom: 15px;">
                <input type="text" name="name" placeholder="Country Name (e.g. India)" required style="width:50%; padding: 10px; border: 1px solid #475569; background: #0f172a; color: #f1f5f9; border-radius: 4px;">
                <input type="text" name="code" placeholder="ISO Code (e.g. IN)" required style="width:50%; padding: 10px; border: 1px solid #475569; background: #0f172a; color: #f1f5f9; border-radius: 4px;">
            </div>
            <button type="submit" class="btn-primary" style="padding: 10px 20px; background-color: #f59e0b; color: #1e293b; border: none; font-weight: bold; cursor: pointer; border-radius: 4px;">Add Country</button>
        </form>
        
        <h4 style="margin-bottom: 15px;">Supported Countries</h4>
        <ul style="list-style: none; padding: 0; margin: 0;">
            <% countries.forEach(country => { %>
                <li style="display:flex; justify-content:space-between; align-items: center; margin-bottom:10px; padding: 15px; background: #1e293b; border: 1px solid #334155; border-radius: 6px;">
                    <div>
                        <strong><%= country.name %></strong> <span style="background: #e2e8f0; padding: 3px 8px; border-radius: 4px; font-size: 0.8em; margin-left: 10px; color: #475569;"><%= country.code %></span>
                    </div>
                    <form action="/admin/country/delete/<%= country.id %>" method="POST" style="margin:0;">
                        <button type="submit" style="color:white; background: #ef4444; border:none; cursor:pointer; width: 30px; height: 30px; border-radius: 4px; display: flex; align-items: center; justify-content: center;"><i class="fas fa-trash-alt"></i></button>
                    </form>
                </li>
            <% }) %>
        </ul>
    </div>
</div>

<%- include('partials/layout_end') %>
