/* this file is loaded by index.html and styles the page */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
}

/* --- STYLES FOR THE INITIAL VIEW --- */

h1 {
  font-style: italic;
  color: #373fff;
  max-width: calc(100% - 5rem);
  line-height: 1.1;
}

.video-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: left; /* instead of space-between */
  gap: 0px;  /* fix this — '100' with no unit is invalid */
  height: 100%;
  width: 100%;
}

.video-wrapper {
  display: flex;
  justify-content: center;  
  align-items: center;
}

.robot-video-wrapper {
  display: flex;
  align-items: flex-start;
  width: 50%;
  height: 100%;
}

.robot-video-wrapper #local-video-container {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* General style for the local webcam video */
video {
    background-color: #000;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 100%; /* Constrain the local webcam view */

}

.local-video{
  width: 65%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background-color: #bdbdbd;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-width: 100%;
}

.avatar-placeholder {
  width: 50%;
  object-fit: cover;
  background-color: #000;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#processed-robot-video-feed{
  /* width: 100%; */
  aspect-ratio: 1080 / 1920;
  height: 100%;
}

.controls, .connection-info, .logs {
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
}

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

.controls button {
    background-color: #007bff;
    color: white;
    cursor: pointer;
}

.controls button:hover {
    background-color: #0056b3;
}

.messages {
    max-height: 150px;
    overflow-y: auto;
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 0.9em;
    margin-top: 0;
}

.messages div {
    padding: 2px 0;
    border-bottom: 1px solid #eee;
}

.messages div:last-child {
    border-bottom: none;
}

.hidden {
    display: none;
}

.container {
  width: 100%;
  height: 100%;        /* Fill entire iframe */
  box-sizing: border-box;
  border: 2px solid black;  /* for visual debugging */
  display: flex;
  flex-direction: column;
}

#local-user-pane{
  width: 50%;
  height: 100%;
  display:flex;
  justify-content: flex-start;
  border-radius: 4px;
  border: 2px solid rgb(210, 210, 210);
  flex-direction: column;
}

#local-video-container{
  width: 80%;
  height: 100%;
  margin-top: 2%;
  padding-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#remote-video-container{
  width: 50%;
  height: 100%;
  justify-content: center;
  border: 2px solid rgb(211, 211, 211);
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 20px;
}

.robot-picture {
  width: 300px;
  height: auto;
  /* border-radius: 10px; */
  /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
  flex-shrink: 0;
}
/* --- STYLES FOR FILLING THE BROWSER WINDOW --- */

/* When the body has the 'fullscreen-view' class, these styles activate */
body.fullscreen-view {
  /* Remove all margin and set a black background for letterboxing */
  margin: -10px;
  background-color: #000;
}

/* Hide the non-video elements when in the expanded view */
body.fullscreen-view h1,
body.fullscreen-view .logs,
body.fullscreen-view #connection-setup {
  display: none;
}

/* Style the remote video specifically to fill the window */
body.fullscreen-view #processed-robot-video-feed {
  width: 100%;   /* 100% of the window's width */
  height: 100%;  /* 100% of the window's height */
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
  /* Ensures the entire video is visible, letterboxed if necessary */
  object-fit: contain;
  /* Override the max-width from the general video style */
  max-width: 100%;
}

.image-button {
  background-color: transparent; /* Remove any background color */
  background-size: cover; /* Ensure the image covers the entire button */
  background-repeat: no-repeat; /* Prevent the image from repeating */
  background-position: center; /* Center the image within the button */
  border: none; /* Remove the default button border */
  outline: none; /* Remove the outline when the button is focused */
}

.btn-yx:hover{
  opacity: 0.5;
}

.btn-float {
  position: fixed;
  bottom: 20px; /* Distance from the bottom of the screen */
  left: 40px;   /* Distance from the left side of the screen */
  padding: 10px 20px;
  z-index: 20;
  background-color: rgb(195, 24, 40);
}

.btn-col {
    width: var(--button-size)
}
.btn-row { 
    width: calc(3 * var(--button-size)); /* creates center space */
    justify-content: space-between;      /* push buttons to either side */
}
.btn-col > *,  /* Using wildcards so any element will work, not only <button> */
.btn-row > * {
    font-size: var(--button-text);

    width: var(--button-size);
    aspect-ratio: 1; /* make it a square */
}

.btn{
  margin: 2px 2px;
}

.D-Pad {
    /* define variable sizes depending on current minimum viewport size */
    /* using linear equation y = mx + b for points (x1,y1) and (x2,y2) */
/*     --button-size: calc(20.834vmin + 1.25rem);  */
      --button-size: 50px; 
    /* (240,70)(1080,245) */
/*     --button-text: calc(0.556vmin + 0.625rem);  */
    /* (360,12)(1080, 16) */
}

.D-Pad, .D-Pad>* {
    /* Default Flexbox row containers */
    display: flex; justify-content: center; align-items: center;
}
.D-Pad, .btn-col {
    /* Flexbox column containers */
    flex-direction: column;
}

.controlPanel{
  position: relative;
  width: 100%;
  height: auto;
  justify-content: center;
  background: #ffffff;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 
              0 4px 16px rgba(0, 0, 0, 0.05);
  flex: 0 0 auto;
  display: flex;
  padding: 12px;
  margin: 5px 0;
  backdrop-filter: blur(10px);
  border: 5px solid rgba(188, 188, 188, 0.2);
}

.control-button-col {
  flex: 1; /* 1 part */
  background: #f8f9fa;
  border-radius: 12px;
  padding: 12px;
  margin-right: 15px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.control-speech-col {
  flex: 3; /* 3 parts */
  background: #f0fff4;
  border-radius: 12px;
  padding: 12px;
  gap: 10px; 
  align-items: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(40, 167, 69, 0.2);
}

.robot-speech-icon {
  width: 15%;
  height: auto;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  margin-bottom: 10px;
}

.robot-speech-text {
  display: inline-block;
  vertical-align: middle;
  font-family: 'Arial', sans-serif;
  font-weight: 600;
  color: #90b689;
}


.custom-button-row {
  /* flex: 3; */
  /* padding: 10px; */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.custom-button {
  padding: 5px 5px;
  background: #ffffff;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 300;
  font-size: 14px;
  color: #495057;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1),
              0 2px 4px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

/* Click effect using a temporary class */
.custom-button.clicked {
  background-color: rgb(120, 200, 255); /* Highlight color */
}

#customSpeechInput {
  width: 85%;
  padding: 12px 16px;
  height: 80px;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  resize: vertical;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  transition: all 0.3s ease;
  background: #ffffff;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  color: #495057;
}

#customSpeechInput::placeholder {
  color: #9ca3af;
  font-style: italic;
  opacity: 0.8;
}

/* Using flex for the parent div */
.control-speech-col > div:last-child {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

/* Style for the dropdown menu */
.custom-dropdown {
  width: 85%;
  padding: 8px 12px;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: #495057;
}

.custom-dropdown:hover {
  background: #f8f9fa;
  border-color: #6c757d;
}

/* Container for textarea and send button */
.textarea-send-container {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

/* Modern styling for D-Pad control buttons */
.control-button {
  background: #ffffff !important;
  border: 2px solid #e9ecef !important;
  border-radius: 8px !important;
  transition: all 0.3s ease !important;
  font-weight: 500 !important;
  color: #495057 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.control-button:hover {
  background: #f8f9fa !important;
  border-color: #007bff !important;
  color: #007bff !important;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2) !important;
}

.control-button:active {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important;
}

/* Stop button styling */
.stop-button-container {
  margin-top: 15px;
  display: flex;
  justify-content: center;
}

.stop-button {
  background: #fff5f5 !important;
  border: 2px solid #fc8181 !important;
  color: #c53030 !important;
  font-weight: 700 !important;
  font-size: 16px !important;
  padding: 12px 20px !important;
  border-radius: 10px !important;
  min-width: 100px !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
}

.stop-button:hover {
  background: #fed7d7 !important;
  border-color: #e53e3e !important;
  color: #e53e3e !important;
  box-shadow: 0 6px 20px rgba(229, 62, 62, 0.3) !important;
}

.stop-button:active {
  background: #fbb6b6 !important;
  box-shadow: 0 2px 8px rgba(229, 62, 62, 0.4) !important;
}

/* Directional graphics styling */
.direction-arrow {
  font-size: 24px;
  font-weight: bold;
  line-height: 1;
  margin-bottom: 4px;
  color: #495057;
  transition: all 0.3s ease;
}

.direction-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
  transition: all 0.3s ease;
}

.control-button:hover .direction-arrow {
  color: #007bff !important;
}

.control-button:hover .direction-label {
  color: #007bff !important;
}

/* Make D-Pad buttons more visual */
.control-button {
  background: #ffffff !important;
  border: 2px solid #e9ecef !important;
  border-radius: 12px !important;
  transition: all 0.3s ease !important;
  font-weight: 500 !important;
  color: #495057 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  padding: 12px 8px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 60px !important;
} 
.custom-button:active {
  background: #e9ecef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.custom-button:hover {
  background: #f8f9fa;
  border-color: #007bff;
  color: #007bff;
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.2),
              0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Camera Control Button Styling */
.camera-control-button {
  padding: 8px 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  font-size: 12px;
  color: #495057;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1),
              0 2px 4px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
  margin: 8px 0;
  min-width: 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.camera-control-button:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15),
              0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #777777;
}

.camera-control-button:active {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Camera button text styling */
.camera-button-text {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8),
              inset 0 -1px 2px rgba(0, 0, 0, 0.05);
}

.camera-control-button:hover .camera-button-text {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(40, 167, 69, 0.3);
  color: #28a745;
}

/* Camera ON state */
.camera-control-button.camera-on {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  border-color: #28a745;
  color: #ffffff;
}

.camera-control-button.camera-on .camera-button-text {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.camera-control-button.camera-on:hover {
  background: linear-gradient(135deg, #218838 0%, #1ea088 100%);
  border-color: #1e7e34;
}

.camera-control-button.camera-on:hover .camera-button-text {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Camera OFF state */
.camera-control-button.camera-off {
  background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
  border-color: #dc3545;
  color: #ffffff;
}

.camera-control-button.camera-off .camera-button-text {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.camera-control-button.camera-off:hover {
  background: linear-gradient(135deg, #c82333 0%, #c0392b 100%);
  border-color: #bd2130;
}

.camera-control-button.camera-off:hover .camera-button-text {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}


#audio-video-controllers{
  flex-direction: row;
}