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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #1a1a1a;
  color: #e0e0e0;
  overflow: hidden;
}

.dashboard-container {
  display: flex;
  height: 100vh;
  gap: 0;
}

/* ===== FLEX RATIO OPTIMIZATION ===== */
.main-feed {
  flex: 4;
}

.sidebar {
  flex: 0.8;
}

/* ===== MAIN FEED (Kolom Kiri) ===== */
.main-feed {
  flex: 3;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background-color: #0f0f0f;
  border-right: 1px solid #333;
  overflow-y: auto;
}

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

.feed-header h2 {
  font-size: 1.5rem;
  color: #fff;
}

.status-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: #ff4444;
  border-radius: 50%;
  margin-left: 10px;
  animation: pulse 2s infinite;
}

.status-indicator.online {
  background-color: #44ff44;
  animation: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Video Wrapper */
.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-bottom: 10px;
  background-color: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  /* Maintain 16:9 aspect ratio for better video quality */
  aspect-ratio: 16 / 9;
}

#video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

#overlayCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Controls */
.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn-primary {
  background-color: #0066cc;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: #0052a3;
  box-shadow: 0 4px 8px rgba(0, 102, 204, 0.3);
}

.btn-secondary {
  background-color: #666;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #555;
}

.btn-info {
  background-color: #17a2b8;
  color: white;
}

.btn-info:hover:not(:disabled) {
  background-color: #138496;
  box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Face Count Display */
.face-count-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: transparent;
  border: none;
  border-radius: 6px;
  margin-bottom: 0;
  font-size: 0.9rem;
}

.face-label {
  color: #b0b0b0;
  font-weight: 500;
}

.face-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #0066cc, #0052a3);
  color: white;
  border-radius: 50%;
  font-weight: bold;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

/* Chart Container */
.chart-container {
  flex: 0;
  min-height: 220px;
  max-height: 220px;
  background-color: #1a1a1a;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #333;
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

.chart-container h3 {
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: #fff;
  flex-shrink: 0;
}

#emotionChart {
  flex: 1;
  min-height: 0;
}

/* ===== SIDEBAR (Kolom Kanan) ===== */
.sidebar {
  flex: 0.8;
  display: flex;
  flex-direction: column;
  background-color: #222;
  border-left: 1px solid #333;
  padding: 15px;
  overflow: hidden;
  gap: 0;
}

.sidebar-header {
  margin-bottom: 15px;
  border-bottom: 2px solid #0066cc;
  padding-bottom: 10px;
}

.sidebar-header h3 {
  font-size: 1.3rem;
  color: #fff;
}

/* Search & Filter */
.search-filter {
  margin-bottom: 20px;
}

.search-box {
  width: 100%;
  padding: 10px;
  background-color: #333;
  border: 1px solid #444;
  border-radius: 6px;
  color: #e0e0e0;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.search-box::placeholder {
  color: #888;
}

.search-box:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 4px rgba(0, 102, 204, 0.3);
}

.filter-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-btn {
  padding: 8px 12px;
  background-color: #333;
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background-color: #444;
  border-color: #0066cc;
}

/* Event Log */
.event-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #444;
}

.event-log-header h4 {
  font-size: 1rem;
  color: #fff;
}

.event-count {
  background-color: #0066cc;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.event-log {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
}

.event-log::-webkit-scrollbar {
  width: 6px;
}

.event-log::-webkit-scrollbar-track {
  background: #333;
  border-radius: 3px;
}

.event-log::-webkit-scrollbar-thumb {
  background: #0066cc;
  border-radius: 3px;
}

.event-log::-webkit-scrollbar-thumb:hover {
  background: #0052a3;
}

.log-item {
  background-color: #2a2a2a;
  border-left: 3px solid #0066cc;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: all 0.2s ease;
}

.log-item:hover {
  background-color: #333;
  box-shadow: 0 2px 6px rgba(0, 102, 204, 0.2);
}

.log-item strong {
  color: #0066cc;
  display: block;
  margin-bottom: 4px;
}

.log-item-emotion {
  color: #44ff44;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-container {
    flex-direction: column;
  }

  .main-feed {
    flex: 1;
    border-right: none;
    border-bottom: 1px solid #333;
  }

  .sidebar {
    flex: 1;
    border-left: none;
  }
}
