/* ========================================
   TOCHITO ASEGURADA V3 - AUTH CSS
   Modern authentication pages styling
   ======================================== */

/* Import design system variables from index */
:root {
  /* Primary Colors - Verde (Tochito Asegurada Brand) */
  --primary: #2E7D32;
  --primary-dark: #1B5E20;
  --primary-light: #4CAF50;
  
  /* Secondary Colors - Rojo (Tochito Asegurada Brand) */
  --secondary: #C62828;
  --secondary-dark: #B71C1C;
  
  /* Accent */
  --accent: #2E7D32;
  --accent-dark: #1B5E20;
  
  /* Neutrals */
  --dark: #0f172a;
  --dark-lighter: #1e293b;
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --light: #f8fafc;
  --white: #ffffff;
  
  /* Status */
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #eab308;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Montserrat', var(--font-sans);
}

/* ========== BASE STYLES ========== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.auth-page {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ========== ANIMATED BACKGROUND ========== */
.auth-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--dark);
  overflow: hidden;
}

.auth-background::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(46, 125, 50, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(198, 40, 40, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(27, 94, 32, 0.15) 0%, transparent 50%);
  animation: bgGlow 10s ease-in-out infinite alternate;
}

@keyframes bgGlow {
  0% { opacity: 0.7; transform: scale(1) rotate(0deg); }
  100% { opacity: 1; transform: scale(1.1) rotate(5deg); }
}

.auth-background .grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(46, 125, 50, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 125, 50, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ========== AUTH WRAPPER ========== */
.auth-wrapper {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  min-height: 100vh;
}

/* ========== AUTH CARD ========== */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  animation: cardSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.auth-card-body {
  padding: 2.5rem;
}

/* ========== AUTH HEADER ========== */
.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px rgba(46, 125, 50, 0.3);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(46, 125, 50, 0.3); }
  50% { transform: scale(1.05); box-shadow: 0 15px 40px rgba(46, 125, 50, 0.4); }
}

.auth-logo img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.auth-logo i {
  font-size: 2rem;
  color: var(--white);
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0 0 0.5rem;
}

.auth-subtitle {
  font-size: 0.9375rem;
  color: var(--gray-500);
  margin: 0;
}

/* ========== FORM STYLES ========== */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  position: relative;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--gray-400);
  font-size: 1rem;
  transition: color var(--transition-fast);
  pointer-events: none;
  z-index: 1;
}

.auth-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--gray-900);
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  outline: none;
  transition: all var(--transition-fast);
}

.auth-input::placeholder {
  color: var(--gray-400);
}

.auth-input:hover {
  border-color: var(--gray-300);
}

.auth-input:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.1);
}

.auth-input:focus + .input-icon,
.auth-input:focus ~ .input-icon {
  color: var(--primary);
}

.auth-input.is-invalid {
  border-color: var(--danger);
}

.auth-input.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-group .invalid-feedback {
  margin-top: 0.375rem;
}

/* Password toggle button */
.password-toggle {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  padding: 0.5rem;
  color: var(--gray-400);
  cursor: pointer;
  transition: color var(--transition-fast);
  z-index: 1;
}

.password-toggle:hover {
  color: var(--gray-600);
}

/* Input with password toggle */
.auth-input.has-toggle {
  padding-right: 3rem;
}

/* ========== CHECKBOX ========== */
.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.auth-checkbox input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.auth-checkbox span {
  font-size: 0.9375rem;
  color: var(--gray-600);
}

/* ========== BUTTONS ========== */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.auth-btn-primary {
  background: var(--gradient-primary);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(46, 125, 50, 0.4);
}

.auth-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(46, 125, 50, 0.5);
}

.auth-btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.auth-btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-btn-secondary {
  background: transparent;
  color: var(--gray-700);
  border: 2px solid var(--gray-300);
}

.auth-btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(46, 125, 50, 0.05);
}

.auth-btn-success {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(46, 125, 50, 0.4);
}

.auth-btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(46, 125, 50, 0.5);
}

/* Loading state */
.auth-btn .spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--white);
  animation: spin 0.8s linear infinite;
}

.auth-btn.loading .spinner {
  display: block;
}

.auth-btn.loading .btn-text {
  opacity: 0;
}

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

/* ========== DIVIDER ========== */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.auth-divider span {
  font-size: 0.875rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========== LINKS ========== */
.auth-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.auth-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
}

.auth-footer p {
  font-size: 0.9375rem;
  color: var(--gray-600);
  margin: 0 0 0.75rem;
}

/* ========== ALERTS ========== */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  animation: alertSlide 0.3s ease;
}

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

.auth-alert i {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.auth-alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.auth-alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.auth-alert-warning {
  background: rgba(234, 179, 8, 0.1);
  color: var(--warning);
  border: 1px solid rgba(234, 179, 8, 0.2);
}

/* ========== BACK LINK ========== */
.auth-back {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-400);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  backdrop-filter: blur(10px);
  transition: all var(--transition);
  z-index: 10;
}

.auth-back:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.2);
}

/* ========== REGISTER SPECIFIC ========== */
.auth-card.auth-card-wide {
  max-width: 600px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 575px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 0.375rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  margin: 1.5rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}

.section-title:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 575px) {
  .auth-card-body {
    padding: 1.5rem;
  }
  
  .auth-title {
    font-size: 1.5rem;
  }
  
  .auth-logo {
    width: 64px;
    height: 64px;
  }
  
  .auth-logo i {
    font-size: 1.5rem;
  }
  
  .auth-back {
    top: 1rem;
    left: 1rem;
  }
}

/* ========== FOOTER ========== */
.auth-page-footer {
  position: relative;
  z-index: 1;
  padding: 1.5rem;
  text-align: center;
}

.auth-page-footer p {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin: 0;
}

.auth-page-footer a {
  color: var(--gray-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.auth-page-footer a:hover {
  color: var(--white);
}

/* ========== TEMA ROJO - LOGIN ESTADÍSTICAS (Panel admin/árbitros) ========== */
.auth-page.login-estadisticas {
  --primary: #C62828;
  --primary-dark: #B71C1C;
  --primary-light: #E53935;
  --accent: #C62828;
  --accent-dark: #B71C1C;
  --gradient-primary: linear-gradient(135deg, #C62828 0%, #B71C1C 100%);
}

.auth-page.login-estadisticas .auth-background::before {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(198, 40, 40, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(46, 125, 50, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(183, 28, 28, 0.15) 0%, transparent 50%);
}

.auth-page.login-estadisticas .auth-background .grid {
  background-image:
    linear-gradient(rgba(198, 40, 40, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(198, 40, 40, 0.04) 1px, transparent 1px);
}

.auth-page.login-estadisticas .auth-logo {
  background: var(--gradient-primary);
  box-shadow: 0 10px 30px rgba(198, 40, 40, 0.35);
}

.auth-page.login-estadisticas .auth-logo i {
  color: var(--white);
}

@keyframes logoPulseEstadisticas {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(198, 40, 40, 0.35); }
  50% { transform: scale(1.05); box-shadow: 0 15px 40px rgba(198, 40, 40, 0.45); }
}

.auth-page.login-estadisticas .auth-logo {
  animation: logoPulseEstadisticas 3s ease-in-out infinite;
}

.auth-page.login-estadisticas .auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.12);
}

.auth-page.login-estadisticas .auth-input:focus + .input-icon,
.auth-page.login-estadisticas .auth-input:focus ~ .input-icon {
  color: var(--primary);
}

.auth-page.login-estadisticas .auth-checkbox input[type="checkbox"] {
  accent-color: var(--primary);
}

.auth-page.login-estadisticas .auth-btn-primary {
  background: var(--gradient-primary);
  box-shadow: 0 4px 15px rgba(198, 40, 40, 0.4);
}

.auth-page.login-estadisticas .auth-btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 25px rgba(198, 40, 40, 0.5);
}

.auth-page.login-estadisticas .auth-btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(198, 40, 40, 0.06);
}

.auth-page.login-estadisticas .auth-link {
  color: var(--primary);
}

.auth-page.login-estadisticas .auth-link:hover {
  color: var(--primary-dark);
}

/* ========== RECAPTCHA WIDGET ========== */
.recaptcha-container {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0;
}

.recaptcha-container .g-recaptcha {
  transform-origin: center;
}

@media (max-width: 400px) {
  .recaptcha-container .g-recaptcha {
    transform: scale(0.9);
  }
}
