<div class="min-h-screen">
  <!-- 城市头部信息 -->
  <section class="relative h-[40vh] overflow-hidden">
    <% if @city.latest_weather_art&.image&.attached? %>
      <%= image_tag @city.latest_weather_art.image,
                    class: "w-full h-full object-cover" %>
      <div class="absolute inset-0 bg-gradient-to-t from-base-100 via-base-100/50 to-transparent"></div>
    <% end %>

    <div class="absolute inset-0 flex items-center">
      <div class="container mx-auto px-4">
        <div class="max-w-4xl">
          <div class="flex items-center space-x-4 mb-4">
            <%= link_to cities_path,
                        class: "btn btn-ghost btn-circle" do %>
              <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
              </svg>
            <% end %>
            <h1 class="text-4xl md:text-5xl font-display font-bold"><%= @city.localized_name %></h1>
          </div>

          <div class="stats bg-base-100/80 backdrop-blur-sm shadow">
            <div class="stat">
              <div class="stat-title">Latitude</div>
              <div class="stat-value text-2xl"><%= @city.latitude %></div>
            </div>
            <div class="stat">
              <div class="stat-title">Longitude</div>
              <div class="stat-value text-2xl"><%= @city.longitude %></div>
            </div>
            <div class="stat">
              <div class="stat-title">Weather Arts</div>
              <div class="stat-value text-2xl"><%= @city.weather_arts.count %></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- 天气艺术历史记录 -->
  <section class="container mx-auto px-4 py-16">
    <div class="space-y-8">
      <h2 class="text-3xl font-display font-bold">Weather Art History</h2>

      <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
        <% @city.weather_arts.order(weather_date: :desc).each do |art| %>
          <div class="card bg-base-100 shadow-xl hover:shadow-2xl transition-all duration-300">
            <figure class="relative aspect-[4/3] overflow-hidden">
              <% if art.image.attached? %>
                <%= image_tag art.image,
                              class: "w-full h-full object-cover transform hover:scale-105 transition-transform duration-500" %>
              <% end %>
              <div class="absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-black/60 to-transparent">
                <div class="text-white">
                  <div class="text-2xl font-bold"><%= art.temperature %>°C</div>
                  <div class="text-sm opacity-90"><%= art.weather_date.strftime("%B %d, %Y") %></div>
                </div>
              </div>
            </figure>

            <div class="card-body">
              <h3 class="card-title font-display"><%= art.description %></h3>

              <div class="grid grid-cols-2 gap-4 my-4 text-sm">
                <div class="flex items-center gap-2">
                  <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 opacity-70" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" />
                  </svg>
                  <span>Humidity: <%= art.humidity %>%</span>
                </div>
                <div class="flex items-center gap-2">
                  <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 opacity-70" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
                  </svg>
                  <span>Wind: <%= art.wind_scale %></span>
                </div>
              </div>

              <div class="card-actions justify-end">
                <%= link_to "View Details", city_weather_art_path(@city, art),
                            class: "btn btn-primary btn-outline" %>
              </div>
            </div>
          </div>
        <% end %>
      </div>
    </div>
  </section>
</div>