/* Global dark theme */
body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #0f172a;
  color: #f8fafc;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 90%;
  max-width: 600px;
  margin: 20px auto;
}

h1 {
  text-align: center;
  margin-bottom: 20px;
}

/* Card styling for forms and landing pages */
.card {
  background-color: #1e293b;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  margin-bottom: 20px;
}

.card h2 {
  margin-top: 0;
}

form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-weight: bold;
}

input[type="text"],
input[type="password"] {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

button {
  padding: 10px 15px;
  background-color: #4f46e5;
  border: none;
  color: #f8fafc;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

button:hover {
  background-color: #4338ca;
}

hr {
  margin: 20px 0;
  border: none;
  border-top: 1px solid #eee;
}

/* Meeting styles */
#meeting-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Video container uses relative positioning so local video can be overlaid */
#videos {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  background-color: #000;
  position: relative;
  overflow: hidden;
}

/* Remote videos fill available space */
#videos video.remote {
  background: #000;
  margin: 4px;
  border-radius: 6px;
  flex: 1 1 auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: all 0.2s ease;
}

/* Local video appears as a small overlay in the corner */
#videos video.local {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 22%;
  height: 22%;
  background: #000;
  margin: 0;
  border-radius: 8px;
  border: 2px solid #4f46e5;
  object-fit: cover;
  z-index: 30;
  transition: all 0.2s ease;
}

#controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 10px;
  background-color: #1e293b;
  border-top: 1px solid #334155;
}

#chat-container {
  border-top: 1px solid #334155;
  padding: 10px;
  background-color: #1e293b;
  max-height: 200px;
  overflow-y: auto;
  color: #f8fafc;
}

#chat-messages {
  list-style: none;
  padding: 0;
  margin: 0;
}

#chat-messages li {
  margin-bottom: 5px;
  word-wrap: break-word;
}

#chat-input {
  display: flex;
  margin-top: 10px;
}

#chat-input input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px 0 0 4px;
}

#chat-input button {
  padding: 8px 12px;
  border-radius: 0 4px 4px 0;
  background-color: #28a745;
  border: none;
  color: #fff;
  cursor: pointer;
}

#chat-input button:hover {
  background-color: #218838;
}

/* Participants list */
#participants {
  padding: 10px;
  background-color: #1e293b;
  border-top: 1px solid #334155;
  max-height: 150px;
  overflow-y: auto;
  color: #f8fafc;
}

#participants h3 {
  margin-top: 0;
}

#participants ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#participants li {
  margin-bottom: 4px;
}

/* Lobby */
#lobby-message {
  text-align: center;
  padding: 20px;
  font-size: 18px;
}

/* Hide remote videos when another participant is pinned */
.hidden-remote {
  display: none !important;
}

/* Pinned remote video takes full space */
video.pinned.remote {
  flex-basis: 100% !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  z-index: 5;
}

/* Caption overlay styling */
#caption-container {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #f8fafc;
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 40;
  max-width: 90%;
  text-align: center;
  font-size: 14px;
  display: none;
}

/* Style device selector dropdowns */
select {
  background-color: #334155;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 6px;
  font-size: 14px;
  cursor: pointer;
}

select option {
  background-color: #334155;
  color: #f8fafc;
}