<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>New Support Ticket</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            line-height: 1.6;
            color: #333333;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
        }
        .email-container {
            max-width: 700px;
            margin: 20px auto;
            background-color: #ffffff;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }
        .email-header {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            color: #ffffff;
            padding: 30px;
            text-align: center;
        }
        .email-header h1 {
            margin: 0;
            font-size: 24px;
            font-weight: 600;
        }
        .alert-badge {
            background-color: rgba(255, 255, 255, 0.2);
            padding: 8px 16px;
            border-radius: 20px;
            display: inline-block;
            margin-top: 10px;
            font-size: 14px;
        }
        .email-body {
            padding: 40px 30px;
        }
        .ticket-number-box {
            background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
            border-left: 4px solid #ef4444;
            padding: 20px;
            margin: 25px 0;
            border-radius: 4px;
        }
        .ticket-number {
            font-size: 28px;
            font-weight: 700;
            color: #ef4444;
            font-family: 'Courier New', monospace;
            letter-spacing: 1px;
        }
        .customer-info {
            background-color: #f8f9fa;
            padding: 20px;
            border-radius: 6px;
            margin: 25px 0;
        }
        .info-grid {
            display: grid;
            grid-template-columns: 140px 1fr;
            gap: 12px;
        }
        .info-label {
            font-weight: 600;
            color: #555555;
        }
        .info-value {
            color: #333333;
        }
        .priority-badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 700;
            text-transform: uppercase;
        }
        .priority-high {
            background-color: #f59e0b;
            color: white;
        }
        .priority-medium {
            background-color: #3b82f6;
            color: white;
        }
        .priority-low {
            background-color: #6b7280;
            color: white;
        }
        .priority-critical {
            background-color: #ef4444;
            color: white;
        }
        .cta-button {
            display: inline-block;
            background: linear-gradient(135deg, #0f172a, #1e293b);
            color: #ffffff !important;
            text-decoration: none;
            padding: 14px 32px;
            border-radius: 6px;
            font-weight: 600;
            margin: 20px 0;
        }
        .footer {
            background-color: #f8f8f8;
            padding: 25px 30px;
            text-align: center;
            font-size: 14px;
            color: #666666;
        }
        .description-box {
            background-color: #f8f8f8;
            padding: 20px;
            border-radius: 6px;
            border-left: 3px solid #daa520;
            margin: 20px 0;
            white-space: pre-wrap;
        }
    </style>
</head>
<body>
    <div class="email-container">
        <!-- Header -->
        <div class="email-header">
            <h1>🎫 New Support Ticket</h1>
            <div class="alert-badge">Requires Attention</div>
        </div>

        <!-- Body -->
        <div class="email-body">
            <p><strong>A new support ticket has been submitted and requires your attention.</strong></p>

            <!-- Ticket Number Box -->
            <div class="ticket-number-box">
                <div style="font-size: 14px; color: #666; margin-bottom: 8px;">Ticket Number</div>
                <div class="ticket-number">{{ ticket_number }}</div>
                <div style="margin-top: 15px;">
                    <span class="info-label">Created:</span> {{ created_at }}
                </div>
            </div>

            <!-- Customer Information -->
            <div class="customer-info">
                <h3 style="margin-top: 0; color: #0f172a;">Customer Information</h3>
                <div class="info-grid">
                    <div class="info-label">Name:</div>
                    <div class="info-value">{{ user_name }}</div>
                    
                    <div class="info-label">Email:</div>
                    <div class="info-value"><a href="mailto:{{ user_email }}" style="color: #3b82f6;">{{ user_email }}</a></div>
                    
                    {% if user_phone %}
                    <div class="info-label">Phone:</div>
                    <div class="info-value"><a href="tel:{{ user_phone }}" style="color: #3b82f6;">{{ user_phone }}</a></div>
                    {% endif %}
                    
                    {% if company %}
                    <div class="info-label">Company:</div>
                    <div class="info-value">{{ company }}</div>
                    {% endif %}
                </div>
            </div>

            <!-- Ticket Details -->
            <div style="margin: 25px 0;">
                <h3 style="color: #0f172a;">Ticket Details</h3>
                
                <div style="margin: 15px 0;">
                    <div class="info-label" style="display: block; margin-bottom: 8px;">Subject:</div>
                    <div style="font-size: 18px; font-weight: 600; color: #0f172a;">{{ title }}</div>
                </div>
                
                <div class="info-grid" style="margin-top: 20px;">
                    <div class="info-label">Type:</div>
                    <div class="info-value">{{ ticket_type }}</div>
                    
                    <div class="info-label">Category:</div>
                    <div class="info-value">{{ category }}</div>
                    
                    <div class="info-label">Priority:</div>
                    <div>
                        {% if priority == 'Critical' %}
                            <span class="priority-badge priority-critical">{{ priority }}</span>
                        {% elif priority == 'High' %}
                            <span class="priority-badge priority-high">{{ priority }}</span>
                        {% elif priority == 'Low' %}
                            <span class="priority-badge priority-low">{{ priority }}</span>
                        {% else %}
                            <span class="priority-badge priority-medium">{{ priority }}</span>
                        {% endif %}
                    </div>
                    
                    <div class="info-label">Status:</div>
                    <div class="info-value">{{ status }}</div>
                </div>
            </div>

            <!-- Description -->
            <div>
                <h3 style="color: #0f172a;">Description</h3>
                <div class="description-box">{{ description }}</div>
            </div>

            <!-- Action Buttons -->
            <div style="text-align: center; margin: 40px 0 20px;">
                <a href="{{ admin_url }}" class="cta-button" style="margin-right: 10px;">View in Admin Panel</a>
                <a href="mailto:{{ user_email }}" class="cta-button" style="background: linear-gradient(135deg, #daa520, #d4af37);">Reply to Customer</a>
            </div>

            <div style="background-color: #fff3cd; border-left: 4px solid #ffc107; padding: 15px; border-radius: 4px; margin-top: 30px;">
                <strong>⚠️ Action Required</strong><br>
                Please review and respond to this ticket according to the SLA requirements for {{ priority }} priority tickets.
            </div>
        </div>

        <!-- Footer -->
        <div class="footer">
            <p style="margin: 0 0 10px 0;">
                <strong>GNX Software Solutions</strong><br>
                Internal Support Notification
            </p>
            <p style="margin: 0; font-size: 12px;">
                This is an automated notification for new support tickets.<br>
                Manage tickets in the <a href="{{ admin_url }}" style="color: #3b82f6;">Admin Panel</a>
            </p>
        </div>
    </div>
</body>
</html>

