/**
 * Social UI Styles
 * Styles for authentication modals, profile, and leaderboard
 */

/* Modal Base */
.social-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.social-modal-content {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 12px;
  border: 2px solid #0ea5e9;
  box-shadow: 0 8px 32px rgba(14, 165, 233, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.social-modal-header {
  padding: 20px;
  border-bottom: 2px solid rgba(14, 165, 233, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.social-modal-header h2 {
  margin: 0;
  color: #fff;
  font-size: 24px;
  font-weight: 600;
}

.social-modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.social-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.social-modal-body {
  padding: 20px;
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: #0ea5e9;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px;
  background: rgba(14, 165, 233, 0.1);
  border: 2px solid rgba(14, 165, 233, 0.3);
  border-radius: 6px;
  color: #fff;
  font-size: 16px;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.15);
}

.input-hint {
  display: block;
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
}

/* Backend Status Indicator */
.backend-status {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(59, 130, 246, 0.1);
  border: 2px solid rgba(59, 130, 246, 0.3);
}

.backend-status.success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.5);
  color: #22c55e;
}

.backend-status.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

.backend-status small {
  display: block;
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
}

.status-indicator {
  font-size: 18px;
  flex-shrink: 0;
}

.status-indicator.success {
  animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.error {
  animation: shake 0.5s ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Enhanced Error Messages */
.error-message {
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid #ef4444;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
  color: #ef4444;
}

.error-details {
  color: #fca5a5;
  white-space: pre-wrap;
}

.spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.form-actions {
  margin-top: 24px;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-bottom: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: rgba(14, 165, 233, 0.3);
}

.btn-secondary {
  background: rgba(14, 165, 233, 0.2);
  color: #0ea5e9;
  border: 2px solid #0ea5e9;
}

.btn-secondary:hover {
  background: rgba(14, 165, 233, 0.3);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 2px solid #ef4444;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
  transform: translateY(-2px);
}

/* Old error-message style - deprecated but kept for compatibility */
.form-group + .error-message {
  background: rgba(239, 68, 68, 0.2);
  border: 2px solid #ef4444;
  border-radius: 6px;
  padding: 12px;
  color: #ef4444;
  margin-bottom: 16px;
  font-size: 14px;
}

.form-footer {
  margin-top: 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
}

.form-footer a {
  color: #0ea5e9;
  text-decoration: none;
  font-weight: 500;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* Profile Styles */
.social-profile .profile-header {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  align-items: center;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  flex-shrink: 0;
  border: 3px solid #0ea5e9;
}

.profile-info {
  flex: 1;
}

.profile-info h3 {
  margin: 0 0 8px 0;
  color: #fff;
  font-size: 24px;
  font-weight: 600;
}

.profile-level {
  color: #0ea5e9;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
}

.profile-xp {
  margin-top: 8px;
}

.xp-bar {
  width: 100%;
  height: 8px;
  background: rgba(14, 165, 233, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9 0%, #06b6d4 100%);
  transition: width 0.3s ease;
}

.xp-text {
  color: #94a3b8;
  font-size: 12px;
}

.profile-stats {
  margin: 30px 0;
}

.profile-stats h4 {
  color: #0ea5e9;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.stat-item {
  background: rgba(14, 165, 233, 0.1);
  border: 2px solid rgba(14, 165, 233, 0.3);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-label {
  color: #94a3b8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  color: #fff;
  font-size: 24px;
  font-weight: 600;
}

.profile-actions {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Leaderboard Styles */
.leaderboard-filters {
  margin-bottom: 20px;
}

.leaderboard-filters select {
  width: 100%;
  padding: 12px;
  background: rgba(14, 165, 233, 0.1);
  border: 2px solid rgba(14, 165, 233, 0.3);
  border-radius: 6px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.leaderboard-filters select:focus {
  outline: none;
  border-color: #0ea5e9;
}

.leaderboard-content {
  min-height: 300px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-entry {
  display: grid;
  grid-template-columns: 50px 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: rgba(14, 165, 233, 0.1);
  border: 2px solid rgba(14, 165, 233, 0.2);
  border-radius: 8px;
  transition: all 0.2s;
}

.leaderboard-entry:hover {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.4);
  transform: translateX(4px);
}

.leaderboard-entry.rank-1 {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.1) 100%);
  border-color: rgba(255, 215, 0, 0.5);
}

.leaderboard-entry.rank-2 {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.2) 0%, rgba(192, 192, 192, 0.1) 100%);
  border-color: rgba(192, 192, 192, 0.5);
}

.leaderboard-entry.rank-3 {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(205, 127, 50, 0.1) 100%);
  border-color: rgba(205, 127, 50, 0.5);
}

.leaderboard-entry.current-user {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.3) 0%, rgba(14, 165, 233, 0.2) 100%);
  border-color: #0ea5e9;
}

.entry-rank {
  font-size: 20px;
  font-weight: 600;
  text-align: center;
}

.entry-username {
  color: #fff;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-score {
  color: #0ea5e9;
  font-weight: 600;
  font-size: 18px;
}

.entry-level {
  color: #94a3b8;
  font-size: 14px;
}

.entry-difficulty {
  font-size: 12px;
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-easy {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.badge-normal {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.badge-hard {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.loading,
.empty-state,
.error-state {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
  font-size: 16px;
}

.error-state {
  color: #ef4444;
}

/* Notification Toast */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(14, 165, 233, 0.95);
  color: #fff;
  padding: 16px 24px;
  border-radius: 8px;
  border: 2px solid #0ea5e9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10001;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
  max-width: 300px;
  font-weight: 500;
}

.notification.show {
  opacity: 1;
  transform: translateY(0);
}

.notification-success {
  background: rgba(34, 197, 94, 0.95);
  border-color: #22c55e;
}

.notification-error {
  background: rgba(239, 68, 68, 0.95);
  border-color: #ef4444;
}

.notification-info {
  background: rgba(14, 165, 233, 0.95);
  border-color: #0ea5e9;
}

/* Login Button States */
#loginButton.logged-in {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
  font-weight: 600;
}

#loginButton.logged-out {
  background: rgba(14, 165, 233, 0.2);
  border: 2px solid #0ea5e9;
  color: #0ea5e9;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .social-modal-content {
    width: 95%;
    max-height: 95vh;
  }
  
  .social-modal-header h2 {
    font-size: 20px;
  }
  
  .profile-header {
    flex-direction: column;
    text-align: center;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .leaderboard-entry {
    grid-template-columns: 40px 1fr auto;
    gap: 8px;
    font-size: 14px;
  }
  
  .entry-level,
  .entry-difficulty {
    display: none;
  }
  
  .notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}
