{#
  Shared macros for transactional email templates.

  Import in child templates:
    {% from "emails/_macros.html" import email_button, heat_badge, section_heading, info_box %}
#}


{# ─── CTA Button ─────────────────────────────────────────────────────────────
   Table-based blue button — works in all major email clients.
   Uses display:block for full-width tap target on mobile.
#}
{% macro email_button(url, label) %}
<table cellpadding="0" cellspacing="0" width="100%" style="margin:28px 0 8px;">
  <tr><td style="background-color:#1D4ED8;border-radius:8px;text-align:center;">
    <a href="{{ url }}" style="display:block;padding:14px 32px;color:#FFFFFF;font-size:15px;font-weight:600;text-decoration:none;letter-spacing:-0.01em;">{{ label }}</a>
  </td></tr>
</table>
{% endmacro %}


{# ─── Heat Badge ─────────────────────────────────────────────────────────────
   Inline colored badge: HOT (red), WARM (orange), COOL (blue).
   heat: uppercase string "HOT" | "WARM" | "COOL"
#}
{% macro heat_badge(heat) %}
{%- set colors = {"HOT": "#DC2626", "WARM": "#EA580C", "COOL": "#2563EB"} -%}
{%- set bg = colors.get(heat, "#2563EB") -%}
<span style="display:inline-block;padding:2px 8px;border-radius:4px;background-color:{{ bg }};color:#FFFFFF;font-size:11px;font-weight:700;letter-spacing:0.04em;vertical-align:middle;margin-left:8px;">{{ heat }}</span>
{%- endmacro %}


{# ─── Small heat badge (compact variant for table rows) ──────────────────────
   1px smaller padding, used in weekly_digest lead table rows.
#}
{% macro heat_badge_sm(heat) %}
{%- set colors = {"HOT": "#DC2626", "WARM": "#EA580C", "COOL": "#2563EB"} -%}
{%- set bg = colors.get(heat, "#2563EB") -%}
<span style="display:inline-block;padding:1px 6px;border-radius:4px;background-color:{{ bg }};color:#fff;font-size:10px;font-weight:700;">{{ heat }}</span>
{%- endmacro %}


{# ─── Section Heading ─────────────────────────────────────────────────────────
   Small uppercase label above a data table section.
#}
{% macro section_heading(text) %}
<h3 style="font-size:11px;text-transform:uppercase;letter-spacing:0.06em;color:#94A3B8;margin:0 0 8px;">{{ text }}</h3>
{% endmacro %}


{# ─── Info Box ────────────────────────────────────────────────────────────────
   Left-bordered callout box. color: "blue" (default) or "yellow".
#}
{% macro info_box(text, color="blue") %}
{%- if color == "yellow" -%}
  {%- set bg = "#FEF3C7" -%}{%- set border = "#F59E0B" -%}
{%- else -%}
  {%- set bg = "#F0F9FF" -%}{%- set border = "#1D4ED8" -%}
{%- endif -%}
<p style="font-size:13px;color:#334155;margin:0 0 16px;padding:10px 14px;background-color:{{ bg }};border-radius:6px;border-left:3px solid {{ border }};">{{ text }}</p>
{% endmacro %}
