{% extends "base.html" %}
{% block title %}{{ t.sup_signup_page_title }} - {{ config.APP_NAME }}{% endblock %}
{% block paddle %}{% include "_payment_js.html" %}{% endblock %}

{% block head %}
<style>
  .s-wizard { max-width: 960px; margin: 2rem auto; }
  .s-progress { margin-bottom: 1.5rem; }
  .s-progress__meta {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 6px;
  }
  .s-progress__label { font-size: 12px; font-weight: 600; color: #334155; }
  .s-progress__count { font-size: 11px; color: #94A3B8; }
  .s-progress__track {
    height: 4px; border-radius: 2px; background: #E2E8F0; overflow: hidden;
  }
  .s-progress__fill {
    height: 100%; border-radius: 2px; background: #1D4ED8;
    transition: width 0.3s ease;
  }
  .s-card {
    background: white; border-radius: 16px; padding: 36px 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  }
  .s-step-title { font-size: 1.25rem; font-weight: 800; color: #0F172A; margin: 0 0 4px; }
  .s-step-sub { font-size: 13px; color: #64748B; margin: 0 0 1.5rem; }
  .s-nav { display: flex; justify-content: space-between; margin-top: 1.5rem; }
  .s-btn-back {
    padding: 8px 20px; font-size: 12px; font-weight: 600;
    border: 1px solid #CBD5E1; background: transparent; color: #64748B;
    border-radius: 10px; cursor: pointer; font-family: 'Inter', sans-serif;
  }
  .s-btn-back:hover { background: #F1F5F9; }
  .s-btn-next {
    padding: 10px 24px; font-size: 13px; font-weight: 700;
    border: none; background: #1D4ED8; color: white; border-radius: 10px;
    cursor: pointer; font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 10px rgba(29,78,216,0.25);
  }
  .s-btn-next:hover { background: #1E40AF; }
  /* Plan cards */
  .s-plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  .s-plan-card {
    border: 2px solid #E2E8F0; border-radius: 14px; padding: 1.25rem;
    cursor: pointer; transition: all 0.15s; position: relative;
  }
  .s-plan-card:hover { border-color: #93C5FD; }
  .s-plan-card--selected { border-color: #1D4ED8; background: #EFF6FF; }
  .s-plan-card input[type="radio"] { display: none; }
  .s-plan-card h3 { font-size: 1.125rem; margin: 0 0 4px; }
  .s-plan-card .price { font-size: 1.5rem; font-weight: 800; color: #1E293B; }
  .s-plan-card .price span { font-size: 0.8125rem; font-weight: 400; color: #64748B; }
  .s-plan-card ul { list-style: none; padding: 0; margin: 0.75rem 0 0; }
  .s-plan-card li { font-size: 0.75rem; color: #475569; padding: 2px 0; display: flex; gap: 4px; }
  .s-plan-card li::before { content: "\2713"; color: #16A34A; font-weight: 700; }
  .s-plan-card__popular {
    position: absolute; top: -10px; right: 12px;
    background: #1D4ED8; color: white; font-size: 0.625rem; font-weight: 700;
    padding: 3px 10px; border-radius: 999px; text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  /* Boost cards */
  .s-boost-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .s-boost-card {
    border: 1.5px solid #E2E8F0; border-radius: 10px; padding: 0.75rem 1rem;
    cursor: pointer; transition: all 0.15s;
  }
  .s-boost-card:hover { border-color: #93C5FD; }
  .s-boost-card--selected { border-color: #1D4ED8; background: #EFF6FF; }
  .s-boost-card--included { border-color: #BBF7D0; background: #F0FDF4; cursor: default; }
  .s-boost-card input[type="checkbox"] { display: none; }
  .s-boost-card strong { display: block; font-size: 0.8125rem; color: #1E293B; }
  .s-boost-card .boost-price { color: #1D4ED8; font-weight: 700; font-size: 0.75rem; }
  .s-boost-card .boost-desc { font-size: 0.6875rem; color: #64748B; }
  .s-boost-card .boost-included { font-size: 0.6875rem; color: #16A34A; font-weight: 600; }
  /* Credit packs */
  .s-credit-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
  .s-credit-card {
    border: 1.5px solid #E2E8F0; border-radius: 10px; padding: 0.75rem;
    text-align: center; cursor: pointer; transition: all 0.15s;
  }
  .s-credit-card:hover { border-color: #93C5FD; }
  .s-credit-card--selected { border-color: #1D4ED8; background: #EFF6FF; }
  .s-credit-card input[type="radio"] { display: none; }
  .s-credit-card .amount { font-size: 1.25rem; font-weight: 800; color: #1E293B; }
  .s-credit-card .price { font-size: 0.8125rem; color: #1D4ED8; font-weight: 700; }
  .s-credit-card .per { font-size: 0.625rem; color: #94A3B8; }
  /* Form fields */
  .s-field { margin-bottom: 1rem; }
  .s-label { display: block; font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 4px; }
  .s-input {
    width: 100%; background: #F1F5F9; border: 1px solid #CBD5E1;
    border-radius: 10px; padding: 8px 12px; font-size: 13px;
    font-family: 'Inter', sans-serif; color: #0F172A; outline: none;
    box-sizing: border-box;
  }
  .s-input:focus { border-color: rgba(29,78,216,0.5); }
  /* Order summary */
  .s-summary {
    background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 12px;
    padding: 1.25rem; margin-top: 1.5rem;
  }
  .s-summary h3 { font-size: 0.875rem; font-weight: 700; margin: 0 0 0.75rem; }
  .s-summary-row { display: flex; justify-content: space-between; font-size: 0.8125rem; padding: 3px 0; }
  .s-summary-total { border-top: 1px solid #CBD5E1; padding-top: 8px; margin-top: 8px; font-weight: 700; }
  @media (max-width: 640px) {
    .s-card { padding: 24px 16px; }
    .s-plan-grid, .s-boost-grid { grid-template-columns: 1fr; }
    .s-credit-grid { grid-template-columns: repeat(2, 1fr); }
  }
</style>
{% endblock %}

{% block content %}
<main style="background: linear-gradient(180deg, #F1F5F9, #F8FAFC); min-height: 80vh;">
  <div class="container-page py-12">
    <div class="s-wizard">
      <div class="s-progress" id="s-progress">
        <div class="s-progress__meta">
          <span class="s-progress__label" id="s-progress-label">{{ t.sup_signup_step1 }}</span>
          <span class="s-progress__count" id="s-progress-count">1 {{ t.sup_signup_of_steps }}</span>
        </div>
        <div class="s-progress__track">
          <div class="s-progress__fill" id="s-progress-fill" style="width: 25%"></div>
        </div>
      </div>
      <div class="s-card">
        <div id="signup-step">
          {% include "suppliers/partials/signup_step_1.html" %}
        </div>
      </div>
    </div>
  </div>
</main>
{% endblock %}

{% block scripts %}
<script>
document.body.addEventListener('htmx:afterSwap', function(e) {
  if (e.detail.target.id === 'signup-step') {
    var step = e.detail.target.querySelector('[data-step]');
    if (step) {
      var n = parseInt(step.dataset.step);
      var labels = [{{ t.sup_signup_step1 | tojson }}, {{ t.sup_signup_step2 | tojson }}, {{ t.sup_signup_step3 | tojson }}, {{ t.sup_signup_step4 | tojson }}];
      document.getElementById('s-progress-label').textContent = labels[n-1] || '';
      document.getElementById('s-progress-count').textContent = n + ' ' + {{ t.sup_signup_of_steps | tojson }};
      document.getElementById('s-progress-fill').style.width = (n * 25) + '%';
    }
  }
});
</script>
{% endblock %}
