html,body {
  height:100%;
}

:root {
  --primary-color: #f44336;          /* default fallback */
  --primary-color-dark: #d32f2f;
  --primary-color-darker: #c62828;
  --primary-color-light: #ffebee;
}

body {
  font-family: Arial, sans-serif;
  background: white;
  margin: 20px;
  min-height: 100vh;
}

/* ---------------------------username section---------------------------- */

#username {
  padding: 6px;
  width: 200px;
  box-sizing: border-box;
  border: 2px solid var(--primary-color);
  border-radius: 6px;
  background: white;
}

.username-section {
  margin-bottom: 25px;
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-color-light) 100%);
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.4);
  border-left: 4px solid var(--primary-color);
}

#host-recording-controls {
    position: absolute;
    top: 20px;
    right: 20px;

    display: flex;
    gap: 15px;
}

#host-recording-controls button {
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;

    font-weight: 600;
    font-size: 14px;
    background-color: var(--primary-color);
    color: white;
}

#host-recording-controls button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.recording-popup-btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    background-color: var(--primary-color);
    color: white;
}

#org-logo {
  display: block;
  margin: 0 auto 8px auto;
}

#org-name {
  text-align: center;
}

/* ------------------------------- room controls---------------------------------- */

#room-controls {
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-color-light) 100%);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.4);
  border-left: 4px solid var(--primary-color);
}

#room-controls input {
  padding: 6px;
  border: 2px solid var(--primary-color);
  border-radius: 6px;
  background: white;
}

#room-controls input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* ---------------------------------- main layout---------------------------- */

.main-grid-container {
  display: grid;
  grid-template-columns: 2.5fr 1fr;
  gap: 20px;
  height: calc(100vh - 160px); 
}


/* -------------------------------- video section------------------------------- */

#video-container {
  padding: 15px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-color-light) 100%);
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.4);
  border-left: 4px solid var(--primary-color);
}

#video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

#video-grid > * {
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

#video-grid video {
  object-fit: cover;
}


#video-grid div div {
  font-size: 14px !important;
}


/* --------------------------------- all videos inside grid--------------------------- */

#video-grid video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: black;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* ------------------------remote videos behave as grid children------------------------- */

#remote-videos {
  display: contents;
}

/* -------------------------------------- screen share video--------------------------------- */

#screen-video {
  width: 100% !important;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: black;
  display: block;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* -------------------------------local video when sharing screen ----------------------------- */

#local-video.small {
  width: 180px;
  height: 130px;
  border: 2px solid white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.4);
}


/* ------------------------------------- video controls--------------------------------------- */

#video-controls {
  margin-top: 25px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* --------------------------------------chat section ------------------------------------- */

#chat {
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-color-light) 100%);
  padding: 15px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.4);
  border-left: 4px solid var(--primary-color);
}

#messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 10px;
  min-height: 0;
  background: linear-gradient(to bottom, #fafafa 0%, #ffffff 100%);
  padding: 10px;
  border-radius: 8px;
}

#message-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
}

#message-list li[data-sender="me"] {
  align-items: flex-end;
}

#message-list li[data-sender="other"] {
  align-items: flex-start;
}

#message-list li .message-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 70%;
  word-wrap: break-word;
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.3);
}

#message-list li[data-sender="me"] .message-bubble {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-dark) 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

#message-list li[data-sender="other"] .message-bubble {
  background: linear-gradient(135deg, var(--primary-color-light) 0%, var(--primary-color-light) 100%);
  color: var(--primary-color-darker);
  border-bottom-left-radius: 4px;
}

/* ------------------------------------- chat input---------------------------------- */

#chat-controls {
  display: flex;
  gap: 10px;
}

#chat-controls input {
  border: 2px solid var(--primary-color-light);
  border-radius: 20px;
  padding: 10px 15px;
  background: white;
}

#chat-controls input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* ------------------------------------------ buttons ------------------------------------- */

button {
  padding: 8px 12px;
  border: none;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-dark) 100%);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

button:hover {
  background: linear-gradient(135deg, var(--primary-color-dark) 0%, var(--primary-color-darker) 100%);
  box-shadow: 0 5px 12px rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

#btn-send-msg {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-dark) 100%);
  border-radius: 20px;
  padding: 10px 20px;
}

#btn-send-msg:hover {
  background: linear-gradient(135deg, var(--primary-color-dark) 0%, var(--primary-color-darker) 100%);
}

#current-room {
  display:none;
  color: rgb(0, 83, 128);
  font-weight: bold;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  padding: 6px 12px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.3);
}


#message-list li {
  display: flex;
  flex-direction: row;
  align-items: flex-start;;  
  gap: 6px;
  margin-bottom: 8px;
}


#message-list li .message-sender {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  padding: 10px 0; 
  white-space: nowrap;
  line-height: 1.4;
}

#message-list li .message-sender::after {
  content: ":";
}

/* ------------------------------------- Message bubble------------------------------------ */

#message-list li .message-bubble {
  margin: 0;
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 70%;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.3);
  font-size: 16px;
  line-height: 1.4;
}

/* --------------------------------- My messages - RIGHT side-------------------------------- */

#message-list li[data-sender="me"] {
  justify-content: flex-end;
}

#message-list li[data-sender="me"] .message-sender {
  order: 1;
}

#message-list li[data-sender="me"] .message-bubble {
  order: 2;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-dark) 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

/* --------------------------------Other's messages - LEFT side-------------------------------- */

#message-list li[data-sender="other"] {
  justify-content: flex-start;
}

#message-list li[data-sender="other"] .message-bubble {
  background: linear-gradient(135deg, var(--primary-color-light) 0%, var(--primary-color-light) 100%);
  color: var(--primary-color-darker);
  border-bottom-left-radius: 4px;
}