/* ========================================
   STREAMONLINE CSS - VfL Oberjettingen
   Video Streaming & Chat Application
   ======================================== */

/* ===============================
   1. GLOBAL STYLES & LAYOUT
   =============================== */

/* Base body styling and overall layout structure */
body {
  margin: 0;
  background: #c8e0f4;
  color: #fff;
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px;
  box-sizing: border-box;
}

/* Main content container - shown after login */
.main-content {
  display: none; /* Initially hidden until after login */
  flex-direction: column;
  flex: 1; /* Nimmt den verfügbaren Platz im Body */
  margin-bottom: 10px;
  box-sizing: border-box;
}

/* Content wrapper for video and chat layout */
.content-wrapper {
  display: flex;
  gap: 20px;
  flex: 1; /* Nimmt den restlichen Platz nach dem Titel ein */
  align-items: stretch;
  min-height: 0; /* Ermöglicht Flexbox-Shrinking */
  height: auto;
}

/* ===============================
   2. HEADER & TITLE STYLING
   =============================== */

/* Page title container and heading styling */
.title-container {
  text-align: center;
  margin: 0px 0 5px 0;
  background: #1a237e;
  color: #f3f6fa;
  padding: 24px 0 18px 0;
  width: 100%;
}

.title-container h1 {
  font-size: 3em;
  color: #f3f6fa;
  font-weight: bold;
  margin: 0;
}

/* ===============================
   3. WELCOME PAGE STYLING
   =============================== */

/* Welcome page container - shown before login */
.welcome-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  position: relative;
  z-index: 1;
}

/* Specific styling for welcome page title container */
.welcome-container .title-container {
  margin-top: 0px;
  margin-bottom: 15px;
}

/* Welcome content wrapper */
.welcome-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100vw;
  max-height: 100vh;
  text-align: center;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

/* Logo styling on welcome page */
.welcome-logo {
  display: block;
  margin: auto;
  width: min(90vw, 90vh);
  height: min(90vw, 90vh);
  aspect-ratio: 1/1;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 2px 32px #90b4d6;
}

/* ===============================
   4. VIDEO PLAYER STYLING
   =============================== */

/* Video container - 75% of content width */
.left-container {
  flex: 0 1 75%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed #666;
  border-radius: 12px;
  min-width: 0;
  justify-content: flex-start;
  padding: 10px;
  box-sizing: border-box;
  position: relative;
  aspect-ratio: 16/9;
  height: auto;
  max-height: none;
}

/* Main video element styling */
video {
  width: 100%;
  max-width: 100%;
  border: 2px solid #ccc;
  border-radius: 12px;
  background-color: #222;
  display: block;
  margin-bottom: 0px;
  aspect-ratio: 16/9; /* Standard Video-Seitenverhältnis */
  object-fit: contain;
  height: 100%;
}

/* Stream message overlay - shown when video is offline */
#streamMessage {
  position: absolute; /* Position absolutely within left-container */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  font-size: 2em;
  font-weight: bold;
  color: #e74c3c; /* Red color for error message */
  text-align: center;
  /* Initially hidden */
  display: none;
  /* Vertical and horizontal centering when shown */
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.1); /* Match container background */
  border-radius: 12px; /* Match container border radius */
}

/* Show stream message with flexbox for centering */
#streamMessage.show {
  display: flex;
}

/* Hide video when message is shown */
#video.hidden {
  display: none;
}

/* ===============================
   5. CHAT INTERFACE STYLING
   =============================== */

/* Chat wrapper - 25% of content width */
#chat-wrapper {
  flex: 0 1 25%;
  display: flex;
  flex-direction: column;
  height: auto;
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed #666;
  border-radius: 12px;
  padding: 10px;
  box-sizing: border-box;
  overflow: hidden;
  max-height: none;
  min-height: 0;
}

/* Chat title styling */
#chat-wrapper h1 {
  margin: 0 0 10px 0;
  font-size: 1.2em;
  color: #1a237e;
}

/* Message list container */
#messages {
  flex: 1;
  overflow-y: auto;
  margin: 0 0 10px 0;
  padding: 8px;
  list-style: none;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  /*! height: 300px; */ /* Wichtig: ermöglicht flex-shrinking */
  min-height: 450px;
  max-height: 450px;
}

/* Individual message styling */
#messages li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    word-wrap: break-word; /* Lange Wörter umbrechen */
}

#messages li:last-child {
    border-bottom: none;
}

/* Username styling in messages */
#messages li b {
    color: #007bff; /* Farbe für Benutzernamen */
}

/* ===============================
   6. CHAT INPUT & FORM STYLING
   =============================== */

/* Chat form layout */
#chat-form {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}

/* Chat input field */
#chat-input {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  color: #000;
}

/* Chat input placeholder styling */
#chat-input::placeholder {
    color: #bbb;
}

/* Chat send button */
#chat-form button {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background: #2b3ee7;
  color: white;
  cursor: pointer;
}

/* Chat send button hover effect */
#chat-form button:hover {
    background-color: #0056b3;
}

/* ===============================
   7. USER LIST STYLING
   =============================== */

/* User list container */
#user-list-container {
  flex: 0 0 auto;
  max-height: 120px;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border-top: 1px solid #ccc;
  padding: 8px;
  color: #000;
}

/* User list title */
#user-list-container h3 {
  color: #1a237e;
  margin: 0 0 10px 0;
  padding: 0 2px;
  flex-shrink: 0;
}

/* User list styling */
#user-list-container ul {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  flex: 1;
}

/* Individual user item styling */
#user-list-container li {
  color: #000;
  background: rgba(255, 255, 255, 0.8);
  margin: 2px 8px;
  padding: 5px 10px;
  border-radius: 4px;
  font-weight: bold;
}

/* ===============================
   8. MODAL DIALOG STYLING
   =============================== */

/* Modal overlay background */
.modal {
    display: none; /* Hidden by default, wird per JS auf 'flex' gesetzt */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top, über allen anderen Inhalten */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
}

/* Modal content box */
.modal-content {
    background-color: #fefefe;
    padding: 20px; /* Reduziert von 30px auf 20px für kleineren Rand */
    border: 1px solid #888;
    width: 80%; /* Could be more specific, e.g., 400px */
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    text-align: center;
    color: #333; /* Textfarbe im Modal */
}

/* Modal title styling */
.modal-content h2 {
    color: #2b3ee7;
    margin-top: 0;
    margin-bottom: 30px;
}

/* Modal input fields */
.modal-content input {
    width: calc(80% - 20px); /* 20% schmaler als vorher (war 100%) */
    padding: 10px;
    margin-bottom: 25px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; /* Padding in die Breite einbeziehen */
}

/* Modal submit button */
.modal-content button {
    width: 70%; /* 30% schmaler als vorher (war 100%) */
    padding: 12px;
    background-color: #2b3ee7;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1em;
    margin-bottom: 25px;
}

/* Modal button hover effect */
.modal-content button:hover {
    background-color:#1328e4;
}

/* Modal error message styling */
#modalError {
    color: red;
    font-weight: bold;
    margin-top: 10px;
    display: none; /* Initially hidden */
}

#currentRoomDisplay {
  color: #1a237e;
  font-weight: 600;
}