================================================================================
  Simple Question SQ2: Minimal Streamlit UI Template & Component Test
================================================================================

FULL QUESTION:
SQ2. Minimal Streamlit Web App: Create a standalone Streamlit script containing all standard dashboard components (metric cards, line charts, status banners, data table, and sliders).
Use this simpler program to verify that Streamlit runs cleanly on port 8501 and that all layout widgets render properly.

SHORT QUESTION:
Minimal Streamlit Component Verification Dashboard.

================================================================================
README & SETUP INSTRUCTIONS:
================================================================================
# SQ2: Minimal Streamlit UI Verification

## Purpose
Run this minimal application to verify your Streamlit installation and test all common IoT dashboard widgets in isolation.

## Requirements
```bash
pip install streamlit pandas numpy
```

## How to Run
```bash
streamlit run test_app.py
```

================================================================================
SOURCE CODE FILES:
================================================================================

1. test_app.py
--------------------------------------------------------------------------------
import streamlit as st
import pandas as pd
import numpy as np
import time

st.set_page_config(page_title="SQ2: Minimal Streamlit Test", layout="wide")

st.title("⚡ Streamlit Quick Verification App")
st.write("Verifying layout, metrics, charts, tables, and interactive widgets.")

col1, col2, col3, col4 = st.columns(4)
col1.metric("Temperature", "27.5 °C", "+0.5 °C")
col2.metric("Humidity", "62.0 %", "-1.2 %")
col3.metric("Light Level", "450 Lux")
col4.metric("Status", "ONLINE", delta_color="normal")

st.subheader("Status Indicator Test")
status_choice = st.radio("Simulate Sensor State:", ["Normal", "Warning", "Hazard / Occupied"], horizontal=True)

if status_choice == "Normal":
    st.success("✅ State: NORMAL - Environment parameters within safe thresholds.")
elif status_choice == "Warning":
    st.warning("⚠️ State: WARNING - Elevated temperature / particulate readings detected.")
else:
    st.error("🚨 State: HAZARD - Thresholds breached or space occupied!")

st.subheader("Real-Time Line Chart Test")
chart_data = pd.DataFrame(
    np.random.randn(20, 2) * [1.5, 3.0] + [28.0, 65.0],
    columns=["Temperature (°C)", "Humidity (%)"]
)
st.line_chart(chart_data)

st.subheader("Data Table & Interactive Controls")
c_left, c_right = st.columns([1, 2])
with c_left:
    test_slider = st.slider("Test Threshold Slider", 0, 100, 45)
    if st.button("Trigger Action Button", type="primary"):
        st.info(f"Button clicked at {time.strftime('%H:%M:%S')} with value {test_slider}")
with c_right:
    st.dataframe(chart_data.tail(5), use_container_width=True)
--------------------------------------------------------------------------------
