/**
 * AQUALINE - Industrial Monitoring System
 * Premium Dark Theme CSS
 */

/* ========================================
   CSS Variables & Design Tokens
   ======================================== */
/* ========================================
   CSS Variables & Design Tokens
   ======================================== */
:root {
    /* Shared Constants */
    --accent-primary: #3b82f6;
    --accent-secondary: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #06b6d4);

    --status-online: #10b981;
    --status-offline: #6b7280;
    --status-maintenance: #f59e0b;
    --status-error: #ef4444;
    --status-critical: #dc2626;

    --sidebar-width: 260px;
    --header-height: 70px;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Dark Theme (Default) */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(30, 41, 59, 0.6);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: rgba(148, 163, 184, 0.1);
    --border-hover: rgba(148, 163, 184, 0.2);

    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.8);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --border-color: #cbd5e1;
    --border-hover: #94a3b8;

    --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.2);
}

/* ========================================
   Reset & Base Styles
   ======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ========================================
   App Container Layout
   ======================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 16px 12px 8px;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-plant {
    font-size: 0.9rem;
    padding-left: 24px;
}

.nav-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 8px 16px;
    font-style: italic;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-left: auto;
}

.badge-danger {
    background: var(--status-error);
    color: white;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-btn {
    padding: 8px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background: var(--status-error);
    color: white;
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-time {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-offline);
    animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
    background: var(--status-online);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.content-wrapper {
    flex: 1;
    padding: 24px 32px;
    overflow-y: auto;
}

/* ========================================
   Dashboard Grid
   ======================================== */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card.alert-critical {
    border-color: var(--status-error);
    background: rgba(239, 68, 68, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.plants-icon {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
}

.equipment-icon {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-secondary);
}

.sensors-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-online);
}

.alerts-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--status-error);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-breakdown {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.stat-breakdown span {
    font-size: 0.75rem;
}

.status-online {
    color: var(--status-online);
}

.status-offline {
    color: var(--status-offline);
}

.status-critical {
    color: var(--status-critical);
}

/* ========================================
   Dashboard Sections
   ======================================== */
.dashboard-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
}

.dashboard-section.full-width {
    grid-column: 1 / -1;
}

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

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.section-link {
    font-size: 0.85rem;
    color: var(--accent-primary);
    transition: color var(--transition-fast);
}

.section-link:hover {
    color: var(--accent-secondary);
}

/* ========================================
   Equipment Grid
   ======================================== */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.equipment-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-normal);
    display: block;
}

.equipment-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.equipment-type {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--status-offline);
}

.equipment-card.status-online .status-indicator {
    background: var(--status-online);
}

.equipment-card.status-offline .status-indicator {
    background: var(--status-offline);
}

.equipment-card.status-maintenance .status-indicator {
    background: var(--status-maintenance);
}

.equipment-card.status-error .status-indicator {
    background: var(--status-error);
    animation: pulse-error 1s infinite;
}

@keyframes pulse-error {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
}

.equipment-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.equipment-plant {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.equipment-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.equipment-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 12px;
}

.equipment-lastseen {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ========================================
   Alerts List
   ======================================== */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alerts-list.full {
    max-height: none;
}

.alert-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 4px solid transparent;
}

.alert-item.severity-info {
    border-left-color: var(--accent-primary);
}

.alert-item.severity-warning {
    border-left-color: var(--status-maintenance);
}

.alert-item.severity-critical {
    border-left-color: var(--status-error);
}

.alert-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.severity-info .alert-indicator {
    background: var(--accent-primary);
}

.severity-warning .alert-indicator {
    background: var(--status-maintenance);
}

.severity-critical .alert-indicator {
    background: var(--status-error);
    animation: pulse-error 1s infinite;
}

.alert-content {
    flex: 1;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.alert-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.alert-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.alert-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.alert-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.alert-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.severity-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.severity-info .severity-badge {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
}

.severity-warning .severity-badge {
    background: rgba(245, 158, 11, 0.2);
    color: var(--status-maintenance);
}

.severity-critical .severity-badge {
    background: rgba(239, 68, 68, 0.2);
    color: var(--status-error);
}

/* ========================================
   Plants Grid
   ======================================== */
.plants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.plant-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-normal);
    display: block;
}

.plant-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

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

.plant-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.plant-status {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.plant-status.status-good {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-online);
}

.plant-status.status-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--status-maintenance);
}

.plant-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.plant-location svg {
    width: 14px;
    height: 14px;
}

.plant-equipment-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state.small {
    padding: 24px;
}

.empty-state.small svg {
    width: 32px;
    height: 32px;
}

.empty-state p {
    font-weight: 500;
    margin-bottom: 4px;
}

.empty-state span {
    font-size: 0.85rem;
}

/* ========================================
   Login Page
   ======================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    position: relative;
    z-index: 10;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-messages {
    margin-bottom: 8px;
}

.message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
}

.message-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--status-error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition-normal);
    margin-top: 8px;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.login-button svg {
    width: 18px;
    height: 18px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.login-background {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    /* Allow clicks to pass through */
}

.bg-gradient {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(6, 182, 212, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.bg-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M54.627 0l.83.828-1.415 1.415L51.8 0h2.827zM5.373 0l-.83.828L5.96 2.243 8.2 0H5.374zM48.97 0l3.657 3.657-1.414 1.414L46.143 0h2.828zM11.03 0L7.372 3.657 8.787 5.07 13.857 0H11.03zm32.284 0L49.8 6.485 48.384 7.9l-7.9-7.9h2.83zM16.686 0L10.2 6.485 11.616 7.9l7.9-7.9h-2.83zm20.97 0l9.315 9.314-1.414 1.414L34.828 0h2.83zM22.344 0L13.03 9.314l1.414 1.414L25.172 0h-2.83zM32 0l12.142 12.142-1.414 1.414L30 .828 17.272 13.556l-1.414-1.414L28 0h4zM.284 0l28 28-1.414 1.414L0 2.544v-2.26zM0 5.373l25.456 25.455-1.414 1.415L0 8.2V5.374zm0 5.656l22.627 22.627-1.414 1.414L0 13.86v-2.83zm0 5.656l19.8 19.8-1.415 1.413L0 19.514v-2.83zm0 5.657l16.97 16.97-1.414 1.415L0 25.172v-2.83zM0 28l14.142 14.142-1.414 1.414L0 30.828V28z' fill='%23ffffff' fill-opacity='1' fill-rule='evenodd'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* ========================================
   Info Cards (Equipment Detail)
   ======================================== */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.info-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-weight: 500;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-online);
}

.status-badge.status-offline {
    background: rgba(107, 114, 128, 0.2);
    color: var(--status-offline);
}

.status-badge.status-maintenance {
    background: rgba(245, 158, 11, 0.2);
    color: var(--status-maintenance);
}

.status-badge.status-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--status-error);
}

/* ========================================
   Sensors Grid
   ======================================== */
.sensors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.sensor-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-normal);
}

.sensor-card:hover {
    border-color: var(--border-hover);
}

.sensor-card.alert {
    border-color: var(--status-error);
    background: rgba(239, 68, 68, 0.05);
}

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

.sensor-type {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-secondary);
}

.alert-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--status-error);
    color: white;
    animation: pulse 1s infinite;
}

.sensor-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.sensor-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
}

.sensor-value .value {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.sensor-value .unit {
    font-size: 1rem;
    color: var(--text-secondary);
}

.sensor-range {
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.sensor-chart {
    height: 60px;
    margin: 12px 0;
}

.sensor-updated {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   Alerts Page
   ======================================== */
.alerts-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.alerts-filter {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.filter-btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* ========================================
   Analysis Page
   ======================================== */
.analysis-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.analysis-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.control-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-select {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 24px;
    height: 400px;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    text-align: center;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ========================================
   Responsive Design
   ======================================== */

/* Mobile Menu Button */
.mobile-menu-toggle {
    display: none;
    padding: 8px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    transition: all var(--transition-fast);
    margin-right: 12px;
}

.mobile-menu-toggle:hover {
    background: var(--accent-primary);
    color: white;
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.mobile-overlay.active {
    opacity: 1;
}

/* Tablet Breakpoint */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }

    .content-wrapper {
        padding: 20px;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .info-cards {
        grid-template-columns: 1fr;
    }
}

/* Mobile Breakpoint */
@media (max-width: 768px) {
    /* Show mobile menu button */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Show overlay when menu is open */
    .mobile-overlay {
        display: block;
        pointer-events: none;
    }

    .mobile-overlay.active {
        pointer-events: auto;
    }

    /* Hide sidebar by default, show when .open */
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: 100;
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Main content takes full width */
    .main-content {
        margin-left: 0;
    }

    /* Header adjustments */
    .main-header {
        padding: 0 16px;
        height: 60px;
    }

    .header-left {
        flex: 1;
        min-width: 0;
    }

    .page-title {
        font-size: 1.2rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .page-subtitle {
        font-size: 0.75rem;
        display: none;
    }

    .header-time {
        display: none;
    }

    .connection-status {
        padding: 4px 8px;
    }

    .status-text {
        display: none;
    }

    /* Content padding */
    .content-wrapper {
        padding: 16px;
    }

    /* Stats grid - 2 columns on mobile */
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .stat-breakdown {
        margin-left: 0;
        align-items: center;
        flex-direction: row;
        gap: 8px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* Equipment grid - single column */
    .equipment-grid {
        grid-template-columns: 1fr;
    }

    /* Plants grid - single column */
    .plants-grid {
        grid-template-columns: 1fr;
    }

    /* Sensors grid - single column */
    .sensors-grid {
        grid-template-columns: 1fr;
    }

    /* Alerts filter - scrollable */
    .alerts-filter {
        overflow-x: auto;
        padding: 12px;
        gap: 6px;
    }

    .filter-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Analysis controls - stack vertically */
    .analysis-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        min-width: 100%;
    }

    /* Info grid - single column */
    .info-grid {
        grid-template-columns: 1fr;
    }

    /* Section header - stack on mobile */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Dashboard sections */
    .dashboard-section {
        padding: 16px;
    }

    .section-title {
        font-size: 1rem;
    }

    /* Login page adjustments */
    .login-card {
        padding: 24px 20px;
    }

    .login-header h1 {
        font-size: 1.5rem;
    }

    /* Prevent body scroll when mobile menu is open */
    body.mobile-menu-open {
        overflow: hidden;
    }
}

/* Small Mobile Breakpoint */
@media (max-width: 480px) {
    /* Single column stats on very small screens */
    .stats-row {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        text-align: left;
    }

    .stat-breakdown {
        flex-direction: column;
        align-items: flex-end;
    }

    /* Smaller padding */
    .content-wrapper {
        padding: 12px;
    }

    .equipment-card,
    .sensor-card,
    .plant-card {
        padding: 16px;
    }

    /* Alert items - tighter */
    .alert-item {
        padding: 12px;
        gap: 12px;
    }

    .alert-header {
        flex-direction: column;
        gap: 4px;
    }

    .alert-meta {
        flex-wrap: wrap;
    }

    /* Sensor value smaller */
    .sensor-value .value {
        font-size: 1.5rem;
    }

    /* Nav items - larger touch targets */
    .nav-item {
        padding: 14px 16px;
    }
}