/* === Global === */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 20px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #1e1e1e;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* === Headings === */
h1,
h2,
h3 {
  color: #ffffff;
  text-align: center;
  margin-bottom: 15px;
}

/* === Layout Containers === */
.container {
  width: 100%;
  max-width: 1200px;
  padding: 0 15px;
}

/* === Chat Room Layout === */
#page-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: 1200px;
  padding: 0 15px;
  margin-top: 20px;
  flex-wrap: nowrap;
  gap: 20px;
  height: 100%;
  flex: 1;
  height: calc(100vh - 100px);
}

#chat-center {
  flex: 1 1 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  max-height: 100%;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: center;  
}

.title-row img {
  height: 100px; 
  margin-right: 15px;
}


/* === Messages === */
#messages {
  background-color: #2e2e2e;
  border: 1px solid #444;
  padding: 15px;
  border-radius: 8px;
  width: 100%;
  height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  height: auto;
  max-height: calc(100vh - 205px);
}

#messages .message {
  line-height: 1.5em;
  padding: 12px 16px;
  word-wrap: break-word;
  background-color: #3d3d3d;
  color: #f0f0f0;
  border-radius: 16px;
  margin-bottom: 10px;
  max-width: 70%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#messages .my-message {
  align-self: flex-end;
  background-color: #18794e;
  text-align: right;
  color: #fff;
}

/* === Chat Input Form === */
#chat-form {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
}

#message-input {
  flex: 1;
  background-color: #1a1a1a;
  color: #ffffff;
  border: 1px solid #444;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

#message-input.inputfield {
  height: 42px;
  padding: 0 12px;
  /* horizontal padding only */
  line-height: 1;
}

button {
  height: 42px;
  padding: 0 16px;
  /* horizontal only */
  font-weight: bold;
  font-size: 14px;
  background-color: #39a0ff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

button:hover {
  background-color: #1e7cc9;
}

/* === User List Sidebar === */
#user-list-container {
  flex: 0 1 230px;
  min-width: 180px;
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 15px;
  height: fit-content;
}

#user-list-container h3 {
  margin-top: 0;
  font-size: 16px;
}

#user-list div {
  padding: 5px 0;
  color: #ccc;
  border-bottom: 1px solid #333;
}

/* === Shared Forms/Input Styles === */
input[type="text"],
input[type="password"] {
  background-color: #1a1a1a;
  color: #ffffff;
  border: 1px solid #444;
  padding: 10px;
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
}

/* === Index && Server List Styling === */
#info-text {
  max-width: 800px;
  text-align: center;
  font-size: 16px;
  padding: 0 15px;
  color: #ccc;
}

#login-container {
  padding: 25px 30px;
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  text-align: center;
  max-width: 400px;
  margin: 20px auto;
}

#chat-rooms {
  background-color: #2a2a2a;
  border: 1px solid #444;
  padding: 20px;
  border-radius: 8px;
  margin-top: 30px;
  width: 100%;
  max-width: 600px;
}

ul {
  list-style-type: none;
  padding-left: 0;
}

li {
  margin: 8px 0;
  color: #ccc;
}

/* Collapsible headers */
.collapsible {
  cursor: pointer;
  margin: 12px 0 8px;
}

.collapsible-content {
  margin-left: 15px;
}

/* === Buttons Index Page === */
#create-room-form,
#start-chat-button,
#create-room-btn {
  margin-top: 10px;
}

#create-room-btn,
#create-unlisted-room-btn {
  margin-top: 0;
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

/* === Links === */
a {
  color: #79c4ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:visited {
  color: #79c4ff;
}

#username-input,
#new-room-name,
#message-input,
#new-watchparty-name,
#video-url-input,
#broadcastInput {
  background-color: #ffffff;
  color: #444;
}

li a {
  display: block;
  text-align: center;
  color: #ffffff;
  text-decoration: underline;
}

.watchparty #video-chat-container {
  display: flex;
  flex-direction: row;
  gap: 20px;
  width: 100%;
  max-width: 2400px;
  margin-top: 20px;
}

.watchparty #video-section {
  flex: 2;
  max-width: 1200px;
}

.watchparty #chat-center {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 800px;
}

/* Ensure video controls look clean */
.watchparty #video-controls {
  margin-bottom: 15px;
  width: 100%;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.watchparty #video-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 1080px;
  border-radius: 8px;
  display: block;
  height: auto;
}

@media (max-width: 950px) {
  .watchparty #video-chat-container {
    flex-direction: column;
  }

  .watchparty #video-iframe {
    aspect-ratio: auto;
    /* Disable aspect ratio for small screens */
    height: 420px;
    /* Fixed height */
    max-height: none;
    /* Remove previous cap */
  }

  .watchparty #video-section,
  .watchparty #chat-center {
    max-width: 100%;
  }

  .watchparty #user-list-container {
    display: none;
  }

  .watchparty #room-title {
    display: none;
  }

  .watchparty body {
    padding: 10px;
    height: auto;
  }

  .watchparty #chat-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .watchparty #messages {
    max-height: calc(100vh - 550px);
    /* Adjust as needed */
    min-height: 150px;
    overflow-y: auto;
  }

  .watchparty #chat-form {
    margin-top: 10px;
  }
}

@media (max-width: 750px) {
  #user-list-container {
    display: none;
  }
}

