/* =============================================================================
   Plataforma de Retos - Estilos CSS
   ============================================================================= */

/* Variables CSS */
:root {
  --color-primary: #4F46E5;
  --color-primary-dark: #4338CA;
  --color-secondary: #6B7280;
  --color-success: #10B981;
  --color-error: #EF4444;
  --color-warning: #F59E0B;
  --color-background: #F3F4F6;
  --color-card: #FFFFFF;
  --color-text: #1F2937;
  --color-text-light: #6B7280;
  --color-border: #E5E7EB;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--color-background);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* =============================================================================
   Autenticación - Login, Register, etc.
   ============================================================================= */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 2rem;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: var(--color-text-light);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-links {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.auth-links a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

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

.auth-links .separator {
  margin: 0 0.75rem;
  color: var(--color-text-light);
}

/* =============================================================================
   Formularios
   ============================================================================= */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--color-text);
}

.form-group input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input::placeholder {
  color: var(--color-text-light);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

/* =============================================================================
   Botones
   ============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-secondary);
  color: white;
}

.btn-secondary:hover {
  background: #4B5563;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

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

/* =============================================================================
   Mensajes
   ============================================================================= */

.error-message {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--color-error);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.success-message {
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: var(--color-success);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

/* =============================================================================
   Header
   ============================================================================= */

.header {
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-name {
  color: var(--color-text);
  font-weight: 500;
}

/* =============================================================================
   Main Content
   ============================================================================= */

.main-content {
  padding: 2rem;
  min-height: calc(100vh - 140px);
}

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

/* =============================================================================
   Welcome Section
   ============================================================================= */

.welcome-section {
  margin-bottom: 2rem;
}

.welcome-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.welcome-section p {
  color: var(--color-text-light);
}

/* =============================================================================
   Challenges Grid
   ============================================================================= */

.challenges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.challenge-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.challenge-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.challenge-icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
}

.challenge-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.challenge-card p {
  color: var(--color-text-light);
  font-size: 0.875rem;
  flex-grow: 1;
}

.challenge-difficulty {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  width: fit-content;
}

.challenge-difficulty.easy {
  background: #ECFDF5;
  color: #065F46;
}

.challenge-difficulty.medium {
  background: #FEF3C7;
  color: #92400E;
}

.challenge-difficulty.hard {
  background: #FEF2F2;
  color: #991B1B;
}

/* =============================================================================
   Stats Section
   ============================================================================= */

.stats-section {
  margin-bottom: 2rem;
}

.stats-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

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

.stat-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-label {
  display: block;
  color: var(--color-text-light);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* =============================================================================
   Footer
   ============================================================================= */

.footer {
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 2rem;
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.875rem;
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 640px) {
  .auth-card {
    padding: 1.5rem;
  }

  .header-content {
    padding: 1rem;
  }

  .main-content {
    padding: 1rem;
  }

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

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