{% extends 'base.html' %}
{% load static %}

{% block content %}
<!-- Hero Section -->
<section class="hero-weather text-center">
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-lg-8">
                <p class="mb-2 text-uppercase fw-bold opacity-75" style="letter-spacing: 2px;">Current Conditions</p>
                <h1 class="display-3 fw-bold mb-0">{{ current.city }}</h1>
                <div class="d-flex align-items-center justify-content-center my-4">
                    <span style="font-size: 6rem;">{{ current.icon }}</span>
                    <span class="current-temp ms-3">{{ current.temp }}°</span>
                </div>
                <h2 class="h3 fw-normal opacity-90">{{ current.condition }}</h2>
                <div class="mt-4">
                    <span class="mx-3"><i class="opacity-75">H:</i> {{ current.high }}°</span>
                    <span class="mx-3"><i class="opacity-75">L:</i> {{ current.low }}°</span>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- Search Area -->
<section class="search-wrapper">
    <div class="container">
        <form action="{% url 'index' %}" method="GET">
            <div class="position-relative">
                <input type="text" name="city" class="form-control search-input" placeholder="Search for a city (e.g., Tokyo, New York...)" value="{{ current.city }}">
                <button type="submit" class="search-btn">Search</button>
            </div>
        </form>
    </div>
</section>

<!-- Dashboard Grid -->
<div class="container mt-5 pt-4">
    <div class="row g-4">
        <!-- Details Card -->
        <div class="col-lg-8">
            <div class="weather-card p-4 mb-4">
                <h3 class="h5 fw-bold mb-4">Hourly Forecast</h3>
                <div class="d-flex overflow-auto pb-2">
                    {% for item in hourly %}
                    <div class="hourly-item">
                        <div class="small text-muted mb-2">{{ item.time }}</div>
                        <div class="fs-2 mb-2">{{ item.icon }}</div>
                        <div class="fw-bold">{{ item.temp }}°</div>
                    </div>
                    {% endfor %}
                </div>
            </div>

            <div class="row g-4">
                <div class="col-md-4">
                    <div class="weather-card p-4 h-100">
                        <div class="text-muted small mb-2">Feels Like</div>
                        <div class="h3 fw-bold">{{ current.feels_like }}°</div>
                        <p class="small text-muted mb-0">Similar to current</p>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="weather-card p-4 h-100">
                        <div class="text-muted small mb-2">Humidity</div>
                        <div class="h3 fw-bold">{{ current.humidity }}%</div>
                        <div class="progress mt-2" style="height: 6px;">
                            <div class="progress-bar bg-info" style="width: {{ current.humidity }}%"></div>
                        </div>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="weather-card p-4 h-100">
                        <div class="text-muted small mb-2">Wind Speed</div>
                        <div class="h3 fw-bold">{{ current.wind_speed }} <span class="fs-6 fw-normal">km/h</span></div>
                        <p class="small text-muted mb-0">North West</p>
                    </div>
                </div>
            </div>
        </div>

        <!-- 7-Day Forecast -->
        <div class="col-lg-4">
            <div class="weather-card p-4">
                <h3 class="h5 fw-bold mb-4">7-Day Forecast</h3>
                <div class="daily-list">
                    {% for day in daily %}
                    <div class="day-item">
                        <div class="fw-medium" style="width: 80px;">{{ day.day }}</div>
                        <div class="fs-4">{{ day.icon }}</div>
                        <div class="text-end" style="width: 80px;">
                            <span class="fw-bold">{{ day.high }}°</span>
                            <span class="ms-2 opacity-50">{{ day.low }}°</span>
                        </div>
                    </div>
                    {% endfor %}
                </div>
                <button class="btn btn-primary w-100 mt-4 py-2" style="border-radius: 12px;">Full Forecast</button>
            </div>
        </div>
    </div>
</div>
{% endblock %}
