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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.tabs {
    display: flex;
    background: #f8f9fa;
    padding: 0;
    border-bottom: 2px solid #e9ecef;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6c757d;
}

.tab-button:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.tab-button.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-banner {
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.status-banner.normal {
    background: #d4edda;
    color: #155724;
}

.status-banner.warning {
    background: #fff3cd;
    color: #856404;
}

.status-banner.danger {
    background: #f8d7da;
    color: #721c24;
}

.sensor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.sensor-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sensor-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.sensor-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.sensor-name {
    font-size: 1rem;
    color: #6c757d;
    margin-bottom: 10px;
    font-weight: 600;
}

.sensor-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.sensor-unit {
    font-size: 0.9rem;
    color: #6c757d;
}

.update-info {
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

.chart-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.chart-controls label {
    font-weight: 600;
    color: #333;
}

.chart-controls select {
    padding: 8px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.chart-controls select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-refresh, .btn-export {
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-refresh:hover, .btn-export:hover {
    background: #5568d3;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    position: relative;
}

.chart-container canvas {
    min-height: 350px !important;
    height: 400px !important;
}

.table-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.table-container {
    overflow-x: auto;
    border-radius: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: #f8f9fa;
}

td {
    padding: 12px 15px;
}

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

.stat-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row span:first-child {
    color: #6c757d;
    font-weight: 600;
}

.stat-row span:last-child {
    color: #333;
    font-weight: 700;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .sensor-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .tab-button {
        font-size: 0.9rem;
        padding: 12px 10px;
    }
    
    /* 차트 높이 보장 */
    .chart-container {
        min-height: 450px;
        padding: 15px;
    }
    
    .chart-container canvas {
        min-height: 400px !important;
        height: 400px !important;
    }
    
    /* 차트 컨트롤 모바일 최적화 */
    .chart-controls {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .chart-controls label {
        width: 100%;
    }
    
    .chart-controls select {
        flex: 1;
        min-width: 150px;
    }
}
