body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  background: #1e1e1e;
  /* Dark grey background */
  color: #f1f1f1;
  /* Light text */
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #2c2c2c;
  /* Slightly lighter dark grey */
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

header button {
  background: #d44b29;
  /* Bright green */
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

.actions {
  min-width: 0;
}

#logPanel {
  min-width: 0;
}

main {
  display: flex;
  flex: 1;
  gap: 1.5rem;
  padding: 1.5rem;
  box-sizing: border-box;
  overflow: hidden;
  min-height: 0;
  flex-wrap: nowrap;
}

/* Left column for actions */
.actions {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  min-height: 0;
}

/* Collapsible section styling */
details.action-section {
  background: #2a2a2a;
  /* Slightly lighter dark background */
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-sizing: border-box;
  cursor: pointer;
}

details[open] {
  margin-bottom: 0.5rem;
}

details summary {
  font-size: 1.25rem;
  font-weight: bold;
  color: rgb(155, 31, 31);
  outline: none;
  list-style: none;
}

details summary::-webkit-details-marker {
  display: none;
}

label {
  font-weight: 500;
  color: #f1f1f1;
}

input {
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #666;
  font-size: 1rem;
  background: #1e1e1e;
  color: #f1f1f1;
  width: 100%;
  box-sizing: border-box;
}

button.submit {
  margin-top: 0.5rem;
  background: #d44b29;
  /* Bright green */
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s ease;
}

button.submit:hover {
  background: #d44b29;
}

/* Right column for log panel */
#logPanel {
  flex: 1;
  background: #121212;
  /* Deep dark background */
  color: #f1f1f1;
  padding: 1rem;
  border-radius: 12px;
  overflow-y: auto;
  font-family: monospace;
  white-space: pre-line;
  min-width: 200px;
  background-color: rgb(155, 31, 31);
}

#logPanel h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  color: rgb(155, 31, 31);
  /* Match action color */
}

/* Responsive adjustments */
@media (max-width: 900px) {
  main {
    flex-direction: column;
    overflow: auto;
  }

  .actions,
  #logPanel {
    flex: unset;
  }
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 16px;
  padding: 16px;
}

.camera-card {
  position: relative;
  display: inline-block;
  margin: 10px;
  border: 1px solid #333;
  background: #000;
  color: #fff;
  padding: 5px;
  /* added padding around video */
  box-sizing: border-box;
  /* ensures padding doesn't break width */
}

.camera-card video {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
  border-radius: 2px;
  /* optional: slightly round corners to match padding */
}

/* PTZ buttons (left bottom) */
.controls.left {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: flex;
  gap: 5px;
  z-index: 10;
}

/* Custom video controls (right bottom) */
.controls.right {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 10;
}

/* Buttons style */
.controls button {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #fff;
  border-radius: 4px;
  color: #fff;
  padding: 5px 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.controls button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Volume slider */
.controls input[type="range"] {
  width: 80px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .camera-grid {
    grid-template-columns: 1fr;  /* single column */
    gap: 12px;
    padding-left: 0;             /* remove horizontal padding */
    padding-right: 0;            /* remove horizontal padding */
  }

  .camera-card {
    margin: 0;                   /* remove margin so card spans full width */
    width: 100%;                 /* full width of screen */
    box-sizing: border-box;      /* ensures padding is included in width */
  }

  /* PTZ toggle button */
  button.toggle-ptz {
    font-size: 1rem;
    padding: 6px 12px;
    margin: 0;
    width: auto;
    background-color: rgb(155, 31, 31);
    color: white;
  }

  /* PTZ buttons container */
  .controls.left {
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 5px;
    position: static;
  }

  .controls.left button {
    width: 100%;
    font-size: 18px;
    padding: 12px 0;
    background-color: rgb(155, 31, 31);
    color: white;
  }

  /* Right video controls on mobile: flow below video and PTZ dropdown */
  .controls.right {
    position: static;
    display: flex;
    gap: 5px;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 12px;
  }

  /* Video fills full card width */
  .camera-card video {
    width: 100%;
    height: auto;
    display: block;
  }
}