﻿/* Glassmorphism Design - Frosted glass, transparency, blur effects */

* {
  box-sizing: border-box;
}

body {
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #111111;
  color: #e8eef2;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(15px);
}

.modal-content {
  background: #111111;
  backdrop-filter: blur(30px);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  width: 90%;
  max-width: 460px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  margin: 0 0 28px 0;
  color: #e8eef2;
  font-size: 26px;
  text-align: center;
  font-weight: 600;
}

.modal-content p {
  text-align: center;
  color: rgba(232, 238, 242, 0.7);
  font-size: 15px;
  margin: 0 0 14px 0;
  line-height: 1.6;
}

.close,
.close-welcome,
.close-admin,
.close-friends,
.close-dm,
.close-room-mgmt,
.close-channel-mgmt,
.close-invite,
.close-gif,
.close-emoji {
  color: rgba(232, 238, 242, 0.6);
  position: absolute;
  top: 36px;
  right: 36px;
  font-size: 32px;
  cursor: pointer;
  line-height: 20px;
  transition: all 0.3s;
}

.close:hover,
.close-welcome:hover,
.close-admin:hover,
.close-friends:hover,
.close-dm:hover,
.close-room-mgmt:hover,
.close-channel-mgmt:hover,
.close-invite:hover,
.close-gif:hover,
.close-emoji:hover {
  color: #e8eef2;
}

/* Fix close button positioning for flex-based modals */
.gif-modal .close-gif,
.emoji-modal .close-emoji {
  align-self: flex-end;
  margin-bottom: 10px;
}

.auth-error {
  background: rgba(231, 76, 60, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #ff6b6b;
  padding: 14px;
  border-radius: 16px;
  margin-bottom: 18px;
  display: none;
  font-size: 13px;
}

.auth-error.show {
  display: block;
}

#loginForm input,
#registerForm input {
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: #e8eef2;
  font-size: 14px;
  transition: all 0.3s;
}

#loginForm input:focus,
#registerForm input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.1);
}

#loginForm button,
#registerForm button {
  width: 100%;
  padding: 14px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  color: #e8eef2;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  text-align: center;
}

#loginForm button:hover,
#registerForm button:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  color: rgba(232, 238, 242, 0.7);
  font-size: 14px;
}

.auth-switch a {
  color: #7fb3d5;
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.password-requirements {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.password-requirements small {
  color: rgba(232, 238, 242, 0.6);
  font-size: 12px;
}

.password-requirements ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
  color: rgba(232, 238, 242, 0.7);
  font-size: 12px;
}

.password-requirements li {
  margin: 5px 0;
}

.admin-modal,
.friends-modal,
.dm-modal {
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
}

.admin-tabs,
.friends-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 16px;
}

.admin-tab,
.friends-tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: rgba(232, 238, 242, 0.7);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
}

.admin-tab.active,
.friends-tab.active {
  color: #e8eef2;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.admin-room-card,
.admin-user-card,
.friend-card,
.friend-request-card,
.user-search-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  padding: 18px;
  margin-bottom: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s;
}

.admin-room-card:hover,
.friend-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.admin-room-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.admin-room-title {
  font-size: 16px;
  color: #e8eef2;
  font-weight: 600;
}

.admin-room-stats {
  font-size: 13px;
  color: rgba(232, 238, 242, 0.6);
  margin-bottom: 12px;
}

.admin-room-actions {
  display: flex;
  gap: 8px;
}

.admin-btn-small,
.friend-btn,
.request-btn,
.user-btn {
  padding: 8px 16px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: #e8eef2;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
}

.admin-btn-small:hover,
.friend-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.admin-btn-danger,
.friend-btn-danger,
.request-btn-decline {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
  color: #ff6b6b;
}

.admin-btn-danger:hover,
.friend-btn-danger:hover,
.request-btn-decline:hover {
  background: rgba(231, 76, 60, 0.25);
}

.main-container {
  flex: 1;
  display: flex;
  gap: 0;
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  min-height: 0;
  overflow: hidden;
}

/* Left Sidebar - Rooms */
.rooms-sidebar {
  flex: 0 0 80px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 0 0;
  gap: 7px;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.room-icon {
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
  position: relative;
  flex-shrink: 0;
}

.room-icon span {
  font-size: 18px;
  font-weight: 600;
  color: #e8eef2;
}

.room-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 16px;
}

.room-icon.active {
  background: rgba(127, 179, 213, 0.3);
  border-color: #7fb3d5;
  border-radius: 16px;
}

.room-icon.home-icon {
  background: rgba(127, 179, 213, 0.2);
  border-color: rgba(127, 179, 213, 0.3);
}

.room-icon.home-icon:hover {
  background: rgba(127, 179, 213, 0.3);
}

.room-icon.home-icon.active {
  background: rgba(127, 179, 213, 0.4);
  border-color: #7fb3d5;
}

.room-icon.add-room {
  background: rgba(46, 204, 113, 0.2);
  border-color: rgba(46, 204, 113, 0.3);
}

.room-icon.add-room:hover {
  background: rgba(46, 204, 113, 0.3);
}

.room-icon.dm-icon {
  background: rgba(155, 89, 182, 0.2);
  border-color: rgba(155, 89, 182, 0.3);
}

.room-icon.dm-icon:hover {
  background: rgba(155, 89, 182, 0.3);
}

.room-icon.dm-icon span:first-child {
  font-size: 12px;
}

.room-icon.public-server-icon {
  background: rgba(52, 152, 219, 0.2);
  border-color: rgba(52, 152, 219, 0.3);
}

.room-icon.public-server-icon:hover {
  background: rgba(52, 152, 219, 0.3);
}

.room-icon.public-server-icon.active {
  background: rgba(52, 152, 219, 0.4);
  border-color: #3498db;
}

.icon-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: rgba(231, 76, 60, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* User Profile Section at Bottom of Sidebar */
.user-profile-section {
  margin-top: auto;
  width: 100%;
  padding: 12px 8px;
  background: rgba(0, 0, 0, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.user-profile-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.user-profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.user-avatar span {
  color: #e8eef2;
  font-weight: 600;
  font-size: 16px;
}

.user-profile-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

.user-profile-name {
  font-size: 11px;
  font-weight: 600;
  color: #e8eef2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.user-profile-status {
  font-size: 9px;
  color: rgba(46, 204, 113, 0.8);
}

.user-profile-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.admin-btn-sidebar {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #e8eef2;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.admin-btn-sidebar:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(127, 179, 213, 0.5);
  transform: translateY(-2px);
}

.logout-btn-sidebar {
  width: 100%;
  padding: 8px 12px;
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: 8px;
  color: #ff6b6b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.logout-btn-sidebar:hover {
  background: rgba(231, 76, 60, 0.25);
  border-color: rgba(231, 76, 60, 0.5);
  transform: translateY(-2px);
}

.user-action-btn .notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: rgba(231, 76, 60, 0.9);
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

#serversList {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  align-items: center;
}

.rooms-divider {
  width: 32px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 1px;
  margin: 4px 0;
  flex-shrink: 0;
}

/* Main sidebar container */
.channels-sidebar {
  flex: 0 0 240px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  padding: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: hidden;
  /* Sidebar content handles scroll */
}

.sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-right: 4px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
  color: rgba(232, 238, 242, 0.5);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color 0.2s;
}

.sidebar-section-header:hover {
  color: rgba(232, 238, 242, 0.8);
}

.section-count {
  margin-left: 6px;
  font-size: 10px;
  color: rgba(232, 238, 242, 0.4);
  font-weight: 600;
}

.sidebar-section-header .chevron {
  font-size: 9px;
  margin-right: 8px;
  transition: transform 0.2s;
  width: 10px;
  display: flex;
  justify-content: center;
}

.sidebar-section-header.collapsed .chevron {
  transform: rotate(-90deg);
}

.section-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-header.collapsed+.section-content {
  display: none;
}

/* Enhanced channel and DM item styles for sidebar */
.channel-item,
.dm-conversation-item-sidebar {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin: 1px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.channel-item:hover,
.dm-conversation-item-sidebar:hover {
  background: rgba(255, 255, 255, 0.08);
  /* Slightly more visible hover */
}

.channel-item.active,
.dm-conversation-item-sidebar.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-left: 3px solid #7fb3d5;
  /* Standard blue border */
  padding-left: 9px;
  /* Adjust for border */
}

/* Specific active color for Public Chat */
.channel-item.public-chat.active {
  border-left: 3px solid #3498db;
}

.dm-item-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
}

.dm-item-name {
  font-size: 14px;
  font-weight: 500;
  color: rgba(232, 238, 242, 0.9);
}

.dm-item-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
}

.dm-item-status.online {
  background: #7bc96f;
  box-shadow: 0 0 8px rgba(123, 201, 111, 0.5);
}

.dm-item-preview {
  font-size: 12px;
  color: rgba(232, 238, 242, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* Unnecessary specifics removed to keep it consistent */

.channel-item-left,
.dm-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.channel-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.channel-name,
.dm-name {
  font-size: 14px;
  color: #e8eef2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-item-right,
.dm-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #46d369;
  flex-shrink: 0;
}

.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(232, 238, 242, 0.3);
  flex-shrink: 0;
}

.unread-badge {
  background: rgba(231, 76, 60, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.add-channel-btn {
  flex-shrink: 0;
  margin: 8px 12px;
  padding: 10px 12px;
  background: rgba(46, 204, 113, 0.2);
  border: 1px solid rgba(46, 204, 113, 0.3);
  border-radius: 8px;
  color: #e8eef2;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.add-channel-btn:hover {
  background: rgba(46, 204, 113, 0.3);
  transform: translateY(-1px);
}

.add-channel-btn span:first-child {
  font-size: 18px;
}

/* Scrollbar for channels list */
.channels-list::-webkit-scrollbar {
  width: 6px;
}

.channels-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.channels-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.channels-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Channel Management Modal */
.channel-management-modal,
.invite-modal {
  max-width: 460px;
}

.channel-mgmt-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 16px;
}

.channel-tab {
  flex: 1;
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: rgba(232, 238, 242, 0.7);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
}

.channel-tab.active {
  color: #e8eef2;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.channel-tab-content h3 {
  font-size: 18px;
  margin: 0 0 12px 0;
  color: #7fb3d5;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .channels-sidebar {
    flex: 0 0 200px;
  }

  .channel-name,
  .dm-name {
    font-size: 13px;
  }
}

/* Main Chat Area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  min-width: 0;
  overflow: hidden;
}

.chat-header {
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(15px);
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-room-name {
  font-size: 16px;
  font-weight: 600;
  color: #e8eef2;
}

.chat-room-code {
  font-size: 13px;
  font-weight: 500;
  color: rgba(232, 238, 242, 0.35);
  letter-spacing: 0.02em;
}

.channel-member-count {
  font-size: 11px;
  color: rgba(232, 238, 242, 0.4);
  font-weight: 400;
  margin-top: 1px;
}

.channel-stats-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}

.channel-online-count {
  font-size: 11px;
  color: rgba(46, 204, 113, 0.85);
  font-weight: 500;
}

.chat-header-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.disconnect-btn {
  padding: 8px 16px;
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #ff6b6b;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s;
}

.disconnect-btn:hover {
  background: rgba(231, 76, 60, 0.25);
}

#statusContainer {
  background: rgba(127, 179, 213, 0.08);
  backdrop-filter: blur(10px);
  padding: 8px 20px;
  font-size: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(232, 238, 242, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.status-separator {
  color: rgba(232, 238, 242, 0.3);
}

#serverStatus,
#peersStatus {
  color: rgba(232, 238, 242, 0.7);
  font-size: 12px;
}

#chat {
  flex: 1;
  padding: 20px 20px 0 20px;
  overflow-y: auto;
  overflow-x: hidden;
  word-wrap: break-word;
}

#homeView {
  flex: 1;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.1);
}

.home-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #e8eef2;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.home-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(127, 179, 213, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.home-action-btn:active {
  transform: translateY(0);
}

#typingIndicator {
  min-height: 24px;
  padding: 0 20px 8px 20px;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-style: italic;
  color: rgba(232, 238, 242, 0.5);
  flex-shrink: 0;
}

.chat-controls {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.input-group {
  margin-bottom: 14px;
  flex-shrink: 0;
}

.input-group label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  color: rgba(232, 238, 242, 0.7);
  font-weight: 500;
}

.input-group .input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.input-group .input-row button {
  flex: 0 0 120px;
  height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #e8eef2;
  font-size: 14px;
  outline: none;
  transition: all 0.3s;
}

input[type="text"]:focus {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.1);
}

input[type="text"]::placeholder {
  color: rgba(232, 238, 242, 0.3);
}

button {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: #e8eef2;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

button:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.025);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

button:disabled {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
  color: rgba(232, 238, 242, 0.3);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.checkbox-group {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  cursor: pointer;
  accent-color: #7fb3d5;
  margin: 0;
}

.checkbox-group label {
  margin: 0;
  font-size: 13px;
  color: rgba(232, 238, 242, 0.7);
  cursor: pointer;
  line-height: 1;
  transform: translateY(-1px)
}

.help-text {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(232, 238, 242, 0.5);
  font-style: italic;
}

#chatWrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  min-height: 200px;
}

#chat {
  flex: 1;
  padding: 16px 16px 0 16px;
  overflow-y: auto;
  overflow-x: hidden;
  word-wrap: break-word;
}

#typingIndicator {
  min-height: 28px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-style: italic;
  color: rgba(232, 238, 242, 0.5);
  flex-shrink: 0;
}

.your-msg {
  color: #e8eef2;
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.6;
  word-wrap: break-word;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 0 8px;
  margin-left: -8px;
  margin-right: -8px;
  border-radius: 8px;
  transition: background 0.2s;
  position: relative;
}

.your-msg[data-message-id]:hover {
  background: rgba(255, 255, 255, 0.05);
}

.message-hover-menu {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  background: rgba(44, 44, 44, 0.95);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  will-change: transform;
}

.your-msg:hover .message-hover-menu {
  display: flex;
  gap: 4px;
  transform: translateY(-50%);
}

.message-action-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.message-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.message-action-btn.delete-btn:hover {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

.peer-msg {
  color: #e8eef2;
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.6;
  word-wrap: break-word;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.message-sender {
  font-weight: 600;
  color: #e8eef2;
  flex-shrink: 0;
}

.message-content {
  flex: 1;
}

.message-timestamp {
  font-size: 12px;
  line-height: 25.6px;
  /* Matches 16px * 1.6 line-height of text perfectly */
  color: rgba(232, 238, 242, 0.4);
  white-space: nowrap;
  font-weight: 500;
  text-transform: uppercase;
  flex-shrink: 0;
  text-align: right;
  min-width: 55px;
}

.system-msg {
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.6;
  word-wrap: break-word;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.system-msg .message-content {
  color: rgba(232, 238, 242, 0.5);
  font-style: italic;
}

.chat-controls {
  display: flex;
  gap: 10px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.upload-btn {
  padding: 12px 16px;
  font-size: 18px;
  min-width: auto;
}

.upload-btn:hover:not(:disabled) {
  transform: scale(1.1);
}

.media-message {
  margin: 6px 0 10px 0;
  /* 6px top margin aligns the top of the image directly with the cap-height of the text */
  max-width: 400px;
}

.media-message img {
  max-width: 100%;
  border-radius: 12px;
  display: block;
  cursor: pointer;
  transition: all 0.3s;
}

.media-message img:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.media-message video {
  max-width: 100%;
  border-radius: 12px;
  display: block;
}

.media-caption {
  font-size: 12px;
  color: rgba(232, 238, 242, 0.6);
  margin-top: 5px;
}

.upload-progress {
  background: rgba(127, 179, 213, 0.2);
  backdrop-filter: blur(10px);
  padding: 12px;
  border-radius: 12px;
  margin: 10px 0;
  font-size: 13px;
  color: #7fb3d5;
  border: 1px solid rgba(127, 179, 213, 0.3);
}

.userListPane {
  flex: 0 0 240px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  padding: 20px 16px;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s;
  position: relative;
}

.userListPane.hidden {
  flex: 0 0 40px;
  padding: 20px 0;
  overflow: hidden;
}

.userListPane.hidden .userListHeader {
  justify-content: center;
}

.userListPane.hidden h3,
.userListPane.hidden #userList {
  display: none;
}

.userListHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.userListPane h3 {
  margin: 0;
  font-size: 14px;
  color: rgba(232, 238, 242, 0.6);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px;
}

.toggle-arrow {
  background: transparent;
  border: none;
  color: rgba(232, 238, 242, 0.6);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  transition: all 0.2s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
  box-shadow: none;
  flex-shrink: 0;
}

.toggle-arrow:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(232, 238, 242, 0.9);
  transform: none;
  box-shadow: none;
}

.toggle-arrow span {
  transition: transform 0.3s;
  display: inline-block;
}

.userListPane.hidden .toggle-arrow span {
  transform: rotate(180deg);
}

#userList {
  list-style: none;
  padding: 0;
  margin: 0;
}

.user-list-section-header {
  margin: 16px 0 8px 10px !important;
  font-size: 11px !important;
  color: rgba(232, 238, 242, 0.4) !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

#userList li {
  padding: 8px 10px;
  margin-bottom: 2px;
  background: transparent;
  border-radius: 6px;
  font-size: 14px;
  color: rgba(232, 238, 242, 0.8);
  border: none;
  transition: all 0.2s;
}

#userList li:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: none;
}

.notification-badge,
.tab-badge {
  background: rgba(231, 76, 60, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #ff6b6b;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 12px;
  margin-left: 8px;
  font-weight: 600;
}

.saved-room-item {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.saved-room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.saved-room-name {
  font-size: 13px;
  color: #e8eef2;
  font-weight: 500;
}

.saved-room-count {
  font-size: 11px;
  color: rgba(232, 238, 242, 0.6);
}

.saved-room-actions {
  display: flex;
  gap: 8px;
}

.saved-room-btn {
  padding: 6px 14px;
  font-size: 11px;
  border-radius: 10px;
}

.saved-room-btn-join {
  background: rgba(255, 255, 255, 0.1);
  color: #e8eef2;
}

.saved-room-btn-join:hover {
  background: rgba(255, 255, 255, 0.15);
}

.saved-room-btn-delete {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
  color: #ff6b6b;
}

.saved-room-btn-delete:hover {
  background: rgba(231, 76, 60, 0.25);
}

.save-room-btn {
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 8px;
  border-radius: 7px;
}

.save-room-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Room Management Button and Modal */
.room-mgmt-btn {
  display: none;
  width: 100%;
  padding: 12px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e8eef2;
  font-weight: 500;
}

.room-mgmt-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.room-management-modal {
  max-width: 500px;
}

.room-mgmt-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.room-mgmt-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.room-mgmt-section h3 {
  font-size: 15px;
  margin: 0 0 12px 0;
  color: #7fb3d5;
  font-weight: 600;
}

.room-mgmt-section input {
  width: 100%;
  margin-bottom: 10px;
}

.room-mgmt-section .checkbox-group {
  margin-top: 10px;
  margin-bottom: 0;
}

/* Friends and Direct Messages */
.friend-item,
.request-item,
.user-result-item {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.friend-info,
.request-info,
.user-info {
  flex: 1;
}

.friend-name,
.request-name,
.user-name {
  font-size: 16px;
  color: #e8eef2;
  font-weight: 500;
  margin-bottom: 5px;
}

.dm-preview {
  font-size: 12px;
  color: rgba(232, 238, 242, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.friend-status,
.request-date,
.user-joined {
  font-size: 12px;
  color: rgba(232, 238, 242, 0.6);
}

.online-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7fb3d5;
  margin-right: 5px;
}

.offline-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(232, 238, 242, 0.3);
  margin-right: 5px;
}

.friend-actions,
.request-actions,
.user-actions {
  display: flex;
  gap: 8px;
}

.friend-btn-message {
  background: rgba(255, 255, 255, 0.1);
  color: #e8eef2;
}

.friend-btn-message:hover {
  background: rgba(255, 255, 255, 0.15);
}

.friend-btn-remove {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
  color: #ff6b6b;
}

.friend-btn-remove:hover {
  background: rgba(231, 76, 60, 0.25);
}

.request-btn-accept {
  background: rgba(127, 179, 213, 0.2);
  border-color: rgba(127, 179, 213, 0.3);
  color: #7fb3d5;
}

.request-btn-accept:hover {
  background: rgba(127, 179, 213, 0.3);
}

.user-btn-add {
  background: rgba(255, 255, 255, 0.1);
  color: #e8eef2;
}

.user-btn-add:hover {
  background: rgba(255, 255, 255, 0.15);
}

.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.search-box input {
  flex: 1;
}

.empty-state {
  text-align: center;
  color: rgba(232, 238, 242, 0.5);
  font-style: italic;
  padding: 40px 20px;
}

/* Direct Messages Styles */
.dm-container {
  display: flex;
  gap: 0;
  height: 540px;
}

.dm-sidebar {
  flex: 0 0 280px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(15px);
}

.dm-conversation-item {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.dm-conversation-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dm-conversation-item.active {
  background: rgba(127, 179, 213, 0.1);
  border-left: 3px solid #7fb3d5;
}

.dm-conv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.dm-conv-name {
  font-size: 14px;
  color: #e8eef2;
  font-weight: 500;
}

.dm-conv-time {
  font-size: 11px;
  color: rgba(232, 238, 242, 0.5);
}

.dm-conv-preview {
  font-size: 12px;
  color: rgba(232, 238, 242, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-unread-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(231, 76, 60, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #ff6b6b;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: bold;
}

.dm-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

#dmChatHeader {
  padding: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(15px);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#dmChatUsername {
  font-size: 16px;
  color: #e8eef2;
  font-weight: 600;
}

#dmOnlineStatus {
  font-size: 12px;
  color: rgba(232, 238, 242, 0.6);
}

#dmChatMessages {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  overflow-x: hidden;
}

.dm-message {
  margin-bottom: 14px;
  max-width: 70%;
  word-wrap: break-word;
}

.dm-message.sent {
  margin-left: auto;
  text-align: right;
}

.dm-message.received {
  margin-right: auto;
}

.dm-message-sent,
.dm-message-received {
  margin-bottom: 14px;
  max-width: 70%;
  word-wrap: break-word;
  display: flex;
  flex-direction: column;
}

.dm-message-sent {
  margin-left: auto;
  align-items: flex-end;
}

.dm-message-received {
  margin-right: auto;
  align-items: flex-start;
}

.dm-message-content {
  display: inline-block;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
}

.dm-message-sent .dm-message-content {
  background: rgba(127, 179, 213, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(127, 179, 213, 0.3);
  color: #e8eef2;
  border-bottom-right-radius: 4px;
}

.dm-message-received .dm-message-content {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e8eef2;
  border-bottom-left-radius: 4px;
}

.dm-message-time {
  font-size: 10px;
  color: rgba(232, 238, 242, 0.5);
  margin-top: 4px;
  display: block;
}

#dmTypingIndicator {
  min-height: 20px;
  padding: 0 18px;
  font-size: 12px;
  color: rgba(232, 238, 242, 0.5);
  font-style: italic;
}

.dm-input-area {
  display: flex;
  gap: 10px;
  padding: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(15px);
}

.dm-input-area input {
  flex: 1;
}

/* Scrollbar Styles */
#chat::-webkit-scrollbar,
#dmChatMessages::-webkit-scrollbar,
.dm-sidebar::-webkit-scrollbar {
  width: 8px;
}

#chat::-webkit-scrollbar-track,
#dmChatMessages::-webkit-scrollbar-track,
.dm-sidebar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

#chat::-webkit-scrollbar-thumb,
#dmChatMessages::-webkit-scrollbar-thumb,
.dm-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 10px;
}

#chat::-webkit-scrollbar-thumb:hover,
#dmChatMessages::-webkit-scrollbar-thumb:hover,
.dm-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Responsive Design */
@media (max-width: 768px) {
  .rooms-sidebar {
    flex: 0 0 60px;
  }

  .room-icon {
    width: 40px;
    height: 40px;
  }

  .room-icon span {
    font-size: 16px;
  }

  .userListPane {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
  }

  .userListPane.hidden {
    transform: translateX(100%);
  }
}

/* Small viewport scaling - Chromebooks and small screens */
@media (max-height: 700px) {
  body {
    font-size: 13px;
  }

  .main-container {
    padding: 12px;
    gap: 12px;
    height: calc(100vh - 50px);
  }

  .instructions,
  .chat-container,
  .userListPane {
    padding: 14px;
    border-radius: 14px;
  }

  .instructions h2 {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .info-box {
    margin-bottom: 16px;
    padding-bottom: 14px;
  }

  .info-box strong {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .info-box p,
  .info-box ol,
  .info-box ul {
    font-size: 12px;
  }

  #statusContainer {
    padding: 10px;
    margin-bottom: 12px;
    font-size: 12px;
  }

  .input-group {
    margin-bottom: 10px;
  }

  .input-group label {
    font-size: 12px;
    margin-bottom: 6px;
  }

  input[type="text"] {
    padding: 9px 12px;
    font-size: 13px;
  }

  button {
    padding: 9px 16px;
    font-size: 13px;
  }

  .input-group .input-row button {
    height: 36px;
    padding: 0 12px;
  }

  #chatWrapper {
    min-height: 150px;
  }

  #chat {
    padding: 12px;
  }

  .your-msg,
  .peer-msg {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .system-msg {
    font-size: 11px;
    margin-bottom: 8px;
  }

  .message-timestamp {
    font-size: 10px;
  }

  .chat-controls {
    padding: 10px;
    gap: 8px;
  }

  #typingIndicator {
    min-height: 22px;
    padding: 0 12px;
    font-size: 11px;
  }

  .userListPane h3 {
    font-size: 14px;
    margin-bottom: 14px;
  }

  #userList li {
    padding: 9px;
    margin-bottom: 6px;
    font-size: 12px;
  }

  .help-text {
    font-size: 11px;
    margin-top: 6px;
  }
}

/* Extra small viewports */
@media (max-height: 600px) {
  body {
    font-size: 11px;
  }

  .main-container {
    padding: 12px 20px;
    gap: 16px;
  }

  .instructions,
  .chat-container,
  .userListPane {
    padding: 12px;
    border-radius: 10px;
  }

  .instructions {
    flex: 0 0 240px;
  }

  .userListPane {
    flex: 0 0 180px;
  }

  .instructions h2 {
    font-size: 14px;
    margin-bottom: 10px;
  }

  .info-box {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .info-box strong {
    font-size: 11px;
    margin-bottom: 5px;
  }

  .info-box p,
  .info-box ol,
  .info-box ul {
    font-size: 10px;
    line-height: 1.4;
  }

  .info-box li {
    margin: 3px 0;
  }

  #statusContainer {
    padding: 6px;
    margin-bottom: 8px;
    font-size: 10px;
    border-radius: 10px;
  }

  #serverStatus,
  #peersStatus {
    font-size: 10px;
  }

  .input-group {
    margin-bottom: 6px;
  }

  .input-group label {
    font-size: 10px;
    margin-bottom: 4px;
  }

  input[type="text"] {
    padding: 6px 8px;
    font-size: 11px;
    border-radius: 8px;
  }

  button {
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 8px;
  }

  .input-group .input-row button {
    height: 28px;
    padding: 0 8px;
    flex: 0 0 90px;
  }

  #chatWrapper {
    min-height: 100px;
    border-radius: 12px;
  }

  #chat {
    padding: 8px;
  }

  .your-msg,
  .peer-msg {
    font-size: 11px;
    margin-bottom: 5px;
    gap: 6px;
  }

  .system-msg {
    font-size: 9px;
    margin-bottom: 5px;
  }

  .message-timestamp {
    font-size: 8px;
  }

  .chat-controls {
    padding: 8px;
    gap: 7px;
  }

  .chat-controls input[type="text"] {
    padding: 7px 10px;
    font-size: 12px;
  }

  .chat-controls button {
    padding: 7px 14px;
    font-size: 12px;
  }

  .upload-btn {
    padding: 7px 10px;
    font-size: 15px;
  }

  #typingIndicator {
    min-height: 16px;
    padding: 0 8px;
    font-size: 9px;
  }

  .userListPane h3 {
    font-size: 12px;
    margin-bottom: 8px;
  }

  #userList li {
    padding: 6px;
    margin-bottom: 4px;
    font-size: 10px;
    border-radius: 8px;
  }

  .help-text {
    font-size: 9px;
    margin-top: 3px;
  }

  .checkbox-group {
    margin-top: 5px;
    gap: 6px;
  }

  .checkbox-group label {
    font-size: 10px;
  }

  .saved-room-item {
    padding: 8px;
    margin-bottom: 6px;
    border-radius: 10px;
  }

  .saved-room-name {
    font-size: 10px;
  }

  .saved-room-count {
    font-size: 9px;
  }

  .saved-room-btn {
    padding: 4px 8px;
    font-size: 9px;
    border-radius: 6px;
  }

  .save-room-btn {
    padding: 4px 8px;
    font-size: 10px;
    margin-top: 6px;
  }

  .media-message {
    max-width: 250px;
  }

  .media-caption {
    font-size: 10px;
  }

  .admin-modal,
  .friends-modal,
  .dm-modal {
    max-height: 75vh;
    margin: 5% auto;
  }

  .dm-container {
    height: 400px;
  }

  .dm-sidebar {
    flex: 0 0 200px;
  }

  #dmChatHeader {
    padding: 10px;
  }

  #dmChatUsername {
    font-size: 13px;
  }

  #dmOnlineStatus {
    font-size: 10px;
  }

  #dmChatMessages {
    padding: 10px;
  }

  .dm-message-content {
    padding: 8px 12px;
    font-size: 12px;
  }

  .dm-message-time {
    font-size: 9px;
  }

  .dm-input-area {
    padding: 10px;
  }

  .dm-input-area input {
    padding: 6px 8px;
    font-size: 11px;
  }

  .dm-input-area button {
    padding: 6px 10px;
    font-size: 11px;
  }

  .dm-conversation-item {
    padding: 10px;
  }

  .dm-conv-name {
    font-size: 12px;
  }

  .dm-conv-time {
    font-size: 10px;
  }

  .dm-conv-preview {
    font-size: 11px;
  }

  #joinPublicGroup {
    margin-bottom: 6px;
  }

  #roomControls {
    display: none !important;
  }

  .room-management-modal {
    max-width: 500px;
  }

  .room-mgmt-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .room-mgmt-section:last-child {
    border-bottom: none;
  }

  .room-mgmt-section h3 {
    font-size: 13px;
    margin: 0 0 10px 0;
    color: #7fb3d5;
  }

  .room-mgmt-section input {
    width: 100%;
    margin-bottom: 8px;
  }

  .room-mgmt-section button {
    font-size: 12px;
  }
}


/* Discord-style Layout Responsive */
@media (max-height: 650px) {
  .rooms-sidebar {
    padding: 8px 0;
    gap: 6px;
  }

  .room-icon {
    width: 42px;
    height: 42px;
  }

  .room-icon span {
    font-size: 16px;
  }

  .chat-header {
    padding: 8px 16px;
  }

  .chat-room-name {
    font-size: 14px;
  }

  #statusContainer {
    padding: 6px 16px;
    font-size: 11px;
  }

  #chat {
    padding: 12px 16px;
  }

  .chat-controls {
    padding: 10px 16px;
    gap: 8px;
  }

  .chat-controls input[type="text"] {
    padding: 7px 10px;
    font-size: 12px;
  }

  .chat-controls button {
    padding: 7px 14px;
    font-size: 12px;
  }

  .upload-btn {
    padding: 7px 10px;
    font-size: 15px;
  }

  #typingIndicator {
    padding: 0 16px 6px 16px;
    min-height: 20px;
    font-size: 11px;
  }

  .userListPane {
    flex: 0 0 200px;
    padding: 16px 12px;
  }

  .userListPane h3 {
    font-size: 11px;
    margin-bottom: 12px;
  }

  #userList li {
    padding: 6px 8px;
    font-size: 13px;
  }

  .disconnect-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .icon-btn {
    padding: 6px 10px;
    font-size: 14px;
  }
}


/* Server Management Modal */
.server-management-modal,
.invite-modal {
  max-width: 460px;
}

.server-mgmt-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 12px;
}

.server-tab {
  flex: 1;
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(232, 238, 242, 0.7);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
}

.server-tab.active {
  color: #e8eef2;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.server-tab-content h3 {
  font-size: 18px;
  margin: 0 0 12px 0;
  color: #e8eef2;
  font-weight: 600;
}