/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

header {
  background-color: #2c3e50;
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

header nav .logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  text-decoration: none;
}

header nav a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

header nav a:hover {
  background-color: rgba(255,255,255,0.1);
}

header nav form {
  display: inline;
  margin: 0;
}

header nav button {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

header nav button:hover {
  background-color: #c0392b;
}

main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.container {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.notice {
  background-color: #d4edda;
  color: #155724;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border: 1px solid #c3e6cb;
}

.alert {
  background-color: #f8d7da;
  color: #721c24;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border: 1px solid #f5c6cb;
}

.field {
  margin-bottom: 1.5rem;
}

.field label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.field input:focus {
  outline: none;
  border-color: #3498db;
}

.field-help {
  display: block;
  margin-top: 0.5rem;
  color: #7f8c8d;
  font-size: 0.9rem;
}

.player-names-input {
  font-size: 1rem;
  padding: 0.75rem;
}

.button, .actions input[type="submit"] {
  background-color: #3498db;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 1rem;
  transition: background-color 0.2s;
}

.button:hover, .actions input[type="submit"]:hover {
  background-color: #2980b9;
}

.button-secondary {
  background-color: #95a5a6;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 1rem;
}

.button-secondary:hover {
  background-color: #7f8c8d;
}

.actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
}

.error-messages {
  background-color: #f8d7da;
  color: #721c24;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  border: 1px solid #f5c6cb;
}

.error-messages ul {
  margin-top: 0.5rem;
  margin-left: 1.5rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.games-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.game-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.game-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.game-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.game-card-actions {
  padding-top: 0.75rem;
  border-top: 1px solid #ecf0f1;
  margin-top: 0.75rem;
}

.button-copy {
  background-color: #9b59b6;
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  width: 100%;
  transition: background-color 0.2s;
}

.button-copy:hover {
  background-color: #8e44ad;
}

.game-card h3 {
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.game-card.completed {
  opacity: 0.85;
  border-color: #95a5a6;
}

.game-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 1rem;
}

.game-card-header h3 {
  margin: 0;
  flex: 1;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
  white-space: nowrap;
}

.status-badge.active {
  background-color: #27ae60;
  color: white;
}

.status-badge.completed {
  background-color: #95a5a6;
  color: white;
}

.game-card-info {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.game-card-info p {
  margin: 0;
}

.game-card-meta {
  border-top: 1px solid #ecf0f1;
  padding-top: 0.75rem;
  color: #7f8c8d;
}

.game-card-meta p {
  margin: 0.25rem 0;
}

.player-field {
  margin-bottom: 1rem;
}

.table-container {
  overflow-x: auto;
  margin: 1.5rem 0;
}

.scores-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.scores-table th,
.scores-table td {
  padding: 1rem;
  text-align: center;
  border: 1px solid #ddd;
}

.scores-table th {
  background-color: #34495e;
  color: white;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.scores-table tbody tr:hover {
  background-color: #f8f9fa;
}

.scores-table .total-row {
  background-color: #ecf0f1;
  font-weight: bold;
}

.scores-table .total-row:hover {
  background-color: #ecf0f1;
}

.game-header {
  margin-bottom: 2rem;
}

.game-header h1 {
  margin-bottom: 0.5rem;
}

.scores-section {
  margin-bottom: 3rem;
}

.add-round-section {
  border-top: 2px solid #ecf0f1;
  padding-top: 2rem;
}

.round-form {
  display: grid;
  gap: 1rem;
  max-width: 500px;
}

.score-field {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1rem;
  align-items: center;
}

.score-field label {
  font-weight: 500;
}

.score-field input {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.empty-state {
  text-align: center;
  color: #7f8c8d;
  padding: 2rem;
  font-style: italic;
}

/* New styles for improved functionality */
.players-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.player-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.player-input-group input {
  flex: 1;
}

.button-small {
  background-color: #27ae60;
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.button-small:hover {
  background-color: #229954;
}

.button-remove {
  background-color: #e74c3c;
  color: white;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  min-width: 40px;
}

.button-remove:hover {
  background-color: #c0392b;
}

.button-warning {
  background-color: #f39c12;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 1rem;
}

.button-warning:hover {
  background-color: #e67e22;
}

.button-large {
  background-color: #27ae60;
  color: white;
  padding: 1rem 2rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.2rem;
  width: 100%;
  max-width: 300px;
}

.button-large:hover {
  background-color: #229954;
}

.game-title-section {
  flex: 1;
}

.game-meta {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.95rem;
}

.game-meta p {
  margin: 0;
}

.completed-badge {
  color: #27ae60;
  font-weight: bold;
}

.game-actions {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.score-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.edit-score-link {
  color: #3498db;
  text-decoration: none;
  font-size: 1.1rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.edit-score-link:hover {
  opacity: 1;
}

.current-player-form {
  background: #ecf0f1;
  padding: 2rem;
  border-radius: 8px;
  max-width: 500px;
}

.player-indicator {
  margin-bottom: 1.5rem;
  text-align: center;
}

.player-indicator h3 {
  margin-bottom: 0.5rem;
  color: #2c3e50;
}

.current-player-name {
  font-size: 1.2rem;
  color: #34495e;
}

.current-player-name strong {
  color: #27ae60;
  font-size: 1.4rem;
}

.score-input-group {
  margin-bottom: 1.5rem;
}

.score-input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 1.1rem;
}

.score-input {
  width: 100%;
  padding: 1rem;
  border: 2px solid #bdc3c7;
  border-radius: 4px;
  font-size: 1.5rem;
  text-align: center;
}

.score-input:focus {
  outline: none;
  border-color: #3498db;
}

.completed-message {
  background: #ecf0f1;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  color: #7f8c8d;
}

.edit-score-info {
  background: #ecf0f1;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.edit-score-info p {
  margin: 0.5rem 0;
}

/* Player Order Section */
.player-order-section {
  background: #f8f9fa;
  padding: 2rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-header h2 {
  margin: 0;
}

.player-order-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.player-order-item {
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.player-order-item:hover {
  border-color: #3498db;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.player-order-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.player-position {
  background: #3498db;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
}

.player-name {
  font-size: 1.1rem;
  font-weight: 500;
  color: #2c3e50;
}

.player-order-controls {
  display: flex;
  gap: 0.5rem;
}

.arrow-button {
  background: #ecf0f1;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.arrow-button:hover {
  background: #3498db;
  color: white;
  border-color: #3498db;
}

.arrow-button:active {
  transform: scale(0.95);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  header nav {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }

  header nav .logo {
    text-align: center;
    font-size: 1.2rem;
  }

  header nav span {
    font-size: 0.9rem;
    text-align: center;
  }

  header nav a,
  header nav button {
    padding: 0.5rem;
    font-size: 0.9rem;
  }

  main {
    margin: 1rem auto;
  }

  .container {
    padding: 1rem;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .games-list {
    grid-template-columns: 1fr;
  }

  .game-header {
    flex-direction: column;
    gap: 1rem;
  }

  .game-actions {
    flex-direction: column;
    width: 100%;
  }

  .game-actions .button-secondary,
  .game-actions .button-warning {
    width: 100%;
    text-align: center;
  }

  .game-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .scores-table {
    font-size: 0.9rem;
    min-width: 500px;
  }

  .scores-table th,
  .scores-table td {
    padding: 0.5rem;
  }

  .score-field {
    grid-template-columns: 1fr;
  }

  .round-form {
    width: 100%;
  }

  .current-player-form {
    padding: 1rem;
  }

  .current-player-name {
    font-size: 1rem;
  }

  .current-player-name strong {
    font-size: 1.2rem;
  }

  .score-input {
    font-size: 1.2rem;
  }

  .button-large {
    max-width: 100%;
  }

  .actions {
    flex-direction: column;
  }

  .actions a,
  .actions input[type="submit"] {
    width: 100%;
    text-align: center;
  }

  .players-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .button-small {
    width: 100%;
  }

  .player-input-group {
    flex-direction: column;
  }

  .player-input-group input {
    width: 100%;
  }

  .button-remove {
    width: 100%;
  }

  .field input[type="text"],
  .field input[type="email"],
  .field input[type="password"],
  .field input[type="number"] {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .player-order-section {
    padding: 1rem;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .section-header .button-small {
    width: 100%;
  }

  .player-order-item {
    padding: 0.75rem;
  }

  .player-position {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }

  .player-name {
    font-size: 1rem;
  }

  .arrow-button {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .scores-table {
    font-size: 0.8rem;
  }

  .scores-table th,
  .scores-table td {
    padding: 0.4rem;
  }

  .edit-score-link {
    font-size: 0.9rem;
  }
}
