/* Main Styles for CWC Gas Monitor Dashboard */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #0a0e27;
    color: #fff;
    overflow-x: hidden;
}

/* Layout */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #0f142e;
    border-right: 1px solid #1f2542;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.logo {
    padding: 24px 20px;
    border-bottom: 1px solid #1f2542;
    margin-bottom: 20px;
}

.logo h1 {
    font-size: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo p {
    font-size: 11px;
    color: #5a6180;
    margin-top: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    margin: 4px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #8b92b0;
    transition: all 0.2s;
}

.nav-item i {
    width: 20px;
    font-size: 16px;
}

.nav-item:hover {
    background: #1a1f3a;
    color: #fff;
}

.nav-item.active {
    background: #1a1f3a;
    color: #fff;
    border-left: 3px solid #667eea;
}

/* Main Content */
.main {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
}

.topbar {
    background: #0f142e;
    border-bottom: 1px solid #1f2542;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 99;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1f3a;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.content {
    padding: 24px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #0f142e;
    border: 1px solid #1f2542;
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: #667eea;
}

.stat-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 12px;
    color: #8b92b0;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
}

/* Tables */
.data-table {
    overflow-x: auto;
    margin-top: 15px;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px;
    background: #1a1f3a;
    color: #8b92b0;
    font-weight: 500;
    font-size: 12px;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #1f2542;
}

.data-table tr:hover {
    background: #1a1f3a;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge-co2 {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.badge-ph3 {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-online {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-offline {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-critical {
    background: #ef4444;
    color: white;
}

.badge-severe {
    background: #f59e0b;
    color: #000;
}

.badge-normal {
    background: #10b981;
    color: white;
}

/* Alert Cards */
.alert-card {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.alert-critical {
    border-left-color: #ef4444;
}

.alert-severe {
    border-left-color: #f59e0b;
}

/* Hierarchy Tree */
.hierarchy-tree {
    background: #0f142e;
    border: 1px solid #1f2542;
    border-radius: 12px;
    padding: 20px;
}

.tree-node {
    margin-left: 20px;
    margin-bottom: 10px;
    padding-left: 15px;
    border-left: 2px solid #667eea;
}

.tree-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px;
    cursor: pointer;
}

.tree-header:hover {
    background: #1a1f3a;
    border-radius: 8px;
}

.tree-device {
    margin-left: 40px;
    padding: 10px;
    background: #1a1f3a;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px;
    color: #8b92b0;
}

.loading i {
    font-size: 40px;
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    .sidebar span:not(.nav-item i) {
        display: none;
    }
    .main {
        margin-left: 70px;
    }
    .nav-item {
        justify-content: center;
        padding: 12px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}