/* Reset layout */
body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: #0f172a;
  color: #fff;
}

/* Header */
#page-header {
  text-align: center;
  padding: 20px 0 10px;
  color: white;
}
#page-header h1 {
  font-size: 2.5rem;
  margin: 0;
}
#page-header p {
  font-size: 1.1rem;
  color: #cccccc;
  margin-top: 5px;
}
.highlight {
  color: #4db8ff;
}

/* Main app container */
#app {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  gap: 30px;
  padding: 20px;
  flex-wrap: wrap;
}

/* Columns */
#left-column, #right-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
#left-column {
  flex: 1;
  min-width: 320px;
  max-width: 50%;
}
#right-column {
  flex: 1;
  min-width: 320px;
  max-width: 50%;
  justify-content: space-between;
}

/* Cards */
.card {
  background-color: #1e293b;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

/* Video */
#video-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.video-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#webcam {
  width: 100%;
  max-width: 640px;
  height: auto;
  border-radius: 12px;
  border: 3px solid #444;
  object-fit: cover;
}

.card-title {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.3rem;
  text-align: center;
  color: #f0f1f1;
}


/* Status panel */
#driverStatus {
  font-weight: bold;
  color: #ccc;
}
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
progress {
  width: 200px;
  height: 20px;
}

/* Controls */
.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
#controls-card label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
}
button {
  padding: 10px 16px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
button.starting {
  background-color: #28a745;
  color: white;
}
button.stopping {
  background-color: #dc3545 !important;
  color: white;
}
button:hover {
  filter: brightness(1.1);
}

/* Card-specific */
#distraction-card h3 {
  margin-top: 0;
  color: #4db8ff;
}
#controls-card {
  align-items: stretch;
}
#controls-card .controls-row {
  justify-content: space-between;
}

/* Responsive Layout */
@media screen and (max-width: 1130px) {
  #app {
    flex-direction: column;
    align-items: center;
  }
  #left-column,
  #right-column {
    max-width: 100%;
    width: 100%;
    align-items: center;
  }
  .card {
    width: 90%;
  }
  .controls-row {
    flex-direction: row;
    justify-content: center;
    gap: 20px;
  }
  button {
    width: auto;
  }
  .bar {
    flex-direction: column;
    align-items: flex-start;
  }
}


#distraction-card {
  text-align: center;
}

#distraction-card h3 {
  margin-bottom: 10px;
  font-size: 1.3rem;
  color: #4db8ff;
}

.score-number {
  font-size: 1.8rem;
  font-weight: bold;
  display: block;
  margin-bottom: 5px;
}

.bar {
  flex-direction: column;
  align-items: center;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  margin-top: 8px;
  padding: 0 10px;
}

.label-safe {
  color: #b0c4de;
  text-align: left;
}
.label-low {
  color: #4caf50;
  text-align: center;
}
.label-danger {
  color: #ccc;
  text-align: right;
}


.bar {
  width: 100%;
}

#scoreBar {
  width: 100%;
  height: 20px;
  border-radius: 10px;
  overflow: hidden;
  appearance: none;
}

/* For Chrome */
#scoreBar::-webkit-progress-bar {
  background-color: #2f2f3a;
  border-radius: 10px;
}
#scoreBar::-webkit-progress-value {
  background-color: #4db8ff;
  border-radius: 10px;
}


/* Switch container */
.switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
}

/* Hide native checkbox */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #666;
  transition: 0.4s;
  border-radius: 34px;
}
.slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

/* When checked */
.switch input:checked + .slider {
  background-color: #4db8ff;
}
.switch input:checked + .slider::before {
  transform: translateX(24px);
}


#driver-info {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  gap: 15px;
  width: 100%;
  max-width: 500px;
}

#driver-info h2 {
  margin-top: 0;
  font-size: 1.4rem;
  color: #66ccff;
  text-align: center;
}

.sub-card-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}

.sub-card {
  background-color: #0f172a; /* Your preferred dark */
  border-radius: 8px;
  padding: 12px;
  font-size: 0.95rem;
  flex: 1;
  text-align: center;
  box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

.full-row {
  width: 100%;
  display: flex;
}

.status-row {
  width: 100%;
  font-weight: bold;
  font-size: 1rem;
  background-color: #0f172a;
  padding: 14px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 0 5px rgba(0,0,0,0.3);
}


/* Alignment helpers */
.full-width {
  width: 100%;
}
.two-col > .sub-card {
  flex: 1;
}
.three-col > .sub-card {
  flex: 1;
}
