@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Outfit:wght@400;600;700;800&family=Space+Grotesk:wght@300;500;700&display=swap');

:root {
    --bg-deep: #0a0f14;
    --bg-card: #111820;
    --border: #1e232e;
    --primary: #00e5ff;
    --primary-alt: #4facfe;
    --primary-glow: rgba(0, 229, 255, 0.4);
    --secondary: #00d2ff;
    --safe: #00e5ff;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --moderate: #f59e0b;
    --text-high: #f1f5f9;
    --text-mid: #94a3b8;
    --text-low: #64748b;
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    --glass-shimmer: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Space Grotesk', -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-deep);
    color: var(--text-high);
    min-height: 100vh;
    padding-bottom: 100px;
    background-image:
        radial-gradient(circle at 100% 0%, rgba(0, 242, 254, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 0% 100%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Header Styling */
header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-area h1 {
    font-size: 1.1rem;
    letter-spacing: 2px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-high);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--safe);
    box-shadow: 0 0 10px var(--safe);
}

.header-meta {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}

.header-meta .sub {
    font-size: 0.65rem;
    color: var(--text-low);
    text-transform: uppercase;
}

/* Container */
.container {
    padding: 0 16px;
    max-width: 500px;
    margin: 0 auto;
}

/* Card - Tech Style */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--card-shadow);
}

.card h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-mid);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-trend {
    font-size: 0.65rem;
    color: var(--text-low);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Half-Circle Gauge */
.gauge-wrapper {
    position: relative;
    width: 240px;
    height: 140px;
    margin: 0 auto;
    overflow: hidden;
}

.gauge-svg {
    transform: rotate(-180deg);
}

.gauge-bg {
    fill: none;
    stroke: #1e2533;
    stroke-width: 14;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 14;
    stroke-linecap: round;
    stroke-dasharray: 283;
    /* Half circle circum for r=90 */
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.gauge-content {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.gauge-value {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.gauge-unit {
    font-size: 0.8rem;
    color: var(--text-low);
    font-family: 'JetBrains Mono', monospace;
}

.status-label {
    background: rgba(255, 157, 0, 0.1);
    color: var(--moderate);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    border: 1px solid rgba(255, 157, 0, 0.2);
}

/* Stats Grid */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #1e2533;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.6rem;
    color: var(--text-low);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.stat-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 700;
}

/* Temperature Section */
.temp-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.temp-main .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.temp-main .unit {
    font-size: 1rem;
    color: var(--text-low);
}

.temp-spark {
    width: 100px;
    height: 40px;
}

/* Predictions Columns */
.prediction-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.predict-col {
    background: rgba(0, 242, 254, 0.02);
    border: 1px solid rgba(0, 242, 254, 0.1);
    border-radius: 16px;
    padding: 16px 8px;
    text-align: center;
}

.predict-col i {
    font-size: 1rem;
    color: var(--text-mid);
    margin-bottom: 12px;
}

.predict-col .time {
    font-size: 0.65rem;
    color: var(--text-low);
    margin-bottom: 4px;
}

.predict-col .val {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.predict-col .status {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--safe);
    margin-top: 8px;
}

/* Risk Box */
.risk-box {
    background: rgba(0, 242, 254, 0.03);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.risk-icon {
    width: 36px;
    height: 36px;
    background: var(--safe);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-deep);
}

.risk-info h4 {
    font-size: 1rem;
    color: var(--safe);
    letter-spacing: 1px;
}

.risk-info p {
    font-size: 0.75rem;
    color: var(--text-low);
}

/* Action List */
.action-list {
    margin-top: 20px;
    list-style: none;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-mid);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #1e2533;
}

.action-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--safe);
    box-shadow: 0 0 5px var(--safe);
}

/* AI Assistant UI */
.ai-status-bar {
    background: rgba(22, 26, 35, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px 20px;
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.ai-status-item {
    text-align: center;
}

.ai-status-item .label {
    font-size: 0.55rem;
    color: var(--text-low);
    text-transform: uppercase;
}

.ai-status-item .val {
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--moderate);
}

/* Chat Interface */
.chat-container {
    overflow-y: auto;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeInMsg 0.3s ease-out;
}

@keyframes fadeInMsg {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message {
    background: rgba(0, 242, 254, 0.05);
    border: 1px solid rgba(0, 242, 254, 0.1);
    color: var(--text-high);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.user-message {
    background: rgba(0, 242, 254, 0.8);
    color: var(--bg-deep);
    font-weight: 600;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
}

.message.typing {
    opacity: 0.7;
    font-style: italic;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 4px 16px;
}

.chat-suggests {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 10px;
    scrollbar-width: none;
}

.suggest-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 0.75rem;
    color: var(--text-mid);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
}

.suggest-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Time Scale Buttons (Analytics) */
.time-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.75rem;
    color: var(--text-mid);
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-high);
}

.time-btn.active {
    background: rgba(0, 242, 254, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(0, 242, 254, 0.05);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.1) inset;
}

.chat-input-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px 8px 8px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input-pill input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    outline: none;
    font-size: 0.9rem;
}

.chat-send-circle {
    width: 40px;
    height: 40px;
    background: #1e2533;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-mid);
    cursor: pointer;
    transition: 0.3s;
}

.chat-send-circle:hover {
    background: var(--primary);
    color: var(--bg-deep);
}

/* Bottom Nav Overhaul */
nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #0a0d14;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 10px 0 20px;
    z-index: 2000;
}

.nav-item {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-low);
    transition: 0.3s;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item span {
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.nav-item.active {
    color: var(--primary);
}

/* Charts Background Overlay */
.chart-container-aqua {
    position: relative;
    padding-bottom: 10px;
}

.chart-stats-mini {
    display: flex;
    gap: 24px;
    margin-top: 16px;
}

.mini-stat .label {
    font-size: 0.7rem;
    color: var(--text-low);
}

.mini-stat .val {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 700;
}

/* Utils */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeInUp 0.5s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.no-data-overlay {
    background: rgba(10, 15, 20, 0.92);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    backdrop-filter: blur(4px);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: #0a0f14;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s;
}

/* Status Dot Pulse */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 10px var(--primary); }
    50%       { opacity: 0.5; transform: scale(1.3); box-shadow: 0 0 20px var(--primary); }
}

.status-dot {
    animation: pulse 2s infinite;
}