:root {
  --bg: #1e1e2f;
  --panel: #2a2a40;
  --accent: #4f80ff;
  --text: #e0e0e0;
  --tab-inactive: #3a3a55;

  --toast-bg: #333;
  --toast-text: #fff;
}

body.light {
  --bg: #f0f0f0;
  --panel: #ffffff;
  --accent: #0077cc;
  --text: #111;
  --tab-inactive: #ddd;

  --toast-bg: #222;
  --toast-text: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

#container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

#left {
  width: 40%;
  min-width: 250px;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}

#videoContainer {
  flex: 1;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

video {
  width: 100%;
  height: 100%;
}

#fullscreenBtn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 5px;
  font-size: 0.9em;
  z-index: 10;
}

#streamStatus {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.6);
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 0.85em;
  color: #fff;
  z-index: 10;
}

#themeToggle {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background: var(--panel);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1em;
}

#vertical-resizer {
  height: 6px;
  background: #555;
  cursor: row-resize;
}

#tabs {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-top: 1px solid #444;
  background-color: var(--panel);
}

#tab-buttons {
  display: flex;
  justify-content: space-around;
  background: var(--tab-inactive);
}

.tab-button {
  flex: 1;
  padding: 12px 0;
  text-align: center;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}

.tab-button:hover {
  background: var(--accent);
}

.tab-button.active {
  background: var(--panel);
  color: var(--accent);
  font-weight: bold;
}

.tab-content {
  flex: 1;
  padding: 15px;
  display: none;
}

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

select, input, button {
  padding: 10px;
  font-size: 1em;
  border: none;
  border-radius: 6px;
  margin-top: 10px;
}

select, input {
  width: 70%;
  background: #333;
  color: #eee;
}

body.light select, body.light input {
  background: #eee;
  color: #000;
}

button {
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: #3a6be0;
}

#resizer {
  width: 6px;
  background: #555;
  cursor: col-resize;
}

#map {
  flex: 1;
  border: none;
}

#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 1000;
  transition: opacity 0.3s ease;
}

#toast.hidden {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 768px) and (orientation: portrait) {
  #container {
    flex-direction: column;
  }

  #left {
    width: 100%;
    height: 50%;
    border-right: none;
  }

  #resizer {
    height: 6px;
    width: 100%;
    cursor: row-resize;
  }

  #map {
    width: 100%;
    height: 50%;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  #container {
    flex-direction: row;
  }

  #left {
    width: 50%;
    height: 100%;
  }

  #map {
    width: 50%;
    height: 100%;
  }

  #resizer {
    width: 6px;
    height: 100%;
    cursor: col-resize;
  }
}
