:root { 
    --bg: #1a1a2e; --card: #16213e; --accent: #0f3460; 
    --text: #f1f1f1; --success: #2ecc71; --danger: #e74c3c; 
    --blue: #3498db; --orange: #e67e22; --purple: #9b59b6; --ai: #00d2ff; 
}
body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); margin: 0; padding: 20px; display: flex; flex-direction: column; align-items: center; }
.container { width: 100%; max-width: 1200px; display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
header { width: 100%; max-width: 1200px; display: flex; justify-content: space-between; margin-bottom: 20px; border-bottom: 1px solid #333; padding-bottom: 10px; }

/* Status Badge */
.badge { background: rgba(46,204,113,0.2); color: var(--success); padding: 5px 15px; border-radius: 20px; font-weight: bold; display: flex; align-items: center; gap: 5px; }
.badge.offline { background: rgba(231,76,60,0.2); color: var(--danger); }

/* Card Style */
.card { background: var(--card); border-radius: 15px; padding: 20px; margin-bottom: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
h3 { margin: 0 0 15px 0; color: #aaa; display: flex; gap: 10px; align-items: center; }

/* Camera Box */
.cam-box { height: 350px; background: #000; border-radius: 10px; position: relative; overflow: hidden; display: flex; justify-content: center; align-items: center; border: 2px solid #333; }
.cam-box img { width: 100%; height: 100%; object-fit: cover; }
.rec-dot { position: absolute; top: 15px; right: 15px; width: 15px; height: 15px; background: red; border-radius: 50%; animation: blink 1s infinite; }

/* SLIDER CAM CONTROL (MỚI) */
.cam-controls { margin-top: 15px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,0.1); }
.slider-group { display: flex; align-items: center; gap: 15px; }
.icon-cam { color: var(--ai); font-size: 1.2em; }
.angle-val { min-width: 40px; text-align: right; font-weight: bold; color: var(--ai); font-family: monospace; }
.cam-slider { -webkit-appearance: none; width: 100%; height: 6px; background: #333; border-radius: 5px; outline: none; }
.cam-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; background: var(--ai); border-radius: 50%; cursor: pointer; box-shadow: 0 0 10px rgba(0,210,255,0.5); }

/* Controls Switch */
.ctrl-row { display: flex; justify-content: space-between; align-items: center; }
.switch { position: relative; width: 60px; height: 34px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background: var(--success); }
input:checked + .slider:before { transform: translateX(26px); }

/* Sensor Grids */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.val-box { font-size: 1.8em; font-weight: bold; margin: 10px 0; }
.unit { font-size: 0.5em; color: #888; }
.bar-wrap { margin-bottom: 12px; font-size: 0.9em; }
.bar-bg { background: #333; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar-fill { height: 100%; width: 0%; transition: width 1s; }

/* AI Section */
.ai-card { background: linear-gradient(135deg, #16213e, #0f1c30); border: 1px solid var(--accent); }
.ai-box { background: rgba(0,0,0,0.3); padding: 15px; border-radius: 10px; min-height: 80px; font-family: monospace; color: #e0e0e0; margin-bottom: 10px; white-space: pre-line; }
.ai-tools { display: flex; gap: 10px; }
.custom-select { background: #0f3460; color: white; border: none; padding: 5px; border-radius: 5px; flex: 1; }
.ai-btn { flex: 1; padding: 10px; border: none; border-radius: 20px; background: linear-gradient(90deg, #00d2ff, #3a7bd5); color: white; font-weight: bold; cursor: pointer; }
.ai-btn:disabled { opacity: 0.6; }

@keyframes blink { 50% { opacity: 0; } }
@media (max-width: 768px) { .container { grid-template-columns: 1fr; } }

canvas {
    max-height: 250px;
}

/* AI Card nổi bật hơn */
.ai-card {
    border: 2px solid var(--ai);
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.2);
}