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

:root {
    /* Premium Navy Palette */
    --bg-primary: #030712;
    --bg-secondary: #0f172a;
    --bg-mesh: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.12), transparent 25%),
               radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.08), transparent 25%);
    
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    --glass-panel: rgba(30, 41, 59, 0.5);
    
    --color-text-main: #F8FAFC;
    --color-text-muted: #94A3B8;
    
    /* Semantic Colors */
    --color-safe: #10B981;
    --color-safe-glow: rgba(16, 185, 129, 0.3);
    --color-warn: #F59E0B;
    --color-warn-glow: rgba(245, 158, 11, 0.3);
    --color-danger: #EF4444;
    --color-danger-glow: rgba(239, 68, 68, 0.3);
    --color-info: #3B82F6;
    --color-info-glow: rgba(59, 130, 246, 0.3);

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    background-image: var(--bg-mesh);
    color: var(--color-text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    padding: 1.5rem;
    overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

/* 12-Column Grid System */
.dashboard-container {
    max-width: 1800px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

/* Row 1: Header */
.header-full {
    grid-column: span 12;
    background: linear-gradient(135deg, rgba(15,23,42,0.9) 0%, rgba(15,23,42,0.6) 100%);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

.header-brand { display: flex; align-items: center; gap: 1rem; }
.header-brand i { font-size: 2.5rem; color: var(--color-safe); filter: drop-shadow(0 0 10px var(--color-safe-glow)); }
.header-brand h1 { font-family: var(--font-heading); font-size: 1.8rem; font-weight: 700; letter-spacing: 0.5px; }
.header-brand p { font-size: 0.9rem; color: var(--color-text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }

.header-status { display: flex; align-items: center; gap: 2.5rem; }
.time-display { font-family: var(--font-heading); color: var(--color-text-muted); font-size: 1.1rem; font-weight: 500; }
.device-status { display: flex; align-items: center; gap: 0.7rem; font-size: 0.95rem; font-weight: 500; color: var(--color-text-main); }
.pulse-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--color-safe); box-shadow: 0 0 12px var(--color-safe); animation: pulse 2s infinite; }
.pulse-dot.offline { background: var(--color-danger); box-shadow: 0 0 12px var(--color-danger); animation: none; }

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 var(--color-safe-glow); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Row 2: 4 Sensor Cards */
.sensor-card {
    grid-column: span 3;
    padding: 1.8rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.sensor-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,0.15); box-shadow: 0 20px 40px -10px rgba(0,0,0,0.6); }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; z-index: 2; position: relative; }
.card-title { font-size: 0.95rem; color: var(--color-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; gap: 0.5rem; }
.card-icon { font-size: 1.5rem; color: var(--color-info); }
.card-bg-icon { position: absolute; top: -10px; right: -15px; font-size: 8rem; opacity: 0.03; transform: rotate(15deg); z-index: 1; }

.card-value-wrapper { display: flex; align-items: baseline; gap: 0.5rem; z-index: 2; position: relative; }
.card-value { font-family: var(--font-heading); font-size: 3.5rem; font-weight: 700; line-height: 1; color: var(--color-text-main); }
.card-unit { font-size: 1.1rem; color: var(--color-text-muted); font-weight: 500; }

.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; z-index: 2; position: relative; font-size: 0.85rem; font-weight: 500; }
.trend-up { color: var(--color-danger); background: rgba(239, 68, 68, 0.1); padding: 0.3rem 0.6rem; border-radius: 6px; }
.trend-down { color: var(--color-safe); background: rgba(16, 185, 129, 0.1); padding: 0.3rem 0.6rem; border-radius: 6px; }
.trend-neutral { color: var(--color-info); background: rgba(59, 130, 246, 0.1); padding: 0.3rem 0.6rem; border-radius: 6px; }

/* Row 3: Chart & Safety Center */
.monitor-panel { grid-column: span 8; padding: 1.5rem; display: flex; flex-direction: column; height: 500px; }
.chart-wrapper { position: relative; flex-grow: 1; width: 100%; min-height: 0; margin-top: 1rem; }

.safety-center {
    grid-column: span 4;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 500px;
    transition: var(--transition);
}

.sc-title { font-size: 1rem; text-transform: uppercase; letter-spacing: 2px; color: var(--color-text-muted); margin-bottom: 2rem; font-weight: 600;}
.sc-status { font-family: var(--font-heading); font-size: 4.5rem; font-weight: 800; letter-spacing: 3px; line-height: 1; margin-bottom: 1rem; transition: var(--transition); }
.sc-desc { font-size: 1.1rem; color: var(--color-text-muted); max-width: 80%; line-height: 1.5; margin-bottom: 2.5rem; }

.sc-metrics { display: flex; gap: 2rem; width: 100%; justify-content: center; }
.sc-metric-box { background: var(--glass-panel); padding: 1rem 1.5rem; border-radius: 12px; border: 1px solid var(--glass-border); width: 45%; }
.sc-metric-label { font-size: 0.8rem; color: var(--color-text-muted); text-transform: uppercase; margin-bottom: 0.5rem; }
.sc-metric-val { font-family: var(--font-heading); font-size: 1.8rem; font-weight: 700; }

/* State Colors for Safety Center */
.sc-safe .sc-status { color: var(--color-safe); text-shadow: 0 0 30px var(--color-safe-glow); }
.sc-safe { border-top: 4px solid var(--color-safe); background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, var(--glass-bg) 100%); }
.sc-warn .sc-status { color: var(--color-warn); text-shadow: 0 0 30px var(--color-warn-glow); }
.sc-warn { border-top: 4px solid var(--color-warn); background: linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, var(--glass-bg) 100%); }
.sc-danger .sc-status { color: var(--color-danger); text-shadow: 0 0 30px var(--color-danger-glow); }
.sc-danger { border-top: 4px solid var(--color-danger); background: linear-gradient(180deg, rgba(239, 68, 68, 0.08) 0%, var(--glass-bg) 100%); animation: pulse-border 2s infinite; }

@keyframes pulse-border { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

/* Section Titles */
.section-title { font-family: var(--font-heading); font-size: 1.2rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; border-bottom: 1px solid var(--glass-border); padding-bottom: 1rem; margin-bottom: 1rem; }
.section-title i { color: var(--color-info); font-size: 1.4rem; }

/* Row 4: Analytics, Timeline, Stats */
.ai-panel { grid-column: span 4; padding: 1.5rem; display: flex; flex-direction: column; }
.ai-list { display: flex; flex-direction: column; gap: 1.2rem; margin-top: 0.5rem; flex-grow: 1; justify-content: center; }
.ai-item { display: flex; gap: 1rem; align-items: flex-start; }
.ai-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--glass-panel); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; color: var(--color-info); }
.ai-text h4 { font-size: 0.9rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.3rem; }
.ai-text p { font-size: 1rem; color: var(--color-text-main); line-height: 1.4; }
.ai-text p.highlight { color: var(--color-safe); font-weight: 500; }

.timeline-panel { grid-column: span 4; padding: 1.5rem; display: flex; flex-direction: column; }
.timeline-list { display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; max-height: 300px; padding-right: 0.5rem; margin-top: 0.5rem; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.timeline-item { display: flex; gap: 1rem; padding: 1rem; background: var(--glass-panel); border-radius: 12px; border-left: 3px solid var(--color-safe); transition: var(--transition); }
.timeline-item:hover { background: rgba(255,255,255,0.06); }
.timeline-time { font-family: var(--font-heading); font-size: 0.85rem; color: var(--color-text-muted); min-width: 65px; }
.timeline-content h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.2rem; }
.timeline-content p { font-size: 0.85rem; color: var(--color-text-muted); }

.stats-panel { grid-column: span 4; padding: 1.5rem; display: flex; flex-direction: column; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.5rem; flex-grow: 1; align-content: center; }
.stat-box { background: var(--glass-panel); padding: 1.5rem 1rem; border-radius: 12px; text-align: center; border: 1px solid var(--glass-border); }
.stat-val { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; color: var(--color-text-main); margin-bottom: 0.3rem; }
.stat-label { font-size: 0.8rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Responsive Adjustments */
@media (max-width: 1400px) {
    .sensor-card { grid-column: span 6; }
    .monitor-panel { grid-column: span 12; height: 400px; }
    .safety-center { grid-column: span 12; height: 300px; flex-direction: row; justify-content: space-around; text-align: left; }
    .sc-desc { max-width: 100%; margin-bottom: 0; }
    .sc-metrics { width: auto; flex-direction: column; gap: 1rem; }
    .ai-panel, .timeline-panel, .stats-panel { grid-column: span 12; }
}
@media (max-width: 768px) {
    .header-full { flex-direction: column; gap: 1rem; text-align: center; }
    .header-status { flex-direction: column; gap: 0.5rem; }
    .sensor-card { grid-column: span 12; }
    .safety-center { flex-direction: column; text-align: center; height: auto; }
    .sc-metrics { flex-direction: row; width: 100%; }
}
