* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
    background: #f5f5f5;
    color: #333;
}

h1 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.8rem;
    color: #1a1a1a;
}

h2 { margin-bottom: 12px; font-size: 1.2rem; color: #444; }
h3 { margin: 12px 0 6px; font-size: 0.95rem; color: #555; }

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
}

.search-bar select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
}

.search-bar button {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    background: #2196F3;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}

.search-bar button:hover { background: #1976D2; }
.search-bar button:disabled { background: #90CAF9; cursor: not-allowed; }

#geolocateBtn {
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #ccc;
    font-size: 1.1rem;
    line-height: 1;
}
#geolocateBtn:hover { background: #f5f5f5; }

.pac-container { border-radius: 8px; margin-top: 4px; font-family: inherit; }

.error {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #2196F3;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.location-info {
    text-align: center;
    color: #666;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.current-grid {
    display: flex;
    align-items: center;
    gap: 24px;
}

.aqi-badge {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aqi-number {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
}

.aqi-label {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.8;
    margin-top: 2px;
}

.current-details { flex: 1; }

/* Weather stats row */
.weather-stats {
    display: flex;
    gap: 24px;
    padding: 16px 0;
    margin-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.weather-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.weather-icon { font-size: 1.4rem; }

.weather-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.weather-unit {
    font-size: 0.95rem;
    color: #888;
    font-weight: 500;
}

.uv-flag { margin-left: 4px; }

.category {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.detail {
    color: #666;
    font-size: 0.95rem;
    margin-top: 2px;
}

.pollutants table {
    border-collapse: collapse;
    font-size: 0.9rem;
}

.pollutants th,
.pollutants td {
    padding: 4px 10px;
    white-space: nowrap;
}

.pollutants th {
    text-align: left;
    border-bottom: 2px solid #e0e0e0;
    color: #999;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.pollutants td {
    border-bottom: 1px solid #f0f0f0;
}

.pollutants .val {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #555;
}

.pollutants .risk-pct {
    text-align: right;
    color: #999;
    font-size: 0.85rem;
    padding-left: 16px;
}

.header-hint {
    cursor: help;
    opacity: 0.5;
    font-size: 0.85em;
}

.poll-elevated td {
    font-weight: 600;
}

.flag-cell {
    text-align: center;
    white-space: nowrap;
    padding-left: 16px;
}

.poll-flag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1.5px solid;
    background: #fff;
}

.pollutants-toggle {
    margin-top: 16px;
}

.pollutants-toggle summary {
    cursor: pointer;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.health-recs {
    margin-top: 16px;
}

.health-recs summary {
    cursor: pointer;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.health-recs p {
    margin: 8px 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #555;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-header h2 {
    margin-bottom: 0;
}

.range-toggle {
    display: flex;
    gap: 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
}

.range-btn {
    padding: 6px 14px;
    border: none;
    background: #fff;
    color: #555;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-right: 1px solid #ccc;
}

.range-btn:last-child {
    border-right: none;
}

.range-btn:hover {
    background: #f0f0f0;
}

.range-btn.active {
    background: #2196F3;
    color: #fff;
}

.chart-container {
    position: relative;
    height: 400px;
}

.chart-container-sm {
    height: 220px;
}

.forecast-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.forecast-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid #e0e0e0;
    color: #555;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.forecast-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.forecast-table tr:last-child td {
    border-bottom: none;
}

.day-cell {
    font-weight: 600;
    white-space: nowrap;
    color: #333;
    width: 180px;
}

.good-window {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 2px 4px 2px 0;
}

.no-good {
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
}

/* Auth */
.login-container {
    max-width: 400px;
    margin: 120px auto 0;
    text-align: center;
    background: #fff;
    border-radius: 12px;
    padding: 48px 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.login-container h1 { margin-bottom: 32px; }

.login-container input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 12px;
}

.google-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 24px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #3c4043;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    justify-content: center;
    box-sizing: border-box;
    transition: background 0.15s;
}

.google-login-btn:hover { background: #f5f5f5; }

.login-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.user-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.user-bar a {
    color: #999;
    text-decoration: none;
}

.user-bar a:hover { color: #2196F3; }

@media (max-width: 600px) {
    .search-bar { flex-wrap: wrap; }
    .search-bar input { width: 100%; }
    .current-grid { flex-direction: column; text-align: center; }
    .weather-stats { flex-direction: column; gap: 12px; align-items: center; }
    .chart-container { height: 250px; }
    .login-container { margin-top: 60px; padding: 32px 20px; }
}
