@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400&display=swap');

:root {
  --bg: #000000;
  --surface: #121212;
  --panel: #1e1e1e;
  --text: #ffffff;
  --muted: #a0a0a0;
  --primary: #3d8aff;
  --primary-hover: #509cff;
  --next: #00c853;
  --stop: #ff3d00;
  --line: rgba(255, 255, 255, 0.1);
  --glass: rgba(0, 0, 0, 0.6);
  --radius: 8px;
}

[data-theme="light"] {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --panel: #f0f2f5;
  --text: #1a1a1b;
  --muted: #65676b;
  --line: rgba(0, 0, 0, 0.08);
  --glass: rgba(255, 255, 255, 0.8);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  transition: background-color 0.3s, color 0.3s;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* --- Video Grid (50/50 Split) --- */
.video-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #000;
  gap: 1px; /* Subtle divider */
  overflow: hidden;
}

.camera-slot {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0a0a;
}

.slot-label {
  position: absolute;
  top: 15px;
  padding: 4px 12px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.partner .slot-label { left: 15px; }
.local .slot-label { right: 15px; }

/* --- Bottom Panel --- */
.bottom-panel {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 0 20px;
  height: 140px; /* Compact height */
  display: flex;
  align-items: center;
  z-index: 100;
}

.panel-inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 450px 1fr 120px;
  gap: 30px;
  align-items: center;
}

/* --- Controls Section --- */
.controls-section {
  display: flex;
  align-items: center;
  gap: 24px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group .label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toggle-group {
  display: flex;
  background: var(--panel);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.toggle-btn {
  border: none;
  background: transparent;
  width: 40px;
  height: 36px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 22px;
}

.toggle-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(61, 138, 255, 0.3);
}

.toggle-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.action-buttons {
  display: flex;
  gap: 12px;
  margin-left: 10px;
}

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 0 24px;
  height: 48px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-main { background: var(--primary); color: white; }
.btn-next { background: var(--next); color: white; }
.btn-stop { background: var(--stop); color: white; }

.btn:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Chat Section --- */
.chat-section {
  display: flex;
  flex-direction: column;
  height: 100px;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg { line-height: 1.4; word-break: break-word; }
.msg.me { color: var(--primary); font-weight: 500; }
.msg.stranger { color: var(--text); }
.msg.system { color: var(--muted); font-size: 0.8rem; font-style: italic; }

.input-row {
  display: flex;
  padding: 6px 10px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  gap: 8px;
}

.input-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.btn-send {
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
}
.btn-send svg { width: 18px; height: 18px; }

/* --- Top Actions (Dark Mode, etc) --- */
.top-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.icon-toggle {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-toggle svg { width: 20px; height: 20px; }

.status-marker {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

/* --- Mobile Menu Button --- */
.menu-btn {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.menu-btn svg { width: 24px; height: 24px; }

/* --- Mobile Fixes --- */
@media (max-width: 900px) {
  .video-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    height: calc(100vh - 160px);
  }
  
  .camera-slot {
    height: 100%;
  }

  .camera-slot.local { border-top: 1px solid var(--line); }

  .bottom-panel {
    height: 120px;
    padding: 10px;
  }
  
  .panel-inner {
    grid-template-columns: auto 1fr;
    gap: 15px;
  }
  
  .menu-btn { display: flex; }

  .controls-section {
    position: fixed;
    bottom: 140px;
    left: 20px;
    right: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
    transform: translateY(200%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
  }
  
  .controls-section.active {
    transform: translateY(0);
  }
  
  .action-buttons {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }

  .chat-section {
    height: 80px;
  }
  
  .top-actions {
    display: none; /* Move theme toggle or hide on mob */
  }
}

