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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

/* Login Styles */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 15px;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h1 {
  color: #333;
  font-size: 2.5em;
  margin-bottom: 10px;
}

.login-header p {
  color: #666;
  font-size: 1.1em;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: #333;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
}

.message {
  margin-top: 15px;
  padding: 10px;
  border-radius: 5px;
  text-align: center;
  display: none;
}

.message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  color: #666;
}

/* Dashboard Styles */
.dashboard {
  min-height: 100vh;
  background: #f5f5f5;
}

.dashboard-header {
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 15px 0;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.header-content h1 {
  color: #333;
  font-size: 1.8em;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.elo-points {
  background: #667eea;
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 600;
}

.btn-logout {
  background: #dc3545;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 5px;
  transition: background 0.3s;
}

.btn-logout:hover {
  background: #c82333;
}

.dashboard-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  padding: 20px;
}

.sidebar {
  background: white;
  border-radius: 10px;
  padding: 20px;
  height: fit-content;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.student-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: center;
}

.student-card h3 {
  margin-bottom: 10px;
  font-size: 1.3em;
}

.game-modes {
  margin-bottom: 20px;
}

.game-modes h4 {
  margin-bottom: 10px;
  color: #333;
}

.btn-mode {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
}

.btn-mode:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.online-players,
.ranking {
  margin-bottom: 20px;
}

.online-players h4,
.ranking h4 {
  margin-bottom: 10px;
  color: #333;
  font-size: 1.1em;
}

.player-item,
.rank-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 5px;
  background: #f8f9fa;
  border-radius: 5px;
  font-size: 14px;
}

.player-item:hover {
  background: #e9ecef;
  cursor: pointer;
}

.challenge-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.main-content {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.lobby-stats {
  display: grid;
  gap: 20px;
}

.stat-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  border-left: 4px solid #667eea;
}

.stat-card h3 {
  margin-bottom: 15px;
  color: #333;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.game-info {
  text-align: center;
}

.game-controls {
  display: flex;
  gap: 10px;
}

.btn-danger {
  background: #dc3545;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}

.btn-secondary {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 15% auto;
  padding: 20px;
  border-radius: 10px;
  width: 300px;
  text-align: center;
}

.modal-buttons {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.game-history-item {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  margin-bottom: 5px;
  background: white;
  border-radius: 5px;
  border-left: 4px solid #28a745;
}

.game-history-item.loss {
  border-left-color: #dc3545;
}

.game-history-item.draw {
  border-left-color: #ffc107;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

  .main-content {
    order: 1;
  }
}

/* Estilos adicionales para mejorar la visualización */
.no-players,
.no-ranking,
.no-history,
.error {
  text-align: center;
  padding: 20px;
  color: #666;
  font-style: italic;
}

.error {
  color: #dc3545;
}

#chessboard {
  margin: 20px auto;
  border: 2px solid #333;
  border-radius: 8px;
}

.game-container {
  max-width: 600px;
  margin: 0 auto;
}

.game-info {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.game-info #gameStatus {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.challenge-btn:hover {
  background: #218838;
}

.player-item {
  transition: all 0.3s ease;
}

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

/* Responsive para el tablero */
@media (max-width: 768px) {
  #chessboard {
    width: 300px !important;
  }
}
