<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style>
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
      line-height: 1.6;
      color: #333;
      max-width: 600px;
      margin: 0 auto;
      padding: 20px;
    }
    .header {
      padding: 20px 0;
      border-bottom: 1px solid #eee;
      text-align: center;
    }
    .checkmark {
      display: inline-block;
      width: 60px;
      height: 60px;
      background: #d1fae5;
      border-radius: 50%;
      line-height: 60px;
      font-size: 30px;
      margin-bottom: 15px;
    }
    .content { padding: 20px 0; }
    .ticket-info {
      background: #f9fafb;
      padding: 15px;
      border-radius: 8px;
      margin: 20px 0;
    }
    .button {
      display: inline-block;
      background-color: #3b82f6;
      color: white;
      text-decoration: none;
      padding: 12px 24px;
      border-radius: 6px;
      font-weight: 500;
    }
    .button-secondary {
      display: inline-block;
      background-color: #fff;
      color: #3b82f6;
      text-decoration: none;
      padding: 12px 24px;
      border-radius: 6px;
      font-weight: 500;
      border: 1px solid #3b82f6;
      margin-left: 10px;
    }
    .footer {
      font-size: 12px;
      color: #9ca3af;
      border-top: 1px solid #eee;
      padding-top: 20px;
      margin-top: 30px;
    }
  </style>
</head>
<body>
  <div class="header">
    <div class="checkmark">&#10003;</div>
    <h2 style="margin: 0; color: #065f46;">Ticket Resolved</h2>
  </div>

  <div class="content">
    <p>Good news! Your support ticket has been resolved.</p>

    <div class="ticket-info">
      <strong><%= @ticket.ticket_number %></strong><br>
      <%= @ticket.subject %>
    </div>

    <p>If you're satisfied with the resolution, no further action is needed. The ticket will be automatically closed after a few days.</p>

    <p>If you still need assistance or the issue wasn't fully resolved, you can reply to the ticket to reopen it.</p>

    <p style="text-align: center; margin-top: 25px;">
      <a href="<%= site_admin_support_ticket_url(@ticket, host: @website.primary_url || ENV.fetch('BASE_DOMAIN', 'localhost:3000')) %>" class="button">
        View Ticket
      </a>
    </p>
  </div>

  <div class="footer">
    <p>Thank you for contacting support!</p>
    <p>Ticket: <%= @ticket.ticket_number %> | Website: <%= @website.subdomain %></p>
  </div>
</body>
</html>
