:root {
  --accent-color: #cc0000;
  --button-padding: 10px 15px;
  --button-font-size: 16px;
  --transition-duration: 0.3s;
  --text-color: #333;
}

/* The main container is 100% width, with no background color. */
#meetgle-container {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 10px 0; /* top/bottom padding only */
  background-color: transparent; /* so you can style it externally */
}

#meetgle-container h3 {
  margin-bottom: 20px;
}

/* 
   Use CSS Grid to place two videos side by side on wider screens, 
   with a 10px gap in between. 
*/
.video-container {
  display: grid;
  width: 100%;
  margin: 0;
  padding: 0;
  grid-template-columns: 1fr 1fr; /* two equal columns */
  gap: 10px;                     /* space between columns */
}

/* Each video is in a 4:3 box via the "padding-top" trick */
.video-wrapper {
  position: relative;
  width: 100%;
  background-color: #000; /* black background for letterboxing */
  overflow: hidden;
}

/* Force a 4:3 ratio by padding-top: 75% (3/4 = 0.75) */
.video-wrapper::before {
  content: "";
  display: block;
  padding-top: 75%;
}

/* Absolutely position the <video> to fill the .video-wrapper */
.video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Fill the container, cropping if needed */
  background-color: #000;
}

/* Position the logo in the bottom-right corner of the video */
.video-logo {
  position: absolute;
  bottom: 10px; /* Adjust the distance from the bottom */
  right: 10px; /* Adjust the distance from the right */
  width: 100px; /* Adjust the size of the logo */
  height: auto; /* Maintain aspect ratio */
  z-index: 10; /* Ensure it appears above the video */
  pointer-events: none; /* Prevent the logo from interfering with clicks on the video */
}

/* On smaller screens, switch to one column (videos stacked) */
@media (max-width: 600px) {
  .video-container {
    grid-template-columns: 1fr; /* single column */
  }
}

/* Control container: buttons centered below the videos */
.control-container {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  flex-wrap: wrap;
  margin: 10px 10px 0px 10px;
}

/* Updated button styling */
.control-container button {
  flex: 1;
  padding: 10px;
  font-size: 14px;
  background-color: var(--button-color);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  text-align: center;
}

.control-container button:hover,
.control-container button:focus {
  background-color: var(--button-hover-color);
}

.control-container button:active {
  background-color: var(--button-active-color);
}

/* 80/20 split for chatActionBtn and stopChatBtn */
#chatActionBtn {
  flex: 8;
}
#stopChatBtn {
  flex: 2;
}

/* Style for the Mute and Switch Camera buttons */
#muteBtn, #switchCameraBtn {
    font-size: 14px;
    color: #000;
    background-color: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#muteBtn:hover, #switchCameraBtn:hover {
    background-color: rgba(200, 200, 200, 0.9);
}

/* Example for the "muted" class if you want a distinct style, 
   but you can remove or tweak if desired */
#muteBtn.muted {
  background-color: #6c757d; /* grayish background if muted */
  color: #fff;
}

/* Status output styling */
#statusOutput {
  font-size: 16px; /* Ensure the text is readable */
  color: #333; /* Set a visible text color */
  margin-top: 10px; /* Add spacing above the element */
  text-align: center; /* Center the text */
  background-color: #f9f9f9; /* Add a subtle background for visibility */
  padding: 5px; /* Add padding for better readability */
  border: 1px solid #ccc; /* Optional: Add a border for emphasis */
  border-radius: 4px; /* Optional: Add rounded corners */
}

/* General Layout */
#meetgle-video-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    box-sizing: border-box;
}

.video-chat-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
}

.video-section {
    flex: 0 1 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    height: 100%;
}

.video-wrapper.remote-video {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 0;
    margin-bottom: 0 !important; /* Explicitly remove bottom margin */
}

.controls-and-chat {
    flex: 0 1 50%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.video-wrapper.local-video {
    flex: 2 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 66.66%;
    min-height: 0;
}

.text-chat {
    flex: 1 1 0;
    height: 33.33%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Responsive: stack on mobile */
@media (max-width: 900px) {
  .video-chat-layout {
    flex-direction: column;
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
  }
  .video-section,
  .controls-and-chat {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    flex: unset !important;
    padding: 0 !important;
  }
  .video-wrapper.remote-video,
  .video-wrapper.local-video {
    height: 45vh !important;
    min-height: 0 !important;
    max-height: 45vh !important;
    aspect-ratio: unset !important;
    flex: unset !important;
  }
  .controls-and-chat {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex-direction: column;
    flex: unset !important;
  }
  .text-chat {
    height: calc(100vh - 50vh) !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: unset !important;
    aspect-ratio: unset !important;
    overflow-y: auto !important;
  }
  .video-wrapper::before {
    display: none !important;
  }
  .remote-video video,
  .local-video video {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
  }
}

.video-wrapper {
    position: relative;
    background-color: #000;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.remote-video video, .local-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remote-video video {
    background-color: #171717;
}

.local-video video {
    background-color: #000;
    transform: none;
}

.controls-and-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    /* gap: 15px; */ 
}

.text-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    background-color: #23272A;
}

.messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    background-color: #23272A;
    color: #fff !important;
    font-size: 14px;
    line-height: 1.4;
}

.input-container {
    display: flex;
    padding: 10px;
    background-color: #23272A;
    border-top: 0px solid #ccc;
    margin-bottom: 10px; /* Add space below input */
}

#chatInput {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-right: 10px;
    font-size: 16px;
}

#sendMessageBtn {
    padding: 8px 15px;
    background-color: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
}

#sendMessageBtn:hover {
    background-color: #171717;
}

/* Mute and Switch Camera Buttons Overlay */
.local-video .overlay-buttons {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.overlay-buttons button {
    padding: 5px 10px;
    font-size: 12px;
    background-color: rgba(255, 255, 255, 0.8);
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.overlay-buttons button:hover {
    background-color: rgba(200, 200, 200, 0.9);
}

/* Status Output Styling */
#statusOutput {
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
    text-align: center;
}

/* Hide video controls */
video {
    pointer-events: none; /* Prevent interaction with the video */
}

video::-webkit-media-controls {
    display: none !important; /* Hide controls in WebKit browsers */
}

video::-moz-media-controls {
    display: none !important; /* Hide controls in Firefox */
}

video::-ms-media-controls {
    display: none !important; /* Hide controls in Edge/IE */
}

video::-o-media-controls {
    display: none !important; /* Hide controls in older browsers */
}

/* Responsive Design for Mobile */
@media (max-width: 768px) {
    #meetgle-container, #meetgle-video-container {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    .video-chat-layout {
        flex-direction: column;
    }

    .video-section, .controls-and-chat {
        height: auto;
        min-height: 0;
    }
}

html, body {
  width: 100vw;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-y: auto; /* Allow vertical scroll on mobile */
  overflow-x: hidden;
  box-sizing: border-box;
}

#meetgle-container, #meetgle-video-container {
  width: 100vw;
  min-height: 100vh;
  min-width: 100vw;
  max-width: 100vw;
  /* Remove height and max-height to allow content to grow */
  overflow: visible; /* Allow overflow to be visible and scrollable */
  display: flex;
  flex-direction: row;
  box-sizing: border-box;
}

/* --- COLUMN WIDTH FIX: 50/50 --- */
.video-section {
  flex: 0 1 50%;
  min-width: 0;
  max-width: 50vw;
}
.controls-and-chat {
  flex: 0 1 50%;
  min-width: 320px;
  max-width: 50vw;
  box-sizing: border-box;
  background-color: #23272A;
}

/* Remove border radius from video wrappers and text chat */
.video-wrapper,
.video-wrapper.remote-video,
.video-wrapper.local-video,
.text-chat {
  border-radius: 0 !important;
}

/* Set remote video background for clarity */
.video-wrapper.remote-video {
  background-color: #171717 !important;
}

/* === INTEREST DROPDOWN MATCH STATUSOUTPUT START === */
.interest-tags-container select {
  width: 100%;
  font-size: 14px;
  color: #333;
  background-color: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px;
  margin-top: 8px;
  box-sizing: border-box;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
/* === INTEREST DROPDOWN MATCH STATUSOUTPUT END === */

@media (min-width: 901px) {
  #meetgle-video-container,
  .video-chat-layout {
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
  }
}

/* Remote video loading spinner overlay */
.remote-loading-spinner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid var(--button-color, #EC4899);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Heart Animation Overlay */
.heart-anim-overlay {
  pointer-events: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 100;
  overflow: visible;
}

.heart-emoji {
  position: absolute;
  left: 50%;
  font-size: 2.5rem;
  opacity: 0.85;
  transform: translateX(-50%) scale(1);
  animation: heart-float 1.2s cubic-bezier(0.4,0,0.2,1) forwards;
  pointer-events: none;
}

@keyframes heart-float {
  0% {
    top: 10%;
    opacity: 0.9;
    transform: translateX(-50%) scale(1.2);
  }
  60% {
    opacity: 1;
    transform: translateX(-50%) scale(1.1) rotate(-10deg);
  }
  80% {
    opacity: 0.8;
    transform: translateX(-50%) scale(1.05) rotate(10deg);
  }
  100% {
    top: 80%;
    opacity: 0;
    transform: translateX(-50%) scale(0.8) rotate(0deg);
  }
}

/* Heart Button Flutter Animation */
.heart-btn-anim-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 200;
}
.heart-btn-emoji {
  position: absolute;
  left: 50%;
  bottom: 8px;
  font-size: 1.7em;
  opacity: 0.9;
  transform: translateX(-50%) scale(1);
  animation: heart-btn-flutter 0.9s cubic-bezier(0.4,0,0.2,1) forwards;
  pointer-events: none;
}
@keyframes heart-btn-flutter {
  0% {
    bottom: 8px;
    opacity: 0.9;
    transform: translateX(-50%) scale(1.2);
  }
  60% {
    opacity: 1;
    transform: translateX(-50%) scale(1.1) rotate(-10deg);
  }
  80% {
    opacity: 0.8;
    transform: translateX(-50%) scale(1.05) rotate(10deg);
  }
  100% {
    bottom: 38px;
    opacity: 0;
    transform: translateX(-50%) scale(0.8) rotate(0deg);
  }
}

/* Heart/Flag Button Styling */
#heartBtn, #remoteFlag {
  border-radius: 50%;
  background: #fff;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  padding: 0;
  margin: 0 2px;
}
#heartBtn:active, #remoteFlag:active {
  background: #f3f3f3;
}

@media (max-width: 600px) {
  #heartBtn, #remoteFlag {
    font-size: 14px;
    width: 28px;
    height: 28px;
  }
}

#heartBtn {
  color: #e63946;
  cursor: pointer;
}
#remoteFlag {
  color: #222;
  cursor: default;
  text-align: center;
  line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
  overflow: hidden;
  vertical-align: middle;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px; /* Make flag a bit larger for better vertical centering */
  height: 36px;
  line-height: 36px;
}
@media (max-width: 600px) {
  #remoteFlag {
    font-size: 16px;
    height: 28px;
    line-height: 28px;
  }
}