@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600&family=Montserrat:wght@400;600&display=swap');

:root {
  --primary: #002477;
  --primary-dark: #00074fac;
  --accent: #ab7b00;
  --accent-dark: #fb8500;
  --disconnect-red: #e63946;

  --bg: #f5f5f5;
  --panel-bg: #ffffff;
  --border: #ddd;
  --text: #222;
  --text-light: #fafafa;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --panel-bg: #1e1e2e;
    --border: #333;
    --text: #f5f5f5;
    --text-light: #fafafa;
  }
}

body {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.chat-wrapper {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ===== Left Panel ===== */
.left-panel {
  width: 260px;
  background: var(--primary-dark);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.brand .logo {
  width: 35px;
  height: 35px;
}

.brand h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
}

/* Join Box */
.join-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 30px;
}

.join-box input {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
}

.join-box button {
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: var(--text-light);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.join-box button:hover {
  background: var(--accent-dark);
}

/* Users Box */
.users-box {
  flex: 1;
  overflow-y: auto;
}

.users-box h3 {
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  padding-bottom: 5px;
}

.user-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.user-list li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  font-size: 14px;
}

/* ===== Right Panel ===== */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
}

/* Chat Header */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-bg);
}

.chat-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 1px;
  margin: 0;
}

.disconnect-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: var(--disconnect-red);
  color: var(--text-light);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.disconnect-btn:hover {
  background: #b22234;
}

/* Messages Area */
.messages-area {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.messages-area p {
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  max-width: 70%;
  font-size: 14px;
}

.messages-area .me {
  align-self: flex-end;
  background: var(--primary);
  color: var(--text-light);
}

.messages-area .other {
  align-self: flex-start;
  background: var(--accent);
  color: var(--text-light);
}

/* Message Bar */
.message-bar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--panel-bg);
}

.message-bar input {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  outline: none;
  font-size: 14px;
}

.message-bar button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: var(--text-light);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.message-bar button:hover {
  background: var(--primary-dark);
}

/* ================= RESPONSIVE DESIGN ================= */

/* Tablets (max-width: 992px) */
@media (max-width: 992px) {
  .chat-wrapper {
    flex-direction: column;
  }

  .left-panel {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    margin-bottom: 0;
  }

  .join-box {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
  }

  .join-box input {
    flex: 1;
  }

  .users-box {
    display: none; /* Hide users list on tablets for more space */
  }

  .right-panel {
    flex: 1;
    border-left: none;
  }
}

/* ===== Responsive Fixes =====*/

/* Mobile */
@media (max-width: 600px) {
  body {
    height: 100vh;
    overflow: hidden;
  }

  .chat-wrapper {
    height: 100%;
  }

  .right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .messages-area {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
  }

  /* Fix message bar at bottom */
  .message-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--panel-bg);
    padding: 8px;
    display: flex;
    gap: 6px;
    border-top: 1px solid var(--border);
  }

  .message-bar input {
    flex: 1;
    font-size: 14px;
    padding: 10px;
  }

  .message-bar button {
    padding: 10px 14px;
    font-size: 14px;
  }

  /* Compact buttons */
  .join-box button,
  .disconnect-btn {
    padding: 8px;
    font-size: 14px;
  }
}


/* Mobiles (max-width: 600px) */
@media (max-width: 600px) {
  body {
    align-items: flex-start;
    height: auto;
  }

  .chat-wrapper {
    flex-direction: column;
    height: 100vh;
  }

  .left-panel {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .brand h1 {
    font-size: 18px;
  }

  .join-box {
    width: 100%;
    flex-direction: column;
    margin-bottom: 15px;
  }

  .join-box input,
  .join-box button {
    width: 100%;
  }

  .chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .chat-title {
    font-size: 18px;
  }

  .disconnect-btn {
    width: 100%;
    text-align: center;
  }

  .messages-area {
    padding: 10px;
    gap: 6px;
  }

  .messages-area p {
    max-width: 85%;
    font-size: 13px;
  }

  .message-bar {
    flex-direction: column;
    gap: 6px;
  }

  .message-bar input,
  .message-bar button {
    width: 100%;
  }
}
