<% content_for :title, "Programs" %>

<% if notice.present? %>
  <div class="alert alert-success alert-dismissible fade show mt-3" role="alert">
    <%= notice %>
    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  </div>
<% end %>

<div class="container my-5">
  <div class="d-flex justify-content-between align-items-center mb-4">
    <h1 class="fw-bold text-primary mb-0">🎓 Programs</h1>
    <%= link_to "➕ New Program", new_program_path, class: "btn btn-success btn-lg" %>
  </div>

  <% if @programs.any? %>
    <div id="programs" class="row g-4">
      <% @programs.each do |program| %>
        <div class="col-md-6 col-lg-4">
          <div class="card shadow-sm border-0 h-100">
            <div class="card-body">
              <%= render program %>
              <div class="mt-3 text-end">
                <%= link_to "View Details →", program, class: "btn btn-outline-primary btn-sm" %>
              </div>
            </div>
          </div>
        </div>
      <% end %>
    </div>
  <% else %>
    <div class="text-center text-muted mt-5">
      <p>No programs available yet. Start by creating one!</p>
    </div>
  <% end %>
</div>
