<!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>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            line-height: 1.7;
            color: #2c3e50;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            margin: 0;
            padding: 40px 20px;
        }
        
        .email-wrapper {
            max-width: 700px;
            margin: 0 auto;
            background: #ffffff;
            border-radius: 16px;
            overflow: hidden;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
        }
        
        .email-header {
            background: linear-gradient(135deg, #dc2626 0%, #ef4444 50%, #f87171 100%);
            padding: 50px 40px;
            text-align: center;
            position: relative;
            overflow: hidden;
        }
        
        .email-header::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
        }
        
        .email-header h1 {
            color: #ffffff;
            font-size: 32px;
            font-weight: 700;
            margin: 0;
            position: relative;
            z-index: 2;
            letter-spacing: -0.5px;
            text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        }
        
        .alert-badge {
            background-color: rgba(255, 255, 255, 0.25);
            backdrop-filter: blur(10px);
            padding: 10px 24px;
            border-radius: 25px;
            display: inline-block;
            margin-top: 15px;
            font-size: 14px;
            font-weight: 700;
            color: #ffffff;
            text-transform: uppercase;
            letter-spacing: 1px;
            position: relative;
            z-index: 2;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        }
        
        .email-body {
            padding: 50px 40px;
            background: #ffffff;
        }
        
        .intro-alert {
            background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
            border-left: 5px solid #ef4444;
            padding: 20px 25px;
            border-radius: 8px;
            margin-bottom: 35px;
            font-weight: 600;
            color: #991b1b;
            font-size: 16px;
        }
        
        .ticket-number-box {
            background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
            border: 2px solid rgba(239, 68, 68, 0.2);
            border-left: 5px solid #ef4444;
            padding: 30px;
            margin: 35px 0;
            border-radius: 12px;
            text-align: center;
            box-shadow: 0 4px 20px rgba(239, 68, 68, 0.15);
        }
        
        .ticket-label {
            font-size: 13px;
            color: #64748b;
            text-transform: uppercase;
            letter-spacing: 1.5px;
            font-weight: 600;
            margin-bottom: 12px;
        }
        
        .ticket-number {
            font-size: 36px;
            font-weight: 800;
            color: #ef4444;
            font-family: 'Courier New', monospace;
            letter-spacing: 2px;
        }
        
        .customer-info {
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
            padding: 30px;
            border-radius: 12px;
            margin: 35px 0;
            border: 1px solid #e2e8f0;
        }
        
        .section-title {
            font-size: 20px;
            font-weight: 700;
            color: #0f172a;
            margin-bottom: 25px;
            padding-bottom: 12px;
            border-bottom: 2px solid #e2e8f0;
            position: relative;
        }
        
        .section-title::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 60px;
            height: 2px;
            background: linear-gradient(90deg, #ef4444, #dc2626);
        }
        
        .info-grid {
            display: grid;
            grid-template-columns: 140px 1fr;
            gap: 18px;
            align-items: start;
        }
        
        .info-label {
            font-weight: 600;
            color: #475569;
            font-size: 14px;
        }
        
        .info-value {
            color: #1e293b;
            font-size: 15px;
        }
        
        .info-value a {
            color: #3b82f6;
            text-decoration: none;
            font-weight: 600;
        }
        
        .info-value a:hover {
            text-decoration: underline;
        }
        
        .ticket-details {
            margin: 35px 0;
        }
        
        .subject-box {
            background: #f8fafc;
            border-left: 4px solid #daa520;
            padding: 20px;
            border-radius: 8px;
            margin: 20px 0;
        }
        
        .subject-box .subject-label {
            font-size: 13px;
            color: #64748b;
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 600;
            margin-bottom: 8px;
        }
        
        .subject-box .subject-value {
            font-size: 20px;
            font-weight: 700;
            color: #0f172a;
        }
        
        .priority-badge {
            display: inline-block;
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }
        
        .priority-critical {
            background: linear-gradient(135deg, #ef4444, #dc2626);
            color: white;
        }
        
        .priority-high {
            background: linear-gradient(135deg, #f59e0b, #d97706);
            color: white;
        }
        
        .priority-medium {
            background: linear-gradient(135deg, #3b82f6, #2563eb);
            color: white;
        }
        
        .priority-low {
            background: linear-gradient(135deg, #6b7280, #4b5563);
            color: white;
        }
        
        .description-box {
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-left: 4px solid #daa520;
            padding: 25px;
            border-radius: 8px;
            white-space: pre-wrap;
            font-size: 15px;
            line-height: 1.8;
            color: #334155;
            margin-top: 15px;
        }
        
        .action-buttons {
            display: flex;
            gap: 15px;
            margin: 45px 0;
            flex-wrap: wrap;
        }
        
        .cta-button {
            display: inline-block;
            color: #ffffff !important;
            text-decoration: none;
            padding: 18px 35px;
            border-radius: 10px;
            font-weight: 700;
            font-size: 15px;
            letter-spacing: 0.5px;
            text-align: center;
            flex: 1;
            min-width: 200px;
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
        }
        
        .cta-button-primary {
            background: linear-gradient(135deg, #0f172a, #1e293b);
        }
        
        .cta-button-secondary {
            background: linear-gradient(135deg, #daa520, #d4af37);
        }
        
        .cta-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
        }
        
        .sla-warning {
            background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
            border-left: 5px solid #f59e0b;
            padding: 20px 25px;
            border-radius: 8px;
            margin-top: 35px;
        }
        
        .sla-warning strong {
            color: #92400e;
            font-size: 16px;
            display: block;
            margin-bottom: 8px;
        }
        
        .sla-warning p {
            color: #78350f;
            font-size: 14px;
            margin: 0;
            line-height: 1.6;
        }
        
        .email-footer {
            background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
            padding: 40px;
            text-align: center;
            color: rgba(255, 255, 255, 0.9);
        }
        
        .footer-company {
            font-size: 18px;
            font-weight: 700;
            color: #ffffff;
            margin-bottom: 8px;
        }
        
        .footer-tagline {
            font-size: 14px;
            color: rgba(255, 255, 255, 0.7);
            margin-bottom: 25px;
        }
        
        .footer-links {
            margin: 25px 0;
            padding-top: 25px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .footer-links a {
            color: #daa520;
            text-decoration: none;
            font-weight: 600;
            font-size: 14px;
            margin: 0 15px;
        }
        
        .footer-links a:hover {
            text-decoration: underline;
        }
        
        .footer-note {
            font-size: 12px;
            color: rgba(255, 255, 255, 0.6);
            margin-top: 25px;
            line-height: 1.6;
        }
        
        @media (max-width: 600px) {
            body {
                padding: 20px 10px;
            }
            
            .email-header {
                padding: 40px 25px;
            }
            
            .email-header h1 {
                font-size: 26px;
            }
            
            .email-body {
                padding: 35px 25px;
            }
            
            .info-grid {
                grid-template-columns: 1fr;
                gap: 12px;
            }
            
            .action-buttons {
                flex-direction: column;
            }
            
            .cta-button {
                width: 100%;
            }
        }
    </style>
</head>
<body>
    <div class="email-wrapper">
        <!-- Header -->
        <div class="email-header">
            <h1>🎫 New Support Ticket</h1>
            <div class="alert-badge">Requires Attention</div>
        </div>

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

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

            <!-- Customer Information -->
            <div class="customer-info">
                <h3 class="section-title">Customer Information</h3>
                <div class="info-grid">
                    <div class="info-label">Name:</div>
                    <div class="info-value"><strong>{{ user_name }}</strong></div>
                    
                    <div class="info-label">Email:</div>
                    <div class="info-value"><a href="mailto:{{ user_email }}">{{ user_email }}</a></div>
                    
                    {% if user_phone %}
                    <div class="info-label">Phone:</div>
                    <div class="info-value"><a href="tel:{{ user_phone }}">{{ 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 class="ticket-details">
                <h3 class="section-title">Ticket Details</h3>
                
                <div class="subject-box">
                    <div class="subject-label">Subject</div>
                    <div class="subject-value">{{ title }}</div>
                </div>
                
                <div class="info-grid" style="margin-top: 25px;">
                    <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 class="section-title">Description</h3>
                <div class="description-box">{{ description }}</div>
            </div>

            <!-- Action Buttons -->
            <div class="action-buttons">
                <a href="{{ admin_url }}" class="cta-button cta-button-primary">View in Admin Panel</a>
                <a href="mailto:{{ user_email }}" class="cta-button cta-button-secondary">Reply to Customer</a>
            </div>

            <!-- SLA Warning -->
            <div class="sla-warning">
                <strong>⚠️ Action Required</strong>
                <p>Please review and respond to this ticket according to the SLA requirements for <strong>{{ priority }}</strong> priority tickets.</p>
            </div>
        </div>

        <!-- Footer -->
        <div class="email-footer">
            <div class="footer-company">GNX Software Solutions</div>
            <div class="footer-tagline">Internal Support Notification</div>
            
            <div class="footer-links">
                <a href="{{ admin_url }}">Admin Panel</a>
            </div>
            
            <div class="footer-note">
                This is an automated notification for new support tickets.<br>
                Manage tickets in the <a href="{{ admin_url }}" style="color: #daa520;">Admin Panel</a>
            </div>
        </div>
    </div>
</body>
</html>
