<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Project Assigned — Helmyx</title>
<style>
  body { margin: 0; padding: 0; background-color: #F1F5F9; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; }
  .email-wrapper { padding: 48px 20px; }
  .email-container { max-width: 560px; margin: 0 auto; }
  .email-header { background: linear-gradient(135deg, #0C1826 0%, #0F4A87 100%); border-radius: 16px 16px 0 0; padding: 32px; text-align: center; }
  .logo-icon { width: 40px; height: 40px; background: linear-gradient(135deg, #0A3A6B, #12C2CE); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
  .logo-text { color: white; font-size: 1.2rem; font-weight: 800; vertical-align: middle; margin-left: 10px; }
  .email-body { background: white; padding: 40px 32px; }
  .email-footer { background: #F8FAFC; border-radius: 0 0 16px 16px; padding: 24px 32px; text-align: center; }
  .btn-primary { display: inline-block; background: linear-gradient(135deg, #0A3A6B, #12C2CE); color: white !important; text-decoration: none; padding: 14px 36px; border-radius: 10px; font-weight: 600; font-size: 0.95rem; margin: 24px 0; }
  .project-card { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 12px; padding: 20px; margin: 20px 0; }
  .project-card .label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: #94A3B8; margin-bottom: 4px; }
  .project-card .value { font-size: 0.9rem; color: #0C1826; font-weight: 500; }
  .info-row { display: flex; gap: 16px; margin-bottom: 12px; }
  .info-col { flex: 1; }
  .badge { display: inline-block; background: #DBEAFE; color: #1D4ED8; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
  h1 { font-size: 1.4rem; font-weight: 700; color: #0C1826; margin: 0 0 8px; }
  p { font-size: 0.9rem; color: #475569; line-height: 1.6; margin: 0 0 16px; }
  .action-note { background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: 8px; padding: 12px 16px; font-size: 0.82rem; color: #1E40AF; }
</style>
</head>
<body>
<div class="email-wrapper">
  <div class="email-container">
    <div class="email-header">
      <div class="logo-icon">
        <svg width="20" height="20" fill="white" viewBox="0 0 24 24"><path d="M3 3h8v8H3V3zm0 10h8v8H3v-8zm10-10h8v8h-8V3zm0 10h8v8h-8v-8z"/></svg>
      </div>
      <span class="logo-text">Helmyx</span>
    </div>

    <div class="email-body">
      <div style="text-align:center;margin-bottom:28px;">
        <div style="width:60px;height:60px;background:linear-gradient(135deg,#0E9F6E,#0B7A55);border-radius:50%;display:inline-flex;align-items:center;justify-content:center;margin-bottom:16px;">
          <svg width="28" height="28" fill="none" stroke="white" stroke-width="2" viewBox="0 0 24 24"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
        </div>
        <h1>You've Been Assigned a Project</h1>
      </div>

      <p>Hello <strong><?= htmlspecialchars($recipientName ?? 'there') ?></strong>,</p>
      <p>You have been assigned to a new project on Helmyx. Please review the project details below and log in to accept or decline the assignment.</p>

      <!-- Project Details Card -->
      <div class="project-card">
        <div class="info-row">
          <div class="info-col">
            <div class="label">Project Name</div>
            <div class="value"><strong><?= htmlspecialchars($projectName ?? 'N/A') ?></strong></div>
          </div>
          <div class="info-col">
            <div class="label">Project Code</div>
            <div class="value"><?= htmlspecialchars($projectCode ?? 'N/A') ?></div>
          </div>
        </div>
        <div class="info-row">
          <div class="info-col">
            <div class="label">Client</div>
            <div class="value"><?= htmlspecialchars($clientName ?? 'N/A') ?></div>
          </div>
          <div class="info-col">
            <div class="label">Project Value</div>
            <div class="value"><?= htmlspecialchars($projectValue ?? 'N/A') ?></div>
          </div>
        </div>
        <div class="info-row">
          <div class="info-col">
            <div class="label">Start Date</div>
            <div class="value"><?= htmlspecialchars($startDate ?? 'TBD') ?></div>
          </div>
          <div class="info-col">
            <div class="label">Expected End Date</div>
            <div class="value"><?= htmlspecialchars($endDate ?? 'TBD') ?></div>
          </div>
        </div>
        <?php if (!empty($location)): ?>
        <div>
          <div class="label">Location</div>
          <div class="value"><?= htmlspecialchars($location) ?></div>
        </div>
        <?php endif; ?>
      </div>

      <div class="action-note">
        ℹ️ Please log in to Helmyx to <strong>accept or decline</strong> this project assignment. You have 72 hours to respond.
      </div>

      <div style="text-align:center;">
        <a href="<?= htmlspecialchars($actionUrl ?? APP_URL . '/dashboard') ?>" class="btn-primary">View Project & Respond</a>
      </div>
    </div>

    <div class="email-footer">
      <p style="font-size:0.78rem;color:#94A3B8;margin:0;">
        Assigned by <strong style="color:#64748B;"><?= htmlspecialchars($assignedBy ?? 'Helmyx Admin') ?></strong>. If you believe this was sent in error, please contact your project manager.
      </p>
      <p style="font-size:0.75rem;color:#CBD5E1;margin:8px 0 0;">&copy; <?= date('Y') ?> Helmyx. All rights reserved.</p>
    </div>
  </div>
</div>
</body>
</html>
