/* Main CSS for Scrabble Game */
:root {
  --board-bg-color: #f5f5dc; /* Light beige background */
  --board-border-color: #8b4513; /* Brown border */
  --regular-cell-color: #e6d7b8; /* Light tan for regular cells */
  --dl-cell-color: #add8e6; /* Light blue for double letter */
  --tl-cell-color: #00008b; /* Darker blue for better contrast */
  --dw-cell-color: #ffb6c1; /* Light pink for double word */
  --tw-cell-color: #ff0000; /* Red for triple word */
  --tile-color: #f0e68c; /* Khaki for tiles */
  --tile-text-color: #000000; /* Black text on tiles */
  --rack-bg-color: #8b4513; /* Brown rack background */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f4f4f4;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 5px;
}

header {
  text-align: center;
  margin-bottom: 20px;
}

h1 {
  color: #8b4513;
  margin-bottom: 10px;
}

.game-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  display: none; /* Hidden by default */
}

@media (min-width: 768px) {
  .game-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
  }
  
  .game-content {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
    order: 1;
  }
  
  .game-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    order: 2;
  }
}

.game-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.game-board-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0px;
}

.tile-rack-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.game-info {
  padding: 15px;
  background-color: #f9f9f9;
  border-radius: 5px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

.players-info,
.house-rules,
#chat-container {
  border: 1px solid #ccc; /* Subtle border */
  margin: 15px 0;
  padding: 10px;
  background-color: #e9e9e9;
  border-radius: 5px;
}

.player-list {
  list-style: none;
}

.player-list li {
  padding: 8px;
  margin-bottom: 5px;
  background-color: #f0f0f0;
  border-radius: 3px;
}

.lobby {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #f9f9f9;
  border-radius: 5px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

.lobby h2 {
  margin-bottom: 15px;
  color: #8b4513;
}

.game-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.game-form input {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  max-width: 300px;
}

.game-form h3 {
  color: #8b4513;
}

.new-game-section, .available-games {
  margin-bottom: 15px;
  background-color: #f0f0f0;
  padding: 10px;
  border-radius: 3px;
}

.new-game-section h3, .available-games h3 {
  color: #8b4513;
  margin-bottom: 10px;
}

.new-game-item {
  display: flex;
  align-items: center;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  height: 40px; /* Match game-item height */
  padding: 0 8px;
}

.new-game-item input {
  flex-grow: 1;
  border: none;
  outline: none;
  padding: 8px;
  background: transparent;
}

.new-game-item button {
  padding: 5px 10px;
  background-color: #8b4513;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

.new-game-item button:hover {
  background-color: #704012;
}

.game-list {
  list-style: none;
}

.game-item {
  display: flex;
  align-items: center;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  height: 40px; /* Match new-game-item height */
  margin-bottom: 5px;
  padding: 0 8px;
}

.game-item > span {
  flex-grow: 1;
  min-width: 100px;
  padding: 8px;
}

.game-item > div {
  display: flex;
  gap: 5px;
}

.join-game-btn, .delete-game-btn {
  padding: 5px 10px;
  background-color: #8b4513;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

.delete-game-btn {
  background-color: #dc3545;
  padding: 5px 8px; /* Slightly smaller for shorter text */
}

.join-game-btn:hover {
  background-color: #704012;
}

.delete-game-btn:hover {
  background-color: #c82333;
}

.tile-rack {
  width: 360px; /* Fixed width */
  height: 60px; /* Fixed height */
  background-color: var(--rack-bg-color);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: flex-start; /* Left-justify tiles */
  gap: 10px;
  position: relative;
  align-items: center;
}

/* Optional: Add a pseudo-element to reinforce rack background */
.tile-rack::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--rack-bg-color);
  z-index: 0;
}

.controls {
  display: flex;
  gap: 20px; /* Increased space between buttons */
}

.controls button {
  padding: 8px 16px;
  background-color: #8b4513;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

.controls button:hover {
  background-color: #704012;
}

.game-description, .help-content {
  margin-top: 20px;
  padding: 15px;
  background-color: #f0f0f0;
  border-radius: 5px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

.game-description h3, .help-content h2 {
  margin-bottom: 10px;
    color: #8b4513; /* Brown to match theme */
    font-size: 1.5rem; /* Consistent header size */
}

.game-description-content, .help-content .game-description-content {
  font-size: 0.9rem;
}

.game-description h2, .help-content h2:not(:first-child) {
    color: #8b4513; /* Brown for description headers */
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.game-description p, .help-content p {
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: #333;
}

.game-description ul, .help-content ul {
  list-style-type: disc;
  margin-left: 20px;
  margin-bottom: 10px;
}

.game-description li, .help-content li {
  font-size: 0.9rem;
  margin-bottom: 5px;
  color: #333;
}

.game-description strong, .help-content strong {
    color: #704012; /* Darker brown for emphasis */
}

.help-link, .back-link {
  display: inline-block;
  margin-top: 10px;
  color: #8b4513;
  text-decoration: none;
  font-weight: bold;
}

.help-link:hover, .back-link:hover {
  text-decoration: underline;
}

#notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 5px;
  color: white;
  font-weight: bold;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  max-width: 300px;
}

#notification.show {
  opacity: 1;
}

#notification.info {
  background-color: #2196F3;
}

#notification.success {
  background-color: #4CAF50;
}

#notification.error {
  background-color: #F44336;
}

#connection-test-container {
  font-size: 12px;
}

#chat-container {
    width: 100%;
    max-width: 300px;
    height: 400px;
    border: 1px solid #ccc;
    padding: 10px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
}

#connection-status {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

#messageArea {
    flex: 1;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background: #fff;
}

#messageArea li {
    margin-bottom: 5px;
    font-size: 14px;
}

#messageForm {
    display: flex;
    margin-top: 10px;
}

#message {
    flex: 1;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#sendButton {
    margin-left: 5px;
    padding: 5px 10px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#sendButton:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#status-panel {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 200px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
}

.game-container.active #status-panel {
    display: block; /* Show when game is active */
}

#voice-button-container {
  display: flex;
  flex-direction: row;
}

#voice-status {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

#connectButton,
#disconnectButton,
#muteButton {
    padding: 5px 10px;
    margin-right: 5px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#muteButton.muted {
    background: #dc3545;
}

#connectButton {
    background: #28a745;
}

#disconnectButton {
    background: #dc3545;
}

.players-info h3,
.house-rules h3,
#chat-container h3 {
  color: #8b4513;
  margin-bottom: 10px;
}

.game-status-list,
.player-list,
.house-rules-list {
  list-style: none;
  padding: 0;
}

.game-status-list li,
.player-list li,
.house-rules-list li {
  display: flex;
  align-items: center;
  padding: 5px 0;
  font-size: 0.9rem;
  color: #333;
}

/* Specific styling for player list items */
.player-list li.current-user {
    font-weight: bold;
}

/* Styling for game actions (Leave Game button) */
.game-actions {
    margin-top: 10px;
    text-align: right; /* Align button to the right for consistency */
}

#leave-game-btn {
    margin: 10px 0px;
    padding: 8px 16px;
    background-color: #8b4513;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
}

#leave-game-btn:hover {
    background-color: #704012;
}

/* Ensure house rules checkboxes are styled as before */
.house-rules-list input[type="checkbox"] {
  margin-right: 10px;
  cursor: pointer;
}

.house-rules-list label {
  cursor: pointer;
}

/* Styling for status panel to match merged div */
#status-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

#status-panel button {
    width: 100%;
    text-align: left;
}

