/**
 * User Account and High Scores System Styles
 */

/* User Panel */
.user-panel {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin: 2rem auto;
  max-width: 800px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .user-panel {
    --card-bg: #1e1e1e;
    color: #e0e0e0;
  }
}

/* User Info Header */
.user-info-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color, #e0e0e0);
  margin-bottom: 1rem;
}

.user-avatar {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent-color, #3498db), var(--accent-dark, #2980b9));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
}

.user-details {
  flex: 1;
}

.user-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.user-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary, #666);
}

/* Auth Forms */
.auth-form {
  max-width: 400px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--primary-color, #2c3e50);
}

.auth-form-group {
  margin-bottom: 1rem;
}

.auth-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-color, #333);
}

.auth-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent-color, #3498db);
}

.auth-button {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent-color, #3498db);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

.auth-button:hover {
  background: var(--accent-dark, #2980b9);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.auth-button:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
}

.auth-switch {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.auth-switch a {
  color: var(--accent-color, #3498db);
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* High Scores Table */
.high-scores-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.high-scores-table th,
.high-scores-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.high-scores-table th {
  background: var(--header-bg, #f8f9fa);
  font-weight: 600;
  color: var(--text-color, #333);
}

.high-scores-table tr:hover {
  background: var(--row-hover, #f0f8ff);
}

.high-scores-table .rank-1 {
  background: rgba(255, 215, 0, 0.1);
  font-weight: bold;
}

.high-scores-table .rank-2 {
  background: rgba(192, 192, 192, 0.1);
}

.high-scores-table .rank-3 {
  background: rgba(205, 127, 50, 0.1);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: bold;
  background: var(--badge-bg, #f8f9fa);
}

.rank-badge.gold {
  background: linear-gradient(135deg, #ffd700, #ffb347);
  color: white;
}

.rank-badge.silver {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  color: white;
}

.rank-badge.bronze {
  background: linear-gradient(135deg, #cd7f32, #a0522d);
  color: white;
}

/* Leaderboard */
.leaderboard {
  margin-top: 2rem;
}

.leaderboard-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--primary-color, #2c3e50);
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--item-bg, #f8f9fa);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

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

.leaderboard-item.current-user {
  background: var(--accent-color, #3498db);
  color: white;
  border-left: 4px solid var(--accent-dark, #2980b9);
}

.leaderboard-rank {
  font-size: 1.5rem;
  font-weight: bold;
  min-width: 40px;
  text-align: center;
  color: var(--accent-color, #3498db);
}

.leaderboard-item.current-user .leaderboard-rank {
  color: white;
}

.leaderboard-user {
  flex: 1;
}

.leaderboard-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.leaderboard-stats {
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
}

.leaderboard-item.current-user .leaderboard-stats {
  color: rgba(255, 255, 255, 0.8);
}

.leaderboard-score {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--accent-color, #3498db);
}

.leaderboard-item.current-user .leaderboard-score {
  color: white;
}

/* Achievements */
.achievements-section {
  margin-top: 2rem;
}

.achievements-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary-color, #2c3e50);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.achievement-card {
  background: var(--achievement-bg, #f8f9fa);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.achievement-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  border-color: var(--accent-color, #3498db);
}

.achievement-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.achievement-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-color, #333);
}

.achievement-description {
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
}

.achievement-locked {
  opacity: 0.5;
  filter: grayscale(1);
}

/* Notification Toast */
.user-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 1rem 1.5rem;
  max-width: 400px;
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.user-notification.success {
  border-left: 4px solid #28a745;
}

.user-notification.error {
  border-left: 4px solid #dc3545;
}

.user-notification.info {
  border-left: 4px solid var(--accent-color, #3498db);
}

.notification-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.notification-message {
  font-size: 0.9rem;
  color: var(--text-secondary, #666);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .user-panel {
    padding: 1rem;
    margin: 1rem;
  }

  .achievements-grid {
    grid-template-columns: 1fr;
  }

  .user-info-header {
    flex-direction: column;
    text-align: center;
  }

  .user-stats {
    justify-content: center;
    flex-wrap: wrap;
  }

  .high-scores-table {
    font-size: 0.85rem;
  }

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

  .user-notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* Print styles */
@media print {
  .auth-form,
  .user-notification {
    display: none;
  }

  .user-panel {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
