<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SimWeather - Your Trusted Source</title>
    <style>
        body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; margin: 0; background-color: #f4f4f9; color: #333; }
        
        /* Header & Nav */
        header { background-color: #005a87; color: white; padding: 10px 0; }
        .container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
        .nav-bar { display: flex; justify-content: space-between; align-items: center; }
        .logo { font-size: 1.5em; font-weight: bold; text-decoration: none; color: white; }
        .nav-links a { color: #e0e0e0; text-decoration: none; margin-left: 20px; font-size: 0.9em; }
        .nav-links a:hover { color: white; text-decoration: underline; }

        /* Main Layout */
        .main-content { display: flex; gap: 20px; margin-top: 20px; }
        .left-col { flex: 2; }
        .right-col { flex: 1; }

        /* Search Box */
        .search-box { background: white; padding: 20px; border-radius: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 20px; }
        .search-box input { padding: 10px; width: 70%; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; }
        .search-box button { padding: 10px 20px; background-color: #ff9800; border: none; color: white; border-radius: 4px; cursor: pointer; font-size: 1em; font-weight: bold; }
        .search-box button:hover { background-color: #e68900; }

        /* Weather Card */
        .weather-card { background: white; padding: 25px; border-radius: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); border-top: 5px solid #00a1e4; }
        .weather-header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid #eee; padding-bottom: 15px; margin-bottom: 15px; }
        .temp-large { font-size: 3.5em; font-weight: bold; color: #333; }
        .condition-icon { font-size: 1.2em; color: #666; }
        
        .metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
        .metric-item { background-color: #f9f9f9; padding: 10px; border-radius: 4px; }
        .metric-label { display: block; font-size: 0.8em; color: #666; margin-bottom: 3px; text-transform: uppercase; }
        .metric-value { font-weight: bold; font-size: 1.1em; }

        .pollution-high { color: #d32f2f; }
        .pollution-moderate { color: #f57c00; }
        .pollution-low { color: #388e3c; }

        /* Sidebar / Ad Placements */
        .sidebar-widget { background: white; padding: 15px; border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 20px; }
        .sidebar-title { font-size: 0.9em; font-weight: bold; color: #888; border-bottom: 1px solid #eee; padding-bottom: 5px; margin-bottom: 10px; }
        .news-link { display: block; margin-bottom: 10px; text-decoration: none; color: #005a87; font-size: 0.9em; }
        .news-link:hover { text-decoration: underline; }
        .ad-placeholder { background-color: #eee; height: 250px; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 0.8em; border: 1px dashed #ccc; }

        /* Footer */
        footer { background-color: #333; color: #aaa; padding: 30px 0; margin-top: 40px; font-size: 0.8em; }
        .footer-links a { color: #aaa; margin-right: 15px; text-decoration: none; }
        .footer-links a:hover { color: white; }
    </style>
</head>
<body>
    <header>
        <div class="container nav-bar">
            <a href="?" class="logo">SimWeather</a>
            <nav class="nav-links">
                <a href="#">Maps & Radar</a>
                <a href="#">Severe Weather</a>
                <a href="#">News & Video</a>
                <a href="#">Health & Activities</a>
                <a href="#">Mobile Apps</a>
            </nav>
        </div>
    </header>

    <div class="container main-content">
        <div class="left-col">
            <div class="search-box">
                <form method="get" action="">
                    <label for="location" style="display:block; margin-bottom:8px; font-weight:bold; color:#555;">Find your local weather</label>
                    <input type="text" id="location" name="location" value="{{ location|default:'' }}" placeholder="City, Zip, or Place">
                    <button type="submit">Search</button>
                </form>
            </div>

            {% if location %}
            <div class="weather-card">
                <div class="weather-header">
                    <div>
                        <h2 style="margin:0; color:#005a87;">{{ location }}</h2>
                        <span style="color:#666; font-size:0.9em;">As of {{ timestamp|default:'now' }}</span>
                    </div>
                    <div class="condition-icon">{{ condition }}</div>
                </div>

                <div style="display:flex; align-items:center; gap:20px; margin-bottom:20px;">
                    <div class="temp-large">{{ temperature }}°</div>
                    <div style="font-size:1.2em; color:#555;">
                        <div>Feels Like <strong>{{ temperature }}°</strong></div>
                        <div>Wind: N 5 mph</div>
                    </div>
                </div>

                <div class="metrics-grid">
                    <div class="metric-item">
                        <span class="metric-label">Humidity</span>
                        <span class="metric-value">{{ humidity }}%</span>
                    </div>
                    <div class="metric-item">
                        <span class="metric-label">Pressure</span>
                        <span class="metric-value">29.92 in</span>
                    </div>
                    <div class="metric-item">
                        <span class="metric-label">Visibility</span>
                        <span class="metric-value">10 mi</span>
                    </div>
                    <div class="metric-item">
                        <span class="metric-label">Dew Point</span>
                        <span class="metric-value">58°</span>
                    </div>
                    <div class="metric-item" style="grid-column: span 2; background-color: #f0f7ff; border: 1px solid #d0e3ff;">
                        <span class="metric-label">Air Quality / Pollution</span>
                        <span class="metric-value {{ pollution_class }}">{{ pollution_index }}</span>
                    </div>
                </div>
            </div>
            {% else %}
            <div class="weather-card" style="text-align:center; padding:50px;">
                <h3 style="color:#666;">Enter a location to check the forecast</h3>
                <p style="color:#888;">Get reliable local forecasts, radar maps, and severe weather alerts.</p>
            </div>
            {% endif %}
        </div>

        <div class="right-col">
            <div class="sidebar-widget">
                <div class="sidebar-title">TOP STORIES</div>
                <a href="#" class="news-link">Massive Storm System Moving East</a>
                <a href="#" class="news-link">5 Tips for Summer Heat Safety</a>
                <a href="#" class="news-link">Why The Seasons Are Changing</a>
                <a href="#" class="news-link">Local celestial event tonight: Don't miss it</a>
            </div>

            <div class="sidebar-widget">
                <div class="sidebar-title">SPONSORED</div>
                <div class="ad-placeholder">
                    [Ad Space 300x250]
                </div>
            </div>
        </div>
    </div>

    <footer>
        <div class="container">
            <div class="footer-links">
                <a href="#">Feedback</a>
                <a href="#">Weather API</a>
                <a href="#">Privacy Policy</a>
                <a href="#">Terms of Use</a>
                <a href="#">Accessibility</a>
            </div>
            <p style="margin-top:15px;">&copy; 2025 SimWeather Corp. All rights reserved.</p>
        </div>
    </footer>
</body>
</html>