<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>New sign-in to your account</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            line-height: 1.6;
            color: #333;
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f8f9fa;
        }
        .container {
            background: white;
            border-radius: 12px;
            padding: 40px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.08);
        }
        .header {
            text-align: center;
            margin-bottom: 30px;
        }
        .icon {
            font-size: 48px;
            margin-bottom: 10px;
        }
        h1 {
            font-size: 22px;
            font-weight: 600;
            color: #1a1a1a;
            margin: 0 0 8px 0;
        }
        .subtitle {
            color: #6b7280;
            font-size: 15px;
            margin: 0;
        }
        .details-table {
            width: 100%;
            margin: 24px 0;
            border-collapse: collapse;
        }
        .details-table td {
            padding: 12px 0;
            border-bottom: 1px solid #f0f0f0;
            font-size: 15px;
        }
        .details-table td:first-child {
            color: #6b7280;
            width: 120px;
            font-weight: 500;
        }
        .details-table td:last-child {
            color: #1a1a1a;
            font-weight: 500;
        }
        .details-table tr:last-child td {
            border-bottom: none;
        }
        .warning-box {
            background: #fff7ed;
            border: 1px solid #fed7aa;
            border-radius: 8px;
            padding: 16px 20px;
            margin: 24px 0;
            font-size: 14px;
            color: #9a3412;
        }
        .button-container {
            text-align: center;
            margin: 28px 0;
        }
        .button {
            display: inline-block;
            background: #2563eb;
            color: white !important;
            padding: 12px 28px;
            text-decoration: none;
            border-radius: 8px;
            font-weight: 600;
            font-size: 15px;
        }
        .footer {
            text-align: center;
            margin-top: 32px;
            padding-top: 20px;
            border-top: 1px solid #e5e7eb;
            color: #9ca3af;
            font-size: 13px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <div class="icon">&#x1F512;</div>
            <h1>New sign-in detected</h1>
            <p class="subtitle">Your {{ project_name }} account was just signed into</p>
        </div>

        <p>Hello {{ user.get_full_name|default:user.username }},</p>
        <p>We noticed a new sign-in to your account. Here are the details:</p>

        <table class="details-table">
            <tr>
                <td>Device</td>
                <td>{{ device }}</td>
            </tr>
            <tr>
                <td>IP Address</td>
                <td>{{ ip_address }}</td>
            </tr>
            <tr>
                <td>Time</td>
                <td>{{ login_time }}</td>
            </tr>
        </table>

        <div class="warning-box">
            If this was you, no further action is needed.<br>
            If you didn't sign in, please change your password and review your account security immediately.
        </div>

        {% if button_url %}
        <div class="button-container">
            <a href="{{ button_url }}" class="button">Review Account Activity</a>
        </div>
        {% endif %}

        <div class="footer">
            <p>This is an automated security notification from {{ project_name }}.</p>
            <p>You received this because a sign-in occurred on your account.</p>
        </div>
    </div>
</body>
</html>
