<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>You've Received a Voucher!</title>
    <style>
        body {
            font-family: 'Poppins', Arial, sans-serif;
            line-height: 1.6;
            margin: 0;
            padding: 0;
            background-color: #f3f4f6;
        }
        .container {
            max-width: 600px;
            margin: 30px auto;
            padding: 30px;
            background-color: #ffffff;
            border-radius: 12px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
            text-align: center;
        }
        .logo {
            margin-bottom: 25px;
            max-width: 180px;
            height: auto;
        }
        .gift-illustration {
            font-size: 50px;
            margin: 10px 0;
        }
        h1 {
            color: #1a365d;
            font-size: 24px;
            margin-bottom: 15px;
            font-weight: 600;
        }
        p {
            color: #4a5568;
            font-size: 16px;
            margin-bottom: 20px;
            text-align: center;
        }
        .voucher-card {
            background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
            color: #ffffff;
            padding: 30px;
            border-radius: 10px;
            margin: 25px 0;
            position: relative;
            box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
            text-align: center;
        }
        .voucher-value {
            font-size: 36px;
            font-weight: 800;
            margin-bottom: 5px;
            letter-spacing: 1px;
        }
        .voucher-type {
            font-size: 14px;
            text-transform: uppercase;
            letter-spacing: 2px;
            opacity: 0.9;
            margin-bottom: 20px;
        }
        .voucher-code-wrapper {
            background-color: rgba(255, 255, 255, 0.15);
            border: 2px dashed rgba(255, 255, 255, 0.4);
            padding: 12px 20px;
            border-radius: 6px;
            display: inline-block;
            margin-bottom: 10px;
        }
        .voucher-code {
            font-family: 'Courier New', Courier, monospace;
            font-size: 24px;
            font-weight: bold;
            letter-spacing: 4px;
        }
        .voucher-terms {
            font-size: 13px;
            color: #e2e8f0;
            margin-top: 15px;
            line-height: 1.4;
        }
        .button {
            display: inline-block;
            padding: 14px 30px;
            margin: 20px 0;
            background-color: #2563eb;
            color: #ffffff !important;
            text-decoration: none;
            border-radius: 8px;
            font-weight: bold;
            font-size: 16px;
            box-shadow: 0 4px 6px rgba(37, 99, 235, 0.15);
            transition: all 0.3s ease;
        }
        .button:hover {
            background-color: #1d4ed8;
            box-shadow: 0 6px 12px rgba(37, 99, 235, 0.25);
        }
        .footer {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #e2e8f0;
            text-align: center;
            font-size: 13px;
            color: #718096;
        }
        .footer a {
            color: #2563eb;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="container">
        <img src="https://beeimg.com/images/f47833961462.png" alt="American Plastics Logo" class="logo">

        <div class="gift-illustration">🎁</div>
        <h1>Exclusive Gift For You!</h1>
        <p>Dear {{ $user->name }},</p>
        @if($customMessage)
            <div style="text-align: left; background-color: #f8fafc; border-left: 4px solid #2563eb; padding: 15px; margin: 20px 0; border-radius: 6px; color: #334155; font-size: 15px; line-height: 1.6;">
                {!! $customMessage !!}
            </div>
        @else
            <p>We are delighted to share a special voucher with you. Use the promo code below during checkout to claim your discount.</p>
        @endif

        <div class="voucher-card">
            <div class="voucher-value">
                @if($voucher->type === 'fixed')
                    LKR {{ number_format($voucher->value, 2) }} OFF
                @else
                    {{ floatval($voucher->value) }}% OFF
                @endif
            </div>
            <div class="voucher-type">Voucher Discount</div>
            
            <div class="voucher-code-wrapper">
                <span class="voucher-code">{{ $voucher->code }}</span>
            </div>

            <div class="voucher-terms">
                @if($voucher->min_spend > 0)
                    * Valid on orders of LKR {{ number_format($voucher->min_spend, 2) }} or more.<br>
                @endif
                * Expires on: {{ $voucher->expiry_date->format('F d, Y') }}
            </div>
        </div>

        <a href="{{ route('american.plastic.web') }}" class="button">Shop Now</a>

        <div class="footer">
            <p><strong>American Plastics Pvt (Ltd)</strong></p>
            <p>Need support? Contact us: <a href="mailto:sales@americanplastic.lk">sales@americanplastic.lk</a></p>
            <p>Hotline: +94 77 286 4877</p>
        </div>
    </div>
</body>
</html>
