<!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; }
    .priority-badge {
      display: inline-block;
      padding: 4px 12px;
      border-radius: 4px;
      font-size: 12px;
      font-weight: bold;
      text-transform: uppercase;
    }
    .priority-low { background: #e5e7eb; color: #374151; }
    .priority-normal { background: #dbeafe; color: #1e40af; }
    .priority-high { background: #ffedd5; color: #9a3412; }
    .priority-urgent { background: #fee2e2; color: #991b1b; }
    .content { padding: 20px 0; }
    .details { background: #f9fafb; padding: 15px; border-radius: 8px; margin: 15px 0; }
    .details dt { font-weight: bold; color: #6b7280; font-size: 12px; text-transform: uppercase; }
    .details dd { margin: 0 0 12px 0; }
    .button {
      display: inline-block;
      background-color: #3b82f6;
      color: white;
      text-decoration: none;
      padding: 12px 24px;
      border-radius: 6px;
      font-weight: 500;
    }
    .footer {
      font-size: 12px;
      color: #9ca3af;
      border-top: 1px solid #eee;
      padding-top: 20px;
      margin-top: 30px;
    }
  </style>
</head>
<body>
  <div class="header">
    <h2 style="margin: 0;">Ticket Assigned to You</h2>
    <span class="priority-badge priority-<%= @ticket.priority %>"><%= @ticket.priority %></span>
  </div>

  <div class="content">
    <p>Hi <%= @assignee.display_name %>,</p>

    <p>A support ticket has been assigned to you:</p>

    <dl class="details">
      <dt>Ticket Number</dt>
      <dd><strong><%= @ticket.ticket_number %></strong></dd>

      <dt>Subject</dt>
      <dd><%= @ticket.subject %></dd>

      <dt>Website</dt>
      <dd><%= @website.subdomain %></dd>

      <dt>From</dt>
      <dd><%= @ticket.creator.display_name %> (<%= @ticket.creator.email %>)</dd>

      <dt>Category</dt>
      <dd><%= @ticket.category&.humanize || 'General' %></dd>

      <dt>Priority</dt>
      <dd><%= @ticket.priority.humanize %></dd>

      <dt>Created</dt>
      <dd><%= @ticket.created_at.strftime('%B %d, %Y at %I:%M %p') %></dd>
    </dl>

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

  <div class="footer">
    <p>This is an automated notification from the support ticketing system.</p>
  </div>
</body>
</html>
