/* ==========================================================================
   TempSensor Dashboard — Production Standalone Stylesheet
   Offline-first, zero-CDN runtime dependencies
   ========================================================================== */

:root {
    --bg-main: #070a13;
    --bg-surface: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #24344d;
    --bg-muted: #1e293b80;
    --border: #334155;
    --border-light: #475569;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --brand-primary: #0ea5e9;
    --brand-hover: #0284c7;
    --brand-glow: rgba(14, 165, 233, 0.2);
    
    /* Semantic Status & Battery */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #f43f5e;
    --info: #06b6d4;
    --purple: #a855f7;
    
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-secondary);
    font-family: var(--font-stack);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    display: flex;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Tabs */
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}

/* Sidebar & Navigation */
.nav-item {
    transition: all 0.15s ease-in-out;
}
.nav-item:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}
.nav-item.active {
    background-color: var(--bg-card) !important;
    color: #ffffff !important;
    border-left: 3px solid var(--brand-primary);
}
.nav-item.active svg,
.nav-item.active i {
    color: var(--brand-primary) !important;
}

/* Range Filter Pill Buttons */
.pill-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}
.pill-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}
.pill-btn.active {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

/* Interactive Device Cards */
.device-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.device-card:hover {
    border-color: var(--brand-primary);
    background-color: #131d35;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 20px var(--brand-glow);
}

/* Battery Pill Display */
.battery-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
}
.battery-shell {
    width: 22px;
    height: 12px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
    padding: 1px;
    position: relative;
    display: flex;
    align-items: center;
}
.battery-shell::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 2.5px;
    width: 2px;
    height: 5px;
    background: currentColor;
    border-radius: 0 1px 1px 0;
}
.battery-level {
    height: 100%;
    border-radius: 1px;
    background: currentColor;
    transition: width 0.3s ease;
}

/* Status Colors */
.text-batt-high { color: var(--success); }
.text-batt-med  { color: var(--warning); }
.text-batt-low  { color: var(--danger); }
.text-batt-chg  { color: var(--info); }

/* Graph KPI Stats Cards */
.kpi-stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.kpi-main-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.kpi-minmax-row {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    margin-top: 2px;
}

/* Custom Date Range Panel */
.custom-date-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

/* Modals */
#rule-modal {
    display: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}
#rule-modal.active {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto;
}
#rule-modal.active > div {
    transform: scale(1) !important;
}

/* Toast Notifications */
.toast {
    transform: translateX(120%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.show {
    transform: translateX(0);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Extended Vertical Chart Height */
#chart-combined-container {
    height: 640px !important;
    min-height: 560px !important;
    position: relative;
}
#chart-combined-container canvas {
    height: 100% !important;
}

