<?php /** @var array $class */ /** @var array $studio */ ?>
<section class="reveal">
  <div class="hero-media">
    <img src="<?= \Tshen\asset('fit.jpeg') ?>" alt="Class imagery placeholder" />
  </div>
  <div class="detail-header">
    <h2 class="stagger-item"><?= htmlspecialchars($class['title']) ?></h2>
    <p class="stagger-item">TSHEN Partner Studio — <?= htmlspecialchars($studio['location']) ?></p>
    <div class="stagger-item meta">
      <span>Date: <?= htmlspecialchars($class['date']) ?></span>
      <span>Time: <?= htmlspecialchars($class['time']) ?></span>
      <span>Capacity: <?= (int)$class['capacity'] ?></span>
    </div>
    <div class="stagger-item actions">
      <form method="post" action="<?= \Tshen\url('/classes/book') ?>">
        <?= \Tshen\csrf_field() ?>
        <input type="hidden" name="class_id" value="<?= (int)$class['id'] ?>" />
        <button type="submit">Book This Class (1 credit)</button>
      </form>
    </div>
  </div>
</section>

<section class="container reveal">
  <h3 class="stagger-item">Studio Info</h3>
  <div class="studio-info stagger-item">
    <p><strong>Name:</strong> <?= htmlspecialchars($studio['name']) ?></p>
    <p><strong>Location:</strong> <?= htmlspecialchars($studio['location']) ?></p>
    <p><strong>Contact:</strong> <?= htmlspecialchars($studio['contact']) ?> · <?= htmlspecialchars($studio['email']) ?></p>
  </div>

  <div class="map-preview stagger-item">
    <div class="map-box">Map Preview</div>
  </div>
</section>

<section class="container reveal reviews">
  <h3 class="stagger-item">Reviews</h3>
  <div class="review stagger-item">
    <p>★★★★★ — "Great coaching and a tough but rewarding session."</p>
  </div>
  <div class="review stagger-item">
    <p>★★★★☆ — "Loved the flow. Studio was clean and welcoming."</p>
  </div>
  <div class="review stagger-item">
    <p>★★★★★ — "Perfect for early mornings. Will book again!"</p>
  </div>
</section>

<div class="class-detail-container">
  <div class="class-image-area">
    <img src="<?= \Tshen\asset('fit.jpeg') ?>" alt="<?= htmlspecialchars($class['title']) ?>" />
  </div>
  
  <div class="class-info-container">
    <h2 class="class-title"><?= htmlspecialchars($class['title']) ?></h2>
    
    <div class="studio-info">
      <h3><?= htmlspecialchars($studio['name'] ?? 'Studio Name') ?></h3>
      <p><?= htmlspecialchars($studio['location'] ?? 'London') ?></p>
      <p><?= htmlspecialchars($studio['contact'] ?? 'Contact information') ?></p>
    </div>
    
    <div class="map-preview">
      <img src="<?= \Tshen\asset('map-placeholder.jpg') ?>" alt="Studio location map" />
    </div>
    
    <div class="booking-action">
      <form method="post" action="<?= \Tshen\url('/classes/book') ?>">
        <?= \Tshen\csrf_field() ?>
        <input type="hidden" name="class_id" value="<?= (int)$class['id'] ?>" />
        <button type="submit" class="book-class-btn">Book This Class</button>
      </form>
    </div>
  </div>
</div>

<div class="reviews-section">
  <h3>Reviews</h3>
  <?php if (empty($reviews)): ?>
    <p>No reviews yet for this class.</p>
  <?php else: ?>
    <div class="reviews-container">
      <?php foreach ($reviews as $review): ?>
        <div class="review-card">
          <div class="review-header">
            <span class="reviewer-name"><?= htmlspecialchars($review['user_name']) ?></span>
            <span class="review-rating"><?= str_repeat('★', $review['rating']) ?><?= str_repeat('☆', 5 - $review['rating']) ?></span>
          </div>
          <p class="review-content"><?= htmlspecialchars($review['content']) ?></p>
        </div>
      <?php endforeach; ?>
    </div>
  <?php endif; ?>
</div>