body {
  background-color: #080808;
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  color: #d8ded3;
  font-size: 14px;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 1040px;
}

/* NAVBAR */
nav {
  border: solid 1px #323232;
  background: #212121;
  padding: 0;
  width: 100%;
  max-width: 1040px;
}

nav ul {
  display: flex;
  /* justify-content: space-between; /* Replaced with flex-start and gap */
  justify-content: flex-start; /* Align items to the start */
  gap: 5px; /* Add consistent spacing between items */
  align-items: center;
  padding: 0;
  margin: 0;
  list-style: none;
}

nav li {
  display: inline-block;
  white-space: nowrap;
}

nav > ul > li > a {
  display: block;
  padding: 4px 20px;
  color: #F0B43F;
  text-decoration: none;
  font-size: 14px;
  line-height: 18px;
}

nav > ul > li > a:hover {
  color: #E3E41F;
  background: #181818;
}

nav .right-nav {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding-right: 10px;
}

/* Player box in navbar */
.nav-player-name {
  background: #080808;
  border-top: solid 1px #080808;
  border-bottom: solid 1px #323232;
  border-left: solid 1px #080808;
  border-right: solid 1px #323232;
  color: white;
  padding: 2px 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-player-name .elo-display {
  color: #ffffff; /* Changed from #bb86fc */
  font-size: 12px;
  margin-left: 8px;
  padding: 2px 6px;
  background: rgba(0,0,0,0.3);
  border: 1px solid #363636;
  border-radius: 3px;
}

.nav-player-name img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border: 1px solid #323232;
}

.navbar-username-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
}

.navbar-username-link:hover {
  color: #E3E41F;
}

/* GRID */
.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 40px 40px;
  justify-content: center;
}

/* WINDOW */
.window {
  border: solid 1px #323232;
  background-color: #212121;
  padding: 10px;
  position: relative;
}

.window::before {
  content: attr(name);
  display: block;
  width: 100%;
  height: 18px;
  line-height: 18px;
  text-indent: 24px;
  background-image: url("steamico.png"), url("minimize.png"), url("close.png");
  background-repeat: no-repeat;
  background-position: top left, top right 20px, top right;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  color: white;
  font-weight: bold;
  margin-bottom: 15px;
}

/* PLAYER ROWS */
.player-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.player-row img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border: solid 2px #7b8484;
  margin-right: 8px;
}

.player-elo {
  background: #080808;
  border: 1px solid #323232;
  color: #d8ded3; /* Changed from #bb86fc to match player names */
  padding: 4px 6px; /* Reduced horizontal padding from 8px */
  font-size: 11px; /* Slightly smaller font */
  margin-left: 8px; /* Reduced spacing from name */
  min-width: 50px; /* Reduced from 60px */
  text-align: center;
  font-family: 'Verdana', sans-serif;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.player-name {
  flex-grow: 1;
  background: #080808;
  border-top: solid 1px #080808;
  border-bottom: solid 1px #323232;
  border-left: solid 1px #080808;
  border-right: solid 1px #323232;
  padding: 5px 8px;
}

.player-profile-link {
  color: #E3E41F;
  text-decoration: none;
  transition: color 0.2s;
}

.player-profile-link:hover {
  color: #FFFFFF;
  text-decoration: underline;
}

/* MAP VOTE BUTTONS */
.mapvotebutton,
#connectServerBtn {
  display: block;
  background-color: #212121;
  color: white;
  border-top: solid 1px #323232;
  border-bottom: solid 1px #080808;
  border-left: solid 1px #323232;
  border-right: solid 1px #080808;
  padding: 5px 15px;
  margin: 10px auto;
  cursor: pointer;
  min-width: 160px;
  text-align: center;
  font-family: inherit;
  font-size: 14px;
}

.mapvotebutton:hover,
#connectServerBtn:hover {
  background-color: #181818;
  color: #E3E41F;
}

/* Winner Map Style */
.mapvotebutton.winner-map {
  border: 1px solid #E3E41F;
  color: #E3E41F;
  background: #212121; /* Keep background dark */
  opacity: 1 !important;
  cursor: default;
  box-shadow: 0 0 8px rgba(227, 228, 31, 0.15);
  font-weight: bold;
}

/* Manual Connect Info */
#connectionInfo {
  background-color: #080808;
  border: 1px solid #323232;
  color: white;
  font-size: 13px;
  padding: 6px 8px;
  margin-top: 5px;
  font-family: monospace;
  white-space: nowrap;
  overflow-x: auto;
}

/* Server Status Bar */
.server-status-bar {
  background-color: #080808;
  border: 1px solid #323232;
  box-shadow: inset 1px 1px 4px rgba(0,0,0,0.8);
  color: #7b8484;
  padding: 8px 10px;
  font-family: "Verdana", sans-serif;
  font-size: 12px;
  margin-bottom: 10px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-status-bar.provisioning {
  color: #E3E41F;
  animation: pulse-text 2s infinite;
}

.server-status-bar.online {
  color: #8a9a4d;
}

@keyframes pulse-text {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

/* Ban Countdown */
#banCountdown {
  color: #8a9a4d;
  font-family: "Verdana", sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  margin: 10px 0;
}

/* Add VGUI titlebar style */
.vgui-titlebar {
  background: #080808; /* Dark background */
  border: 1px solid #323232; /* Dark border */
  border-top: none;
  color: #E3E41F; /* Yellow text */
  font-size: 13px;
  width: 100%;
  padding: 6px 12px;
  margin: 0;
  box-sizing: border-box;
  text-align: center;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1; /* Keep above other overlay content */
  border-bottom: 1px solid #323232; /* Add separator */
  font-family: "Verdana", sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* CHAT BOX */
.window ul {
  flex: 1;
  min-height: 40px; /* Reduced from 60px */
  max-height: calc(100% - 70px); /* More dynamic calculation */
  overflow-y: auto;
  padding: 0;
  margin: 0 0 15px 0 !important; /* Reduced bottom space above input */
  list-style-type: disc;
  padding-left: 8px; /* Tighter message alignment */
}

/* Add scrollbar styling to match CS 1.6 aesthetic */
.window ul::-webkit-scrollbar {
  width: 8px;
  background-color: #080808;
}

.window ul::-webkit-scrollbar-thumb {
  background-color: #4a4a4a;
  border-radius: 4px;
  border: 1px solid #323232;
}

.window ul::-webkit-scrollbar-thumb:hover {
  background-color: #5a5a5a;
}

input[type="text"] {
  border: 1px solid #323232;
  background: #080808;
  color: white;
  padding: 5px;
  width: calc(100% - 12px);
  margin-top: 10px;
  height: 28px;
  font-family: inherit;
}

button {
  margin-top: 5px;
  padding: 4px 10px;
  border-top: solid 1px #323232;
  border-bottom: solid 1px #080808;
  border-left: solid 1px #323232;
  border-right: solid 1px #080808;
  background: #212121;
  color: white;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  min-width: 80px; /* Added to match map buttons */
}

/* Specifically target Send buttons to match map buttons */
#sendTeamMessage, #sendPublicMessage {
  height: 28px; /* Match input field height */
  padding: 4px 10px; /* Reduced button padding */
  margin-top: 0 !important; /* Remove top margin */
  margin-right: -2px; /* Pull button closer to edge */
  display: flex;
  align-items: center; /* Center text vertically */
  justify-content: center; /* Center text horizontally */
}

button:hover {
  background-color: #181818;
  color: #E3E41F;
}

/* Only affects chat box layout inside windows */
.chat-inner {
  display: flex;
  flex-direction: column;
  height: fit-content;
}

/* Make chat input and send button sit inline */
.chat-input-row {
  display: flex;
  gap: 6px; /* Tighter gap between input and button */
  align-items: center; /* Vertically center items */
  height: 40px;
  margin: 10px 0 5px 0; /* Reduced vertical spacing */
  padding: 0 8px; /* Add horizontal padding */
}

.chat-input-row input[type="text"] {
  height: 28px; /* Match button height */
  margin-top: 0; /* Remove top margin */
  padding: 4px 8px; /* Tighter padding */
  flex: 1;
}

.chat-input-row button {
  margin-top: 0; /* Remove top margin */
}

/* Change the grid alignment and height constraints */
.lobby-grid > .window:nth-child(4), /* Team Chat */
.lobby-grid > .window:nth-child(5), /* Server Info */
.lobby-grid > .window:nth-child(6) { /* Public Chat */
  align-self: stretch; /* Changed from start to stretch */
  min-height: 160px; /* Unified height */
  max-height: 400px; /* Increased max height */
  height: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 20px; /* Increased bottom padding */
}

/* Ensure chat content scrolls independently */
.chat-inner {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 8px;
  margin: -8px; /* Counteract parent padding */
  justify-content: space-between; /* Push input to bottom */
}

/* Reduce window internal padding */
.lobby-grid > .window:nth-child(4),
.lobby-grid > .window:nth-child(6) {
  padding: 8px; /* Reduced from 10px */
}

/* Prevent message overflow */
.window ul li {
  word-break: break-word;
  margin-bottom: 8px; /* Increased from default 0 */
  padding-bottom: 4px; /* Added padding between messages */
  border-bottom: 1px solid #323232; /* Visual separator */
}

/* Map Vote Overlay */
#mapVoteOverlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #323232;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: flex-start; /* Align children to top */
  justify-content: center;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.5);
  padding: 0; /* Remove padding */
  padding-top: 30px; /* Make space for titlebar */
  gap: 8px;
}

/* Adjust overlay content spacing */
.overlay-content {
  width: 100%;
  padding: 20px;
  padding-top: 30px; /* Match titlebar height */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#overlayMessage {
  color: #E3E41F;
  font-family: "Verdana", sans-serif;
  font-size: 13px;
  text-shadow: 1px 1px 2px black;
  padding: 8px 20px;
  background: #080808;
  border: 1px solid #323232;
  margin: 0;
  text-align: center;
  width: 100%;
  max-width: none;
  letter-spacing: 0.5px;
}

/* Add VGUI-style progress bar */
.vgui-progress {
  background: #080808;
  border: 2px solid #323232; /* Consistent border color */
  height: 16px;
  width: calc(100% - 40px); /* Account for padding */
  margin: 0 auto;
  padding: 2px; /* Add inner spacing */
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.5); /* Single shadow */
}

.vgui-progress-bar {
  position: absolute;
  left: 0;
  top: 0; /* Remove top offset */
  bottom: 0;
  width: 100%;
  background: repeating-linear-gradient(
    90deg,
    #96892D 0%,
    #96892D 8px, /* 8px gold bars */
    #080808 8px, /* Immediate transition to black */
    #080808 12px /* 4px black spacing (12px - 8px) */
  );
  background-size: 12px 100%; /* Total stripe pattern width */
  height: 100%; /* Fill container */
  border-radius: 0; /* Remove rounded corners */
  transition: width 0.3s ease;
  animation: none !important; /* Remove all animations */
}

/* Style for the small Steam login button in the navbar */
.steam-nav-button {
  padding: 4px 12px !important; /* Smaller padding */
  font-size: 11px !important; /* Smaller font */
  min-width: auto !important; /* Allow smaller width */
  height: auto !important; /* Allow natural height */
  margin: 0 !important; /* Remove extra margin */
  vertical-align: middle; /* Align with nav text */
}
