/* Main styles for Wordle With Friends */

/* General styles */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.footer {
  margin-top: auto;
}

.section {
  flex: 1;
}

/* Wordle grid styles */
.wordle-grid {
  display: inline-flex;
  margin: 0.5rem 0;
}

.wordle-row {
  display: inline-flex;
}

.wordle-cell {
  width: 15px;
  height: 15px;
  margin: 1px;
  display: inline-block;
  align-items: center;
  justify-content: center;
  border: 1px solid #ccc;
  font-weight: bold;
  color: white;
}

.wordle-cell.correct {
  background-color: #6aaa64;
}

.wordle-cell.present {
  background-color: #c9b458;
}

.wordle-cell.absent {
  background-color: #787c7e;
}

.wordle-cell.empty {
  background-color: #d3d6da;
  color: #787c7e;
}

/* Distribution bar styles */
.guess-distribution {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.distribution-bar {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  background-color: #d3d6da;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.distribution-bar.max {
  background-color: #6aaa64;
  color: white;
}

/* Player stats */
.player-card {
  border-bottom: 1px solid #eee;
  padding: 10px 0;
  margin-bottom: 0.75rem;
  border-radius: 4px;
  background-color: #f5f5f5;
}

.player-card:last-child {
  border-bottom: none;
}

.player-card .is-size-7 {
  color: #7a7a7a;
}

/* Enhanced Guess Distribution */
.guess-section {
  margin-bottom: 20px;
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
}

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

.guess-header {
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 10px;
  background-color: #f5f5f5;
  padding: 8px;
  border-radius: 4px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Change the colors for each guess section to match our palette */
.guess-section:nth-child(1) .guess-header {
  background-color: #5a9658; /* Calm Green for 1-guess */
  color: white;
}

.guess-section:nth-child(2) .guess-header {
  background-color: #78a86c; /* Muted Green for 2-guesses */
  color: white;
}

.guess-section:nth-child(3) .guess-header {
  background-color: #b0ba74; /* Yellow-Green for 3-guesses */
  color: white;
}

.guess-section:nth-child(4) .guess-header {
  background-color: #d7be74; /* Amber for 4-guesses */
  color: #333;
}

.guess-section:nth-child(5) .guess-header {
  background-color: #d99970; /* Light Orange for 5-guesses */
  color: white;
}

.guess-section:nth-child(6) .guess-header {
  background-color: #cf7567; /* Dark Orange for 6-guesses */
  color: white;
}

.guess-section:nth-child(7) .guess-header {
  background-color: #c25d5d; /* Brick Red for failed attempts */
  color: white;
}

.stacked-bars-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-left: 15px;
}

.player-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-distribution-bar {
  height: 24px;
  border-radius: 4px;
  transition: transform 0.2s ease;
}

.player-distribution-bar:hover {
  transform: scaleX(1.02);
}

.bar-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label .player-name {
  font-weight: bold;
}

.bar-label .bar-count {
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
}

.player-legend {
  display: flex;
  flex-wrap: wrap;
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-right: 15px;
  margin-bottom: 5px;
}

.color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  margin-right: 6px;
}

/* Calendar styles */
.calendar-container {
  position: relative;
  width: 100%;
  overflow-x: auto;
  margin-top: 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding-bottom: 10px; /* Space for scrollbar */
}

/* Game grid tooltip styles */
.game-grid-tooltip {
  position: absolute;
  z-index: 100;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 10px;
  min-width: 150px;
  pointer-events: none; /* So it doesn't interfere with mouse events */
  transition: opacity 0.2s ease;
}

.wordle-full-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 5px;
}

.wordle-full-grid .wordle-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.wordle-full-grid .wordle-cell {
  width: 24px;
  height: 24px;
  border-radius: 2px;
}

.wordle-fallback {
  text-align: center;
  font-weight: bold;
  padding: 5px 0;
}

.wordle-number {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 5px;
  font-weight: bold;
  color: #666;
}

.ranking-calendar-grid {
  display: flex;
  flex-direction: row; /* Left to right */
  min-width: 100%;
  padding: 0.5rem;
}

.ranking-day-column {
  flex: 0 0 auto; /* Don't grow or shrink */
  width: 200px;
  min-width: 200px;
  margin-right: 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  background-color: #fff;
  box-shadow: 0 2px 3px rgba(0,0,0,0.05);
}

.ranking-day-header {
  padding: 0.5rem;
  background-color: #f5f5f5;
  text-align: center;
  border-bottom: 1px solid #e0e0e0;
}

.ranking-day-header.is-today {
  background-color: #effaf5;
  color: #3a7561; /* Darker green text for better visibility */
  font-weight: bold;
}

.day-name {
  font-size: 0.9rem;
  font-weight: bold;
}

.day-number {
  font-size: 1.4rem;
}

.ranking-players-container {
  padding: 0.5rem;
  min-height: 400px; /* Increased height to show more players */
  max-height: 400px; /* Limit maximum height */
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto; /* Allow vertical scrolling if too many players */
}

.player-rank {
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f9f9f9;
  border-left: 4px solid transparent;
  position: relative; /* For positioning of progress bar */
  overflow: hidden; /* Contains the progress bar */
}

.guess-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  z-index: 1; /* Between the background and content */
  opacity: 0.6; /* Slightly transparent */
}

.player-rank-content {
  position: relative;
  z-index: 2; /* Above the progress bar */
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.medal-emoji {
  margin-right: 0.5rem;
  font-size: 1.2em;
}

.player-name {
  flex-grow: 1;
  margin-right: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-score {
  font-weight: bold;
  white-space: nowrap;
}

.no-games {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: #999;
  text-align: center;
  padding: 2rem 0;
  font-style: italic;
  min-height: 50px;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .columns {
    display: block;
  }
  
  .column {
    width: 100%;
    padding: 0.75rem;
  }
  
  .calendar-container {
    grid-template-columns: repeat(7, 1fr);
  }
  
  .calendar-day {
    font-size: 0.6rem;
  }
  
  .wordle-cell {
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.6rem;
  }

  .ranking-day-column {
    width: 160px;
    min-width: 160px;
  }
  
  /* Make calendar header simpler on mobile */
  .calendar-header {
    justify-content: center;
  }
}