<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>New Contact Form Submission - <?php echo SITE_NAME; ?></title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: #f4f6fa;
            line-height: 1.6;
            color: #212121;
        }
        
        .email-wrapper {
            max-width: 600px;
            margin: 20px auto;
            background: white;
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        
        .email-header {
            background: linear-gradient(135deg, #212121, #2a2a2a);
            padding: 30px;
            color: white;
            border-bottom: 3px solid #ff7403;
        }
        
        .header-title {
            font-size: 24px;
            font-weight: 700;
            margin-bottom: 5px;
        }
        
        .header-subtitle {
            color: rgba(255,255,255,0.7);
            font-size: 14px;
        }
        
        .alert-badge {
            background: #ff7403;
            color: white;
            display: inline-block;
            padding: 5px 15px;
            border-radius: 50px;
            font-size: 12px;
            font-weight: 600;
            margin-top: 10px;
        }
        
        .email-body {
            padding: 30px;
        }
        
        .section-title {
            font-size: 18px;
            font-weight: 700;
            margin: 20px 0 15px;
            color: #212121;
            padding-bottom: 5px;
            border-bottom: 2px solid #f0f0f0;
        }
        
        .info-grid {
            background: #f8f5ff;
            border-radius: 15px;
            padding: 20px;
            margin: 15px 0;
        }
        
        .info-row {
            display: flex;
            padding: 10px 0;
            border-bottom: 1px solid #e0e0e0;
        }
        
        .info-row:last-child {
            border-bottom: none;
        }
        
        .info-label {
            width: 120px;
            font-weight: 600;
            color: #6b03fc;
        }
        
        .info-value {
            flex: 1;
            color: #212121;
        }
        
        .message-card {
            background: white;
            border: 1px solid #e0e0e0;
            border-radius: 10px;
            padding: 20px;
            margin: 20px 0;
            font-style: italic;
            color: #4a4a4a;
        }
        
        .meta-info {
            background: #f4f6fa;
            border-radius: 10px;
            padding: 15px;
            margin: 20px 0;
            font-size: 14px;
            color: #5f5f6b;
        }
        
        .meta-item {
            margin: 5px 0;
        }
        
        .action-buttons {
            display: flex;
            gap: 10px;
            margin: 30px 0;
            flex-wrap: wrap;
        }
        
        .btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 12px 20px;
            border-radius: 50px;
            text-decoration: none;
            font-weight: 600;
            font-size: 14px;
            transition: all 0.3s;
        }
        
        .btn-primary {
            background: #6b03fc;
            color: white;
        }
        
        .btn-secondary {
            background: #ff7403;
            color: white;
        }
        
        .btn-outline {
            background: white;
            border: 2px solid #6b03fc;
            color: #6b03fc;
        }
        
        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        
        .email-footer {
            background: #f4f6fa;
            padding: 20px;
            text-align: center;
            font-size: 13px;
            color: #5f5f6b;
            border-top: 1px solid #e0e0e0;
        }
        
        @media (max-width: 600px) {
            .info-row {
                flex-direction: column;
            }
            
            .info-label {
                width: 100%;
                margin-bottom: 5px;
            }
            
            .action-buttons {
                flex-direction: column;
            }
            
            .btn {
                width: 100%;
                justify-content: center;
            }
        }
    </style>
</head>
<body>
    <div class="email-wrapper">
        <!-- Header -->
        <div class="email-header">
            <div class="header-title">📬 New Contact Form Submission</div>
            <div class="header-subtitle"><?php echo SITE_NAME; ?> - Lead Notification</div>
            <div class="alert-badge">URGENT: Respond within 24h</div>
        </div>
        
        <!-- Body -->
        <div class="email-body">
            <div class="section-title">👤 Contact Information</div>
            
            <div class="info-grid">
                <div class="info-row">
                    <div class="info-label">Full Name:</div>
                    <div class="info-value"><strong><?php echo htmlspecialchars($data['name']); ?></strong></div>
                </div>
                <div class="info-row">
                    <div class="info-label">Email:</div>
                    <div class="info-value">
                        <a href="mailto:<?php echo htmlspecialchars($data['email']); ?>">
                            <?php echo htmlspecialchars($data['email']); ?>
                        </a>
                    </div>
                </div>
                <div class="info-row">
                    <div class="info-label">Phone:</div>
                    <div class="info-value">
                        <?php if (!empty($data['phone'])): ?>
                            <a href="tel:<?php echo htmlspecialchars($data['phone']); ?>">
                                <?php echo htmlspecialchars($data['phone']); ?>
                            </a>
                        <?php else: ?>
                            <em>Not provided</em>
                        <?php endif; ?>
                    </div>
                </div>
                <div class="info-row">
                    <div class="info-label">Interest:</div>
                    <div class="info-value">
                        <strong><?php echo htmlspecialchars($data['interest']); ?></strong>
                    </div>
                </div>
            </div>
            
            <div class="section-title">💬 Message</div>
            <div class="message-card">
                "<?php echo nl2br(htmlspecialchars($data['message'])); ?>"
            </div>
            
            <div class="section-title">📊 Lead Details</div>
            
            <div class="meta-info">
                <div class="meta-item"><strong>Date:</strong> <?php echo $data['date']; ?></div>
                <div class="meta-item"><strong>Time:</strong> <?php echo $data['time']; ?></div>
                <div class="meta-item"><strong>IP Address:</strong> <?php echo $data['ip']; ?></div>
                <div class="meta-item"><strong>User Agent:</strong> <?php echo $data['user_agent']; ?></div>
            </div>
            
            <div class="action-buttons">
                <a href="mailto:<?php echo htmlspecialchars($data['email']); ?>" class="btn btn-primary">
                    <i>📧</i> Reply to Lead
                </a>
                <?php if (!empty($data['phone'])): ?>
                <a href="tel:<?php echo htmlspecialchars($data['phone']); ?>" class="btn btn-secondary">
                    <i>📞</i> Call Lead
                </a>
                <?php endif; ?>
                <a href="#" class="btn btn-outline">
                    <i>✓</i> Mark as Contacted
                </a>
            </div>
            
            <p style="color: #5f5f6b; font-size: 14px; margin-top: 20px;">
                <i>⏱️ Response time target: Within 24 hours for best conversion.</i>
            </p>
        </div>
        
        <!-- Footer -->
        <div class="email-footer">
            <p>This is an automated notification from <?php echo SITE_NAME; ?>.</p>
            <p style="margin-top: 10px;">
                <a href="<?php echo SITE_URL; ?>/admin" style="color: #6b03fc;">Admin Dashboard</a> | 
                <a href="<?php echo SITE_URL; ?>/php/contacts.log" style="color: #6b03fc;">View Logs</a>
            </p>
        </div>
    </div>
</body>
</html>