/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #0a0a0a;
  color: #ffffff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Login Screen Styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
}

.login-box {
  background-color: #191919;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(17, 243, 36, 0.1);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  height: 60px;
  margin-bottom: 30px;
  max-width: 300px;
  width: 100%;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #cccccc;
  font-size: 14px;
  font-weight: bold;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #333;
  border-radius: 4px;
  background-color: #0a0a0a;
  color: #ffffff;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #00e676;
}

.error-message {
  background-color: #ff4444;
  color: white;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
  font-size: 14px;
}

.login-button {
  width: 100%;
  background-color: #00e676;
  border: none;
  color: #191919;
  padding: 14px 24px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  display: inline-block;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.login-button:hover {
  background-color: #00e676;
}

.login-button:disabled {
  background-color: #666;
  cursor: not-allowed;
}

/* Top Bar Styles */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background-color: #191919;
  border-bottom: 2px solid #00e676;
}

.header-logo {
  height: 40px;
  max-width: 250px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-button {
  background-color: transparent;
  border: 2px solid #00e676;
  color: #00e676;
  padding: 8px 20px;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s;
}

.session-button:hover {
  background-color: #00e676;
  color: #191919;
}

.session-button:disabled {
  background-color: #333;
  border-color: #333;
  color: #666;
  cursor: not-allowed;
}

.logout-button {
  background-color: transparent;
  border: 2px solid #00e676;
  color: #00e676;
  padding: 8px 20px;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s;
}

.logout-button:hover {
  background-color: #00e676;
  color: #191919;
}

/* Streaming Container Styles */
#streaming-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Streaming Container Styles */
.centered-container {
  margin: 0 auto;
  margin-top: 15px;
  width: 90%;
  max-width: 1920px;
}

.aspect-ratio-box {
  display: block;
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  /* Cap the box so the 16:9 video always fits inside the viewport,
     reserving space for the top bar and footer. */
  max-width: calc((100dvh - 100px) * 16 / 9);
  margin: 0 auto;
  background-color: #c0c0c0;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Fallback for browsers without dynamic viewport units */
@supports not (height: 100dvh) {
  .aspect-ratio-box {
    max-width: calc((100vh - 100px) * 16 / 9);
  }
}

.video {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  margin: auto;
  padding: 0px;
  object-fit: contain; /* Ensures 16:9 scaling */
}

.loading {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 50%;
  height: 50%;
  margin: auto;
  z-index: 1000;
}

button {
  background-color: #191919;
  border: none;
  color: #00e676;
  padding: 11px 24px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  display: inline-block;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s;
}

button:hover {
  background-color: #00e676;
  color: #191919;
}

button:disabled {
  background-color: #333;
  color: #666;
  cursor: not-allowed;
}

#mw-modal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0,0.4);
}

#mw-dialog {
  display: none;
  position: absolute;
  background-color: #000000cc;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  text-align: center;
  padding: 10px;
  width: 300px;
  height: 70px;
  top: calc(50% - 35px);
  left: calc(50% - 150px);
  z-index: 1002;
  border-radius: 8px;
}

/* Form Elements in Streaming View */
form {
  margin-top: 15px;
}

label {
  color: #cccccc;
  font-size: 14px;
}

textarea {
  background-color: #0a0a0a;
  color: #ffffff;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px;
  font-family: monospace;
  margin: 10px 0;
  max-width: 100%;
  box-sizing: border-box;
}

textarea:focus {
  outline: none;
  border-color: #00e676;
}

input[type="button"] {
  margin-top: 10px;
}

details {
  margin-top: 15px;
  padding: 15px;
  background-color: #191919;
  border-radius: 4px;
  color: #cccccc;
  font-size: 14px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 5px;
  background-color: #0a0a0a;
  color: #666;
  font-size: 12px;
  margin-top: auto;
  border-top: 1px solid #333;
}

.footer p {
  margin: 0;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  .top-bar {
    padding: 10px 15px;
  }

  .header-logo {
    height: 30px;
    max-width: 160px;
  }

  .logout-button {
    padding: 6px 12px;
    font-size: 11px;
  }

  .session-button {
    padding: 6px 12px;
    font-size: 11px;
  }

  .top-bar-actions {
    gap: 6px;
  }

  .centered-container {
    width: 100%;
    margin-top: 0;
  }

  .login-box {
    padding: 24px;
    margin: 16px;
  }

  /* Make the video as tall as it can be at 16:9; only the footer is
     reserved, so the user can scroll the top bar out of view to see
     more of the video. */
  .aspect-ratio-box {
    border-radius: 0;
    max-width: calc((100dvh - 30px) * 16 / 9);
  }

  @supports not (height: 100dvh) {
    .aspect-ratio-box {
      max-width: calc((100vh - 30px) * 16 / 9);
    }
  }

  textarea {
    width: 100%;
  }
}

/* Landscape mobile (short viewports): size the video to the full
   viewport height so it's as big as possible. The top bar is non-sticky
   so the user can scroll it out of view to reveal the entire video. */
@media (max-height: 500px) {
  .top-bar {
    padding: 8px 15px;
  }

  .header-logo {
    height: 28px;
    max-width: 150px;
  }

  .logout-button,
  .session-button {
    padding: 6px 12px;
    font-size: 11px;
  }

  .top-bar-actions {
    gap: 6px;
  }

  .centered-container {
    width: 100%;
    margin-top: 0;
  }

  .aspect-ratio-box {
    border-radius: 0;
    max-width: calc(100dvh * 16 / 9);
  }

  @supports not (height: 100dvh) {
    .aspect-ratio-box {
      max-width: calc(100vh * 16 / 9);
    }
  }
}
