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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 28px;
    color: #333;
}

.header-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.status-badge.connected {
    background: #10b981;
    color: white;
}

.status-badge.disconnected {
    background: #ef4444;
    color: white;
}

#last-update {
    font-size: 14px;
    color: #666;
}

section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

section h2 {
    font-size: 22px;
    color: #333;
    margin-bottom: 20px;
}

/* 디바이스 선택 */
.device-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.device-selector label {
    font-weight: 600;
    color: #555;
}

.device-selector select {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.device-selector select:hover {
    border-color: #667eea;
}

.device-selector select:focus {
    outline: none;
    border-color: #667eea;
}

/* 버튼 */
.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #e5e7eb;
    color: #333;
}

.btn-secondary:hover {
    background: #d1d5db;
}

/* 차트 */
.chart-container {
    position: relative;
    height: 400px;
    margin-top: 20px;
}

.chart-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.update-interval {
    font-size: 14px;
    color: #666;
}

/* 시간 범위 선택 */
.time-range-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.time-btn {
    padding: 10px 20px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.time-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.time-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 통계 카드 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    color: white;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-unit {
    font-size: 14px;
    opacity: 0.8;
}

/* 디바이스 그리드 */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.device-card {
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s;
}

.device-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.2);
}

.device-card h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
}

.device-card .device-stat {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 14px;
}

.device-card .device-stat-label {
    color: #666;
}

.device-card .device-stat-value {
    font-weight: 600;
    color: #333;
}

/* 이벤트 리스트 */
.events-list {
    max-height: 400px;
    overflow-y: auto;
}

.event-item {
    padding: 15px;
    border-left: 4px solid #ef4444;
    background: #fef2f2;
    border-radius: 8px;
    margin-bottom: 10px;
}

.event-item.warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.event-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.event-device {
    font-weight: 600;
    color: #333;
}

.event-time {
    font-size: 14px;
    color: #666;
}

.event-details {
    font-size: 14px;
    color: #555;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* 반응형 */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
    }

    .device-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .time-range-selector {
        flex-wrap: wrap;
    }

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






