<% content_for :title, "Abbonamento — #{@team.name}" %>
<% content_for :robots, "noindex, nofollow" %>

<div class="wrap" style="padding-top:20px">
  <h1>Abbonamento</h1>
  <p>Squadra: <strong><%= @team.name %></strong> · Piano attuale: <strong><%= @entitlements.plan.name %></strong></p>

  <div class="plans">
    <% @plans.each do |plan| %>
      <div class="plan-card">
        <h3><%= plan.name %></h3>
        <% if plan.slug == "free" %>
          <div class="plan-price">€0</div>
        <% elsif plan.slug == "premium_light" %>
          <div class="plan-price" style="color:#e53935"><%= Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: "yearly") %></div>
          <p style="color:#888;font-size:0.85rem">oppure <%= Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: "monthly") %></p>
        <% else %>
          <div class="plan-price"><%= Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: "yearly") %></div>
          <p style="color:#888;font-size:0.85rem">oppure <%= Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: "monthly") %></p>
        <% end %>
        <ul>
          <li>Staff trasmissione: <%= plan.max_staff_transmission || "illimitato" %> / anno</li>
          <li>Partite: <%= plan.concurrent_streams_limit || "illimitate" %> in contemporanea</li>
          <li>Replay: <%= plan.recordings_enabled? ? "#{plan.recording_days} giorni" : "no" %></li>
          <li>YouTube: <% if plan.slug == "premium_light" %>Match Live TV<% elsif plan.youtube_enabled? %>canale società<% else %>no<% end %></li>
        </ul>
        <% if plan.slug == @entitlements.plan.slug %>
          <span class="btn btn-secondary" style="opacity:0.7">Piano attuale</span>
        <% elsif plan.slug == "free" %>
          <p style="color:#888;font-size:0.85rem">Contatta il supporto per downgrade.</p>
        <% elsif MatchLiveTv.stripe_enabled? %>
          <%= link_to "Gestisci abbonamento società", public_club_billing_path(@team.club), class: "btn btn-primary" %>
        <% else %>
          <p style="color:#888">Stripe non configurato</p>
        <% end %>
      </div>
    <% end %>
  </div>

  <div class="card" style="margin-top:24px;text-align:center">
    <p style="color:#aaa">Esigenze diverse? <%= mail_to "info@matchlive.it", "Contattaci" %> per un'offerta su misura.</p>
  </div>

  <p style="margin-top:20px"><%= link_to "Pagamenti e fatture della società", public_club_billing_path(@team.club) %></p>

  <p><%= link_to "← Dettagli squadra", public_team_details_path(@team) %></p>
</div>
