/* ClanertAir dashboard styling */
:root {
    --bg: #f6f8fc;
    --card: #ffffff;
    --muted: #6c768f;
    --border: #e6e9f2;
    --brand: #233d91;          /* Clanert blue */
    --brand-strong: #1c3074;   /* darker accent */
    --green: #89c54b;          /* Air green */
    --amber: #f1b44c;
    --purple: #9c6bff;
    --teal: #27c4aa;
    --orange: #f78c3d;
    --shadow: 0 12px 30px rgba(17, 38, 146, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: #0f172a;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 8px;
    color: var(--brand);
}
p { margin: 0; color: var(--muted); }

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #ffffff;
    color: #0f172a;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 20px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: transparent;
    color: inherit;
    font-size: 22px;
}

.brand-name span { color: #4cc9ff; }

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: inherit;
    text-decoration: none;
    border-radius: 12px;
    position: relative;
    transition: background 0.2s, color 0.2s;
}

.nav-item .nav-icon { width: 22px; text-align: center; font-size: 18px; color: #546172; }
.nav-item .badge {
    margin-left: auto;
    background: #e11d48;
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.nav-item:hover { background: #f2f6ff; }
.nav-item.active {
    background: #e8f1ff;
    color: #0f172a;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px #d4e3ff;
}

/* User signup page tweaks */
.user-signup .card {
    border: 1px solid var(--border);
}
.user-signup .form-control {
    padding: 10px 12px;
}
.user-signup button[type="submit"] {
    background: var(--brand);
    border-color: var(--brand);
}
.user-signup button[type="submit"]:hover {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
}

.profile {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f4f6fb;
    border-radius: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1f5cf1;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.profile-name { font-weight: 700; }
.profile-tier { color: var(--muted); font-size: 13px; }
.chevron { margin-left: auto; color: #9aa4bf; font-size: 14px; }

.main {
    padding: 22px 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.topbar {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 14px;
}

.search {
    background: #eef2f7;
    padding: 12px 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e4e8f0;
}

.search input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 15px;
    outline: none;
}

.search .search-icon { color: #8a94ab; font-size: 18px; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #e9f9ef;
    color: #1e8a4a;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 600;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    background: var(--green);
}

.icon-button {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.1s, box-shadow 0.2s;
}

.icon-button:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.icon-button.ghost { background: rgba(255, 255, 255, 0.35); border: none; color: #fff; }

.section {
    background: var(--card);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 16px;
}

.tabs { display: flex; gap: 10px; }
.tab { display: none; }
.tab.active { display: none; }
.metric-switch { display: flex; gap: 8px; flex-wrap: wrap; }

.hero-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 18px;
}

.hero-card {
    position: relative;
    padding: 18px;
    border-radius: 22px;
    color: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(180deg, rgba(9, 14, 30, 0.55), rgba(9, 14, 30, 0.7)), var(--hero-bg, linear-gradient(145deg, #233554, #101726));
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 50px rgba(10, 14, 40, 0.35);
}

.hero-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; font-size: 14px; }
.subtitle { color: rgba(255, 255, 255, 0.7); font-size: 14px; }

.hero-aqi { display: flex; align-items: baseline; gap: 8px; }
.aqi-value { font-size: 72px; font-weight: 800; line-height: 1; }
.aqi-unit { font-size: 18px; color: rgba(255, 255, 255, 0.7); }

.pill {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.14);
}

.pill.success { background: #ffffff; color: #0f172a; border: 1px solid #e6e9f2; }
.aqi-pill {
    background: transparent;
    color: #ffffff;
    border: none;
}
.hero-summary { color: rgba(255, 255, 255, 0.85); line-height: 1.5; }

.map-card {
    background: #f9fbff;
    border: 1px solid var(--border);
    border-radius: 22px;
    position: relative;
    overflow: hidden;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 36px rgba(15, 26, 60, 0.12);
}

.map-controls {
    display: flex;
    gap: 8px;
    padding: 12px;
}

.chip {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 8px 12px;
    font-weight: 600;
    color: #1f2d3d;
}
.map-card-body { padding: 0 12px 12px; }
#leaflet-map {
    height: 360px;
    width: 100%;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    overflow: hidden;
}
.legend {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 999;
}
.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #e6e9f2;
}
.legend-chip::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--chip-color, #2ecc71);
}
.aqi-pin-wrap { }
.aqi-pin {
    position: relative;
    width: 18px;
    height: 18px;
}
.aqi-pin .dot {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--pin-color, #26c281);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.9);
}
.aqi-pin.online .wave {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--pin-color, #26c281);
    opacity: 0.5;
    animation: wave-pulse 2s infinite;
}
.aqi-pin.offline .wave { display: none; }

.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
}
.leaflet-popup-content {
    margin: 10px 12px;
}
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-weight: 700;
    color: #0f172a;
}
.popup-meta { font-size: 13px; color: #6c768f; margin-bottom: 4px; }
.popup-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(80px, 1fr));
    gap: 8px;
}
.popup-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    background: #eef2f7;
    font-weight: 700;
    color: #0f172a;
}

@keyframes wave-pulse {
    0% { transform: scale(1); opacity: 0.45; }
    60% { transform: scale(1.45); opacity: 0; }
    100% { transform: scale(1.45); opacity: 0; }
}
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
}
.leaflet-popup-content {
    margin: 10px 12px;
}
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-weight: 700;
    color: #0f172a;
}
.popup-meta { font-size: 13px; color: #6c768f; margin-bottom: 4px; }
.popup-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(80px, 1fr));
    gap: 8px;
}
.popup-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    background: #eef2f7;
    font-weight: 700;
    color: #0f172a;
}
.map {
    flex: 1;
    position: relative;
    background: #e8eef7;
    background-image:
        linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px),
        linear-gradient(0deg, rgba(0,0,0,0.05) 1px, transparent 1px),
        radial-gradient(circle at 30% 40%, rgba(0, 102, 204, 0.16), transparent 32%),
        radial-gradient(circle at 75% 65%, rgba(0, 153, 102, 0.14), transparent 36%),
        linear-gradient(135deg, #d9e7ff 0%, #f5f9ff 40%, #e3f1ff 100%);
    background-size: 32px 32px, 32px 32px, 100% 100%, 100% 100%, 100% 100%;
}

.map-layer { position: absolute; inset: 0; }
.map-marker {
    width: 16px;
    height: 16px;
    background: var(--marker-color, #26c281);
    border-radius: 50%;
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--marker-color, #26c281) 30%, transparent);
    position: absolute;
    border: 2px solid #fff;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 6px;
}
.map-marker .marker-dot {
    width: 14px;
    height: 14px;
    background: var(--marker-color, #26c281);
    border-radius: 50%;
    border: 2px solid #fff;
    display: block;
}
.marker-label {
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12px;
    color: #0f172a;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    white-space: nowrap;
}
.marker-meta {
    background: rgba(255, 255, 255, 0.92);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    color: #1f2d3d;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    display: inline-block;
    margin-top: 2px;
}
.blip-marker { animation: none; }
.map-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.92);
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 600;
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}
.map-label {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 700;
}

.card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.info-card {
    background: #fafcff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: var(--shadow);
}
.info-card.highlight {
    background: linear-gradient(135deg, #f3f8ff, #ffffff);
}

.icon-bubble {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #eef1fb;
    margin-bottom: 12px;
    display: grid;
    place-items: center;
    color: #0f172a;
}
.icon-bubble.blue { background: #e7efff; }
.icon-bubble.purple { background: #f2e9ff; }
.icon-bubble.orange { background: #ffeada; }
.icon-bubble.teal { background: #d9f5ed; }

.info-title { font-weight: 700; margin-bottom: 2px; }
.info-sub { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.info-value { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.progress {
    width: 100%;
    background: #eef2f7;
    border-radius: 999px;
    height: 8px;
}
.progress-bar {
    height: 8px;
    border-radius: 999px;
}
.progress-bar.blue { background: #4b8bff; }
.progress-bar.purple { background: var(--purple); }
.progress-bar.orange { background: var(--orange); }
.progress-bar.teal { background: var(--teal); }

.grid-two {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}

.card {
    background: #fafcff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
}
.card.tall { min-height: 320px; }

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

.forecast-list { display: flex; flex-direction: column; gap: 10px; }
.forecast-row {
    display: grid;
    grid-template-columns: 80px 1fr 40px;
    align-items: center;
    gap: 10px;
}
.forecast-day { font-weight: 700; }
.bar-track {
    width: 100%;
    height: 10px;
    background: #e9edf5;
    border-radius: 999px;
}
.bar-fill {
    height: 100%;
    border-radius: 999px;
}
.bar-fill.green { background: #27c281; }
.bar-fill.amber { background: var(--amber); }

.forecast-value { font-weight: 800; color: #1f2d3d; }

.chart-area {
    position: relative;
    height: 240px;
    padding-left: 50px; /* leave room for y-axis */
}

.chart-area svg {
    width: calc(100% - 50px);
    height: 190px;
    background: linear-gradient(180deg, #f2f6ff 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.chart-yaxis {
    position: absolute;
    left: 12px;
    top: 6px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 11px;
    color: var(--muted);
    z-index: 2;
    pointer-events: none;
}
.chart-yaxis .y-unit { color: #0f172a; font-weight: 700; }

.chart-axis {
    padding-left: 50px; /* align time labels with chart after adding y-axis gutter */
}

.chart-line {
    fill: none;
    stroke: #3d7dff;
    stroke-width: 1.8;
}

.chart-fill {
    fill: rgba(61, 125, 255, 0.2);
}

.chart-axis {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
    margin-top: 8px;
}

.cta {
    background: linear-gradient(120deg, #1f5cf1, #6a35ff);
    color: #fff;
    padding: 24px;
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 20px 40px rgba(31, 92, 241, 0.3);
}
.cta h3 { margin: 6px 0; }
.cta .text-light { color: rgba(255, 255, 255, 0.78); }
.cta-button {
    background: #fff;
    color: #1f5cf1;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow);
}
.api-cta {
    display: block;
}

.table-card {
    padding: 0;
    overflow: hidden;
}

.data-table {
    display: grid;
}

.data-row {
    display: grid;
    grid-template-columns: 2fr 1.2fr repeat(4, 1fr);
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: #1f2d3d;
}

.data-row.head {
    background: #f6f8fc;
    font-weight: 700;
    color: #0f172a;
}

.data-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.banner {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.banner.error {
    background: #fff5f5;
    color: #7f1d1d;
    border: 1px solid #fecaca;
}

@media (max-width: 1080px) {
    .app-shell { grid-template-columns: 88px 1fr; }
    .brand-name, .nav-item span:nth-child(2), .profile { display: none; }
    .sidebar { padding: 18px 12px; align-items: center; }
    .hero-grid { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .tabs { flex-wrap: wrap; }
}

@media (max-width: 768px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .topbar { grid-template-columns: 1fr; }
    .main { padding: 12px 16px 20px; }
    .hero-grid { grid-template-columns: 1fr; }
    .section { padding: 16px; }
    .tabs { flex-wrap: wrap; }
}

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #ffffff;
    color: #0f172a;
    z-index: 1100;
    border-top: 1px solid #e6e9f2;
}
.mobile-nav-item {
    text-align: center;
    padding: 10px 6px;
    color: #0f172a;
    text-decoration: none;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}
.mobile-nav-item i { font-size: 18px; }
.mobile-nav-item.active { color: #1f5cf1; }
.mobile-nav-item .mobile-badge {
    position: absolute;
    top: 4px;
    right: 12px;
    background: #e11d48;
    color: #fff;
    border-radius: 999px;
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1;
}
