.lineup-section {
  flex: 1;
}

.lineup-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2em;
  margin-top: 2em;
}

.lineup-column {
  background-color: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.5em;
  border: 1px solid var(--border-color);
}

.lineup-column h2 {
  color: var(--accent-primary);
  font-size: 1.2em;
  margin: 0 0 1em 0;
  padding-bottom: 0.5em;
  border-bottom: 2px solid var(--border-color);
}

.position-group {
  margin-bottom: 1.5em;
}

.position-label {
  color: var(--text-muted);
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5em;
}

.player-slot {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 0.75em;
  margin-bottom: 0.5em;
  display: flex;
  align-items: flex-start;
  gap: 1em;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
  cursor: pointer;
  min-height: auto;
}

.player-slot:hover {
  border-color: #3A3F50;
  background: var(--border-color);
}

.player-slot.empty {
  opacity: 0.5;
  font-style: italic;
  color: #666;
  align-items: center;
}

.player-slot.selected {
  border-color: var(--accent-success);
  background: rgba(0, 223, 196, 0.1);
  box-shadow: 0 0 10px rgba(0, 223, 196, 0.3);
}

.player-slot.valid-target {
  border-color: rgba(0, 223, 196, 0.5);
  cursor: pointer;
}

.player-slot.valid-target:hover {
  background: rgba(0, 223, 196, 0.15);
  border-color: var(--accent-success);
}

.player-slot.invalid-target {
  opacity: 0.3;
  cursor: not-allowed;
}

.player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.25em;
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-weight: 600;
  margin-bottom: 0.2em;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.player-meta {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-bottom: 0.25em;
}

.player-details {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.25em;
}

.player-team {
  color: var(--text-muted);
  font-size: 0.85em;
}

.player-position {
  background: var(--bg-secondary);
  padding: 0.2em 0.5em;
  border-radius: 4px;
  font-size: 0.8em;
  color: var(--accent-success);
  display: inline-block;
  margin-right: 0.5em;
}

.player-game-time {
  font-size: 0.8em;
  color: var(--text-muted);
  margin-bottom: 0.25em;
  transition: color 0.2s ease;
}

.player-stats-container {
  margin-top: 0.5em;
  padding-top: 0.5em;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.player-stats {
  font-size: 0.75em;
  color: var(--text-muted);
  line-height: 1.3;
  font-family: 'Courier New', monospace;
}

.player-projections {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  align-items: flex-end;
  flex-shrink: 0;
  margin-top: 0.25em;
}

.cancel-swap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-tertiary);
  color: var(--accent-danger);
  padding: 0.75em 1.25em;
  border-radius: 8px;
  border: 1px solid var(--accent-danger);
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.2s;
}

.cancel-swap:hover {
  background: rgba(244, 67, 54, 0.1);
}

@media (max-width: 1200px) {
  .lineup-container {
    grid-template-columns: 1fr;
  }
}

.player-opponent {
  font-weight: 500;
}

.player-slot.game-live .player-game-time {
  color: var(--accent-success) !important;
}

.player-slot.game-live .player-game-time span:first-child {
  animation: pulse 2s infinite;
}

.player-slot.game-final .player-game-time {
  opacity: 0.6;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.player-slot.game-live {
  box-shadow: 0 0 8px rgba(0, 223, 196, 0.3);
}

.player-slot.player-locked {
  opacity: 0.7;
  background-color: rgba(136, 136, 136, 0.1);
  border-color: #888 !important;
  cursor: not-allowed;
}

.player-slot.player-locked:hover {
  background-color: rgba(136, 136, 136, 0.15);
  border-color: #888 !important;
}

.player-slot.player-locked .player-name {
  color: var(--text-muted);
}

/* Manual lock styling */
.player-slot.manually-locked {
  background-color: rgba(255, 193, 7, 0.1);
  border-color: rgba(255, 193, 7, 0.5) !important;
}

.player-slot.manually-locked .player-name {
  color: #f39c12;
}

/* Game-locked player styling */
.player-slot.game-locked {
  background-color: rgba(136, 136, 136, 0.15);
  border-color: rgba(136, 136, 136, 0.6) !important;
  opacity: 0.8;
}

.player-slot.game-locked .player-name {
  color: #95a5a6;
}

.player-slot.game-locked:hover {
  background-color: rgba(136, 136, 136, 0.2);
  border-color: rgba(136, 136, 136, 0.8) !important;
}

/* Distinguish between manual and game locks when both are present */
.player-slot.manually-locked.game-locked {
  background: linear-gradient(135deg, 
    rgba(255, 193, 7, 0.1) 0%, 
    rgba(136, 136, 136, 0.1) 100%);
  border-color: rgba(255, 193, 7, 0.5) !important;
}

.player-slot.manually-locked.game-locked .player-name {
  color: #f39c12; /* Manual lock takes precedence in color */
}

/* Lock button styling - updated positioning */
.player-lock-toggle {
  background: none;
  border: none;
  font-size: 0.8em;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.2s ease;
  opacity: 0.7;
  flex-shrink: 0;
  margin-left: 4px;
}

.player-lock-toggle:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.player-lock-toggle.locked {
  color: #f39c12;
  opacity: 1;
}

.player-lock-toggle.unlocked {
  color: #7f8c8d;
}

/* Status badge styling */
.player-status {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
  font-size: 0.7em;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: 500;
}

.player-status.out {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
}

.player-status.q {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
}

/* Game status indicator */
.game-lock-indicator {
  background: rgba(136, 136, 136, 0.3);
  color: #7f8c8d;
  font-size: 0.7em;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: 500;
}

.player-slot.player-manually-locked {
  background: rgba(243, 156, 18, 0.1);
  border-radius: 6px;
}

.player-slot.player-manually-locked .player-name {
  color: #f39c12;
  font-weight: 600;
}

.player-slot.player-manually-locked.player-locked {
  background: rgba(243, 156, 18, 0.1);
  opacity: 0.8;
}

.lock-warning {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
  font-size: 0.7em;
  padding: 0.25em 0.5em;
  border-radius: 3px;
  margin-top: 0.25em;
  display: inline-block;
}

.lock-icon {
  margin-left: 0.5em;
  font-size: 0.8em;
  color: #ff9800;
}

.pace-indicator {
  font-size: 0.9em;
  font-weight: 500;
}

.pace-indicator.hot {
  color: var(--accent-success);
}

.pace-indicator.cold {
  color: var(--accent-danger);
}

.pace-indicator.on-pace {
  color: var(--text-muted);
}

.score-current {
  color: var(--text-primary);
}

/* League Overview Styles */
.league-overview-container {
  padding: 1.5em;
  max-width: 1200px;
  margin: 0 auto;
}

.league-overview-header {
  text-align: center;
  margin-bottom: 2em;
}

.league-overview-header h2 {
  color: #fff;
  font-size: 1.8em;
  margin-bottom: 0.5em;
  font-weight: 600;
}

.league-overview-header .subtitle {
  color: #888;
  font-size: 1em;
  margin: 0;
}

.league-overview-loading {
  text-align: center;
  padding: 3em;
  color: #888;
}

.league-overview-loading h2 {
  color: #fff;
  margin-bottom: 1em;
}

/* League Cards Grid */
.league-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5em;
  margin-top: 2em;
}

.league-card {
  background: #252a3a;
  border-radius: 12px;
  padding: 1.5em;
  border: 1px solid #2a2f40;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.league-card:hover {
  border-color: #7ec4ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.league-card[data-league-id] {
  cursor: pointer;
}

.league-card.error-card {
  border-color: #f44336;
  background: rgba(244, 67, 54, 0.05);
}

.league-card.error-card:hover {
  border-color: #f44336;
  transform: none;
  box-shadow: none;
}

/* League Card Header */
.league-card-header {
  margin-bottom: 1.5em;
  padding-bottom: 1em;
  border-bottom: 1px solid #2a2f40;
  position: relative;
}

.league-header-top {
  display: flex;
  align-items: center;
  gap: 1em;
}

.league-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #2a2f40;
}

.league-header-info {
  flex: 1;
  min-width: 0;
}

.league-card-header h3 {
  color: #fff;
  font-size: 1.3em;
  font-weight: 600;
  margin: 0 0 0.5em 0;
  line-height: 1.3;
  word-wrap: break-word;
}

.league-meta {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.league-format {
  background: rgba(126, 196, 255, 0.1);
  color: #7ec4ff;
  padding: 0.25em 0.75em;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.league-format.error {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
}

/* League Projections */
.projection-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75em;
  padding: 0.5em 0;
}

.projection-label {
  color: #888;
  font-size: 0.9em;
  font-weight: 500;
}

.projection-value {
  font-size: 1.1em;
  font-weight: 600;
  text-align: right;
  transition: color 0.2s ease;
}

.league-card:hover .projection-value {
  opacity: 0.9;
}

.projection-improvement {
  margin-top: 1em;
  padding-top: 1em;
  border-top: 1px solid #2a2f40;
  text-align: center;
}

.projection-improvement span {
  font-size: 0.9em;
  font-weight: 500;
}

/* League Error State */
.league-error {
  text-align: center;
  padding: 1em;
  color: #f44336;
  font-size: 0.9em;
  background: rgba(244, 67, 54, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(244, 67, 54, 0.2);
}

/* Focus styles for accessibility */
.league-card[data-league-id]:focus {
  outline: 2px solid #7ec4ff;
  outline-offset: 2px;
}

.league-card[data-league-id]:focus-visible {
  outline: 2px solid #7ec4ff;
  outline-offset: 2px;
}

/* Visual hierarchy improvements */
.league-card-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30%;
  height: 2px;
  background: linear-gradient(90deg, #7ec4ff, transparent);
  border-radius: 1px;
}

/* League card tier styling */
.league-card.not-optimized {
  /* No special styling - full visibility */
}

.league-card.optimized-locked {
  opacity: 0.75;
  transition: opacity 0.3s ease;
}

.league-card.optimized-locked:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  border-color: #7ec4ff;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.league-card.optimized {
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.league-card.optimized:hover {
  opacity: 0.7;
  transform: translateY(-2px);
  border-color: #7ec4ff;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.projection-improvement .lock-constraint {
  color: #f39c12;
  font-size: 0.85em;
  margin-top: 0.25em;
}

/* Optimize button on league cards - FIXED */
.league-card .optimize-button {
  background: #00dfc4;
  color: #1a1f2e;
  border: none;
  padding: 0.5em 1em;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  margin-top: 0.75em;
  width: 100%;
  transition: all 0.2s ease;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.league-card .optimize-button:hover {
  background: #00b5a8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 223, 196, 0.3);
}

.league-card .optimize-button:active {
  transform: translateY(0);
}

.league-card .optimize-button:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
  transform: none;
}

.league-card .optimize-button.optimizing {
  background: #7ec4ff;
  color: #fff;
  animation: pulse 1s infinite;
}



/* Loading Animation */
.league-overview-loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #888;
  border-radius: 50%;
  border-top-color: #7ec4ff;
  animation: spin 1s linear infinite;
  margin-left: 0.5em;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .league-overview-container {
    padding: 1em;
  }
  
  .league-cards-container {
    grid-template-columns: 1fr;
    gap: 1em;
  }
  
  .league-card {
    padding: 1.25em;
  }
  
  .league-overview-header h2 {
    font-size: 1.5em;
  }

  .player-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2em;
  }

  .player-score span {
    white-space: nowrap;
  }

  .player-stats {
    font-size: 0.7em;
  }
  
  .player-stats-container {
    margin-top: 0.25em;
    padding-top: 0.25em;
  }
  
  .player-avatar {
    width: 40px;
    height: 40px;
  }
  
  .player-slot {
    padding: 0.5em;
  }
}

@media (max-width: 480px) {
  .league-overview-container {
    padding: 0.75em;
  }
  
  .league-card {
    padding: 1em;
  }
  
  .league-card-header h3 {
    font-size: 1.2em;
  }
  
  .projection-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25em;
  }
  
  .projection-value {
    text-align: left;
  }
}

/* Lineup Overview Table Styles */
.lineup-overview-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2em;
}

.lineup-overview-header {
  text-align: center;
  margin-bottom: 2em;
}

.lineup-table-container {
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow-x: auto;
  margin-top: 20px;
}

.lineup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.lineup-table thead {
  background: var(--bg-primary);
  border-bottom: 2px solid var(--border-color);
}

.lineup-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lineup-sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.lineup-sortable:hover {
  background: var(--bg-tertiary);
}

.lineup-table-row {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}

.lineup-table-row:hover {
  background: var(--bg-tertiary);
}

.lineup-table-row.lineup-clickable {
  cursor: pointer;
}

.lineup-table-row.needs-optimization {
  border-left: 3px solid #ff9800;
}

.lineup-table-row.locked-potential {
  border-left: 3px solid #ffc107;
}

.lineup-table-row.optimized {
  border-left: 3px solid #00dfc4;
}

.lineup-table-row.error-row {
  border-left: 3px solid #f44336;
}

.lineup-table td {
  padding: 12px 16px;
  vertical-align: middle;
}

.lineup-table-league-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lineup-table-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  object-fit: cover;
}

.lineup-table-league-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.lineup-format-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  background: var(--secondary-background);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.lineup-format-badge.error {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
  border-color: #f44336;
}

.lineup-projection {
  font-weight: 500;
  color: var(--text-primary);
}

.lineup-projection.positive {
  color: #00dfc4;
}

.lineup-projection.negative {
  color: #f44336;
}

.lineup-improvement {
  font-weight: 500;
}

.lineup-improvement.has-improvement {
  color: #00dfc4;
}

.lineup-improvement.locked-improvement {
  color: #ffc107;
  font-weight: 500;
}

.lineup-improvement.no-improvement {
  color: var(--text-secondary);
}

.lineup-status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.lineup-status-badge.needs-optimization {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
}

.lineup-status-badge.optimized {
  background: rgba(0, 223, 196, 0.2);
  color: #00dfc4;
}

.lineup-status-badge.best-ball {
  background: rgba(33, 150, 243, 0.2);
  color: #2196f3;
}

.lineup-status-badge.locked-potential {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
}

.lineup-status-badge.error {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
}

.lineup-optimize-btn {
  padding: 6px 12px;
  border: 1px solid #00dfc4;
  border-radius: 4px;
  background: transparent;
  color: #00dfc4;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lineup-optimize-btn:hover {
  background: #00dfc4;
  color: white;
}

.lineup-optimize-btn.game-time-only {
  border-color: #9c27b0;
  color: #9c27b0;
}

.lineup-optimize-btn.game-time-only:hover {
  background: #9c27b0;
  color: white;
}

.lineup-action-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.lineup-error-text {
  font-size: 12px;
  color: #f44336;
  font-style: italic;
}

/* IR button styling */
.lineup-ir-btn {
  padding: 6px 12px;
  border: 1px solid #ff9800;
  border-radius: 4px;
  background: transparent;
  color: #ff9800;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lineup-ir-btn:hover {
  background: #ff9800;
  color: white;
}

.lineup-ir-status {
  font-size: 12px;
  color: var(--text-secondary);
}

.lineup-ir-status.ok {
  color: #4caf50;
  font-weight: 500;
}

/* Table column widths */
.lineup-th-league { width: 25%; }
.lineup-th-format { width: 15%; }
.lineup-th-current { width: 15%; }
.lineup-th-optimal { width: 15%; }
.lineup-th-improvement { width: 10%; }
.lineup-th-ir { width: 10%; }
.lineup-th-status { width: 12%; }
.lineup-th-action { width: 8%; }

/* Responsive table */
@media (max-width: 768px) {
  .lineup-table-container {
    font-size: 12px;
  }

  .lineup-table th,
  .lineup-table td {
    padding: 8px 12px;
  }

  .lineup-table-avatar {
    width: 28px;
    height: 28px;
  }

  .lineup-table-league-name {
    font-size: 13px;
  }

  .lineup-optimize-btn {
    padding: 4px 8px;
    font-size: 11px;
  }
}