<!DOCTYPE html>
<html>
<head>
  <style>
    body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
    .container { max-width: 600px; margin: 0 auto; padding: 20px; }
    .header { 
      background-color: {{#if (eq status 'completed')}}#4CAF50{{else if (eq status 'failed')}}#F44336{{else if (eq status 'cancelled')}}#9E9E9E{{else}}#2196F3{{/if}}; 
      color: white; 
      padding: 20px; 
      text-align: center; 
    }
    .content { padding: 20px; background-color: #f9f9f9; }
    .footer { text-align: center; padding: 20px; font-size: 12px; color: #777; }
    .amount { 
      font-size: 24px; 
      font-weight: bold; 
      margin: 15px 0;
      color: {{#if (eq status 'completed')}}#2E7D32{{else if (eq status 'failed')}}#C62828{{else if (eq status 'cancelled')}}#616161{{else}}#0D47A1{{/if}};
    }
    .status-badge {
      display: inline-block;
      padding: 5px 10px;
      border-radius: 12px;
      font-weight: bold;
      text-transform: capitalize;
      background-color: {{#if (eq status 'completed')}}#E8F5E9{{else if (eq status 'failed')}}#FFEBEE{{else if (eq status 'cancelled')}}#EEEEEE{{else}}#E3F2FD{{/if}};
      color: {{#if (eq status 'completed')}}#2E7D32{{else if (eq status 'failed')}}#C62828{{else if (eq status 'cancelled')}}#424242{{else}}#1565C0{{/if}};
    }
    .button {
      display: inline-block; 
      padding: 10px 20px; 
      background-color: {{#if (eq status 'completed')}}#4CAF50{{else if (eq status 'failed')}}#F44336{{else if (eq status 'cancelled')}}#9E9E9E{{else}}#2196F3{{/if}}; 
      color: white; 
      text-decoration: none; 
      border-radius: 4px;
      margin: 15px 0;
    }
    .info-box {
      background-color: #f5f5f5;
      border-left: 4px solid #9E9E9E;
      padding: 12px;
      margin: 15px 0;
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="header">
      <h1>Withdrawal {{#if (eq status 'completed')}}Completed{{else if (eq status 'failed')}}Failed{{else if (eq status 'cancelled')}}Cancelled{{else}}Updated{{/if}}</h1>
    </div>
    <div class="content">
      <p>Hello {{name}},</p>
      
      {{#if (eq status 'completed')}}
        <p>We're happy to inform you that your withdrawal request has been successfully processed.</p>
      {{else if (eq status 'failed')}}
        <p>We regret to inform you that your withdrawal request could not be processed.</p>
      {{else if (eq status 'cancelled')}}
        <p>Your withdrawal request has been cancelled as per your request.</p>
      {{else}}
        <p>There's an update regarding your withdrawal request.</p>
      {{/if}}
      
      <div class="amount">{{currency}} {{amount}}</div>
      
      <div style="margin: 20px 0; text-align: center;">
        <span class="status-badge">{{status}}</span>
      </div>
      
      <div class="info-box">
        <p><strong>Request ID:</strong> {{requestId}}</p>
        <p><strong>Status:</strong> {{statusText}}</p>
        <p><strong>Processed On:</strong> {{completedAt}}</p>
        {{#if notes}}
          <p><strong>Notes:</strong> {{notes}}</p>
        {{/if}}
      </div>
      
      {{#if (eq status 'failed')}}
        <p>If you believe this is an error, please contact our support team for assistance.</p>
        <p style="text-align: center;">
          <a href="mailto:{{supportEmail}}" class="button">Contact Support</a>
        </p>
      {{/if}}
      
      <p style="text-align: center; margin-top: 25px;">
        <a href="{{dashboardUrl}}" class="button">View Withdrawal Details</a>
      </p>
      
      {{#if (eq status 'completed')}}
        <p>The funds should reflect in your account within 1-3 business days, depending on your payment method.</p>
      {{/if}}
      
      <p>If you have any questions about this transaction, please don't hesitate to contact our support team.</p>
      
      <p>Best regards,<br>The Xania Bookstore Team</p>
    </div>
    <div class="footer">
      <p>© {{year}} Xania Bookstore. All rights reserved.</p>
      <p>This is an automated message, please do not reply to this email.</p>
    </div>
  </div>
</body>
</html>
