/* ============================================
   VARIABLES - COEL Quiniela Mundialista 2026
   ============================================ */
:root {
  --coel-primary: #01a17e;
  --coel-primary-dark: #018a6b;
  --coel-primary-light: #e6f7f3;
  --coel-secondary: #ffd700;
  --coel-accent: #00c9a7;
  --coel-dark: #0a1628;
  --coel-dark-2: #111d35;
  --coel-white: #ffffff;
  --coel-gray-50: #f8fafc;
  --coel-gray-100: #f1f5f9;
  --coel-gray-200: #e2e8f0;
  --coel-gray-300: #cbd5e1;
  --coel-gray-400: #94a3b8;
  --coel-gray-500: #64748b;
  --coel-gray-600: #475569;
  --coel-gray-700: #334155;
  --coel-gray-800: #1e293b;
  --coel-gray-900: #0f172a;
  --coel-error: #ef4444;
  --coel-error-light: #fef2f2;
  --coel-success: #10b981;
  --coel-success-light: #ecfdf5;
  --coel-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --coel-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --coel-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --coel-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --coel-radius-sm: 8px;
  --coel-radius: 12px;
  --coel-radius-lg: 16px;
  --coel-radius-xl: 24px;
  --coel-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--coel-gray-800);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   AUTH CONTAINER
   ============================================ */
.auth-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
}

/* ============================================
   BACKGROUND
   ============================================ */
.auth-background {
  position: fixed;
  inset: 0;
  background: url("https://hebbkx1anhila5yf.public.blob.vercel-storage.com/login-background-EzcG3NX7r4Fvl00OVQQq5zNRsW8sp4.jpg") center / cover no-repeat;
  z-index: -2;
}

.pattern-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(10, 22, 40, 0.92) 0%,
    rgba(1, 161, 126, 0.15) 50%,
    rgba(10, 22, 40, 0.92) 100%
  );
  z-index: -1;
}

.pattern-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(1, 161, 126, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 215, 0, 0.06) 0%, transparent 50%);
}

/* ============================================
   BACK LINK
   ============================================ */
.back-link {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: var(--coel-radius);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--coel-white);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--coel-transition);
  animation: fadeInDown 0.5s ease 0.3s both;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(-3px);
}

.back-link i {
  font-size: 0.875rem;
  transition: transform 0.3s ease;
}

.back-link:hover i {
  transform: translateX(-3px);
}

/* ============================================
   AUTH CARD
   ============================================ */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--coel-white);
  border-radius: var(--coel-radius-xl);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
  position: relative;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--coel-primary), var(--coel-accent), var(--coel-secondary), var(--coel-primary));
  background-size: 300% 100%;
  animation: shimmer 3s linear infinite;
}

/* ============================================
   AUTH HEADER
   ============================================ */
.auth-header {
  background: linear-gradient(135deg, var(--coel-primary) 0%, var(--coel-primary-dark) 100%);
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--coel-white);
  clip-path: ellipse(60% 100% at 50% 100%);
}

.auth-header-content {
  position: relative;
  z-index: 1;
}

.brand-logo {
  height: 50px;
  width: auto;
  margin-bottom: 1.25rem;
  filter: brightness(0) invert(1);
  animation: float 4s ease-in-out infinite;
}

.auth-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--coel-white);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.auth-header p {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 400;
}

/* ============================================
   FORM CONTAINER
   ============================================ */
.auth-form-container {
  padding: 2rem 2rem 2.5rem;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--coel-radius);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideInRight 0.4s ease;
}

.alert-error {
  background: var(--coel-error-light);
  color: var(--coel-error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert i {
  font-size: 1.1rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

/* ============================================
   FORM
   ============================================ */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  animation: fadeInUp 0.5s ease both;
}

.form-group:nth-child(1) { animation-delay: 0.15s; }
.form-group:nth-child(2) { animation-delay: 0.25s; }

.form-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--coel-gray-700);
  margin-bottom: 0.5rem;
}

.form-group label i {
  color: var(--coel-primary);
  font-size: 0.875rem;
  width: 16px;
  text-align: center;
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--coel-gray-200);
  border-radius: var(--coel-radius);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--coel-gray-800);
  background: var(--coel-gray-50);
  transition: var(--coel-transition);
  outline: none;
}

.form-input::placeholder {
  color: var(--coel-gray-400);
  font-weight: 400;
}

.form-input:hover {
  border-color: var(--coel-gray-300);
}

.form-input:focus {
  border-color: var(--coel-primary);
  background: var(--coel-white);
  box-shadow: 0 0 0 4px rgba(1, 161, 126, 0.1);
}

/* ============================================
   PASSWORD INPUT
   ============================================ */
.password-input {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--coel-gray-400);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--coel-radius-sm);
  transition: var(--coel-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: var(--coel-primary);
  background: var(--coel-primary-light);
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.9);
}

/* ============================================
   FORM OPTIONS
   ============================================ */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: -0.25rem;
}

/* Checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--coel-gray-600);
  font-weight: 500;
  user-select: none;
}

.checkbox-container input {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--coel-gray-300);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--coel-transition);
  flex-shrink: 0;
}

.checkbox-container:hover .checkmark {
  border-color: var(--coel-primary);
}

.checkbox-container input:checked + .checkmark {
  background: var(--coel-primary);
  border-color: var(--coel-primary);
}

.checkbox-container input:checked + .checkmark::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--coel-white);
  font-size: 0.65rem;
}

.forgot-password {
  color: var(--coel-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--coel-transition);
}

.forgot-password:hover {
  color: var(--coel-primary-dark);
  text-decoration: underline;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary-auth {
  width: 100%;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--coel-radius);
  background: linear-gradient(135deg, var(--coel-primary) 0%, var(--coel-primary-dark) 100%);
  color: var(--coel-white);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--coel-transition);
  box-shadow: 0 4px 14px rgba(1, 161, 126, 0.35);
  position: relative;
  overflow: hidden;
  margin-top: 0.5rem;
}

.btn-primary-auth::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn-primary-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(1, 161, 126, 0.45);
}

.btn-primary-auth:hover::before {
  transform: translateX(100%);
}

.btn-primary-auth:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(1, 161, 126, 0.3);
}

.btn-primary-auth:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   VALIDATION STATES
   ============================================ */
.form-group.error .form-input {
  border-color: var(--coel-error);
  background: var(--coel-error-light);
  animation: shake 0.4s ease;
}

.form-group.success .form-input {
  border-color: var(--coel-success);
  background: var(--coel-success-light);
}

.error-message {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  color: var(--coel-error);
  margin-top: 0.375rem;
  font-weight: 500;
  animation: fadeIn 0.3s ease;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  padding: 1rem 1.5rem;
  border-radius: var(--coel-radius);
  color: var(--coel-white);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--coel-shadow-xl);
  transform: translateX(calc(100% + 2rem));
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}

.toast.show {
  transform: translateX(0);
}

.toast-success { background: var(--coel-success); }
.toast-error { background: var(--coel-error); }
.toast-warning { background: #f59e0b; }
.toast-info { background: var(--coel-primary); }

/* ============================================
   RESPONSIVE - TABLET (640px+)
   ============================================ */
@media (min-width: 640px) {
  .auth-container {
    padding: 2rem;
  }

  .auth-card {
    max-width: 460px;
  }

  .auth-header {
    padding: 3rem 2.5rem 2.5rem;
  }

  .auth-header h1 {
    font-size: 2rem;
  }

  .auth-header p {
    font-size: 1rem;
  }

  .brand-logo {
    height: 60px;
  }

  .auth-form-container {
    padding: 2.5rem;
  }

  .back-link {
    top: 1.5rem;
    left: 1.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }
}

/* ============================================
   RESPONSIVE - DESKTOP (768px+)
   ============================================ */
@media (min-width: 768px) {
  .auth-container {
    padding: 2.5rem;
  }

  .auth-card {
    max-width: 480px;
    border-radius: var(--coel-radius-xl);
  }

  .auth-header {
    padding: 3.5rem 3rem 3rem;
  }

  .auth-header h1 {
    font-size: 2.25rem;
  }

  .brand-logo {
    height: 65px;
  }

  .auth-form-container {
    padding: 2.5rem 3rem 3rem;
  }

  .form-input {
    padding: 1rem 1.125rem;
    font-size: 1rem;
  }

  .btn-primary-auth {
    padding: 1rem 2rem;
    font-size: 1.05rem;
  }
}

/* ============================================
   RESPONSIVE - LARGE DESKTOP (1024px+)
   ============================================ */
@media (min-width: 1024px) {
  .auth-card {
    max-width: 500px;
  }

  .auth-header {
    padding: 4rem 3rem 3.5rem;
  }

  .auth-header h1 {
    font-size: 2.5rem;
  }

  .brand-logo {
    height: 70px;
  }
}

/* ============================================
   MOBILE OPTIMIZATIONS (< 640px)
   ============================================ */
@media (max-width: 639px) {
  .auth-container {
    padding: 0.5rem;
    align-items: flex-start;
    padding-top: 3.5rem;
  }

  .auth-card {
    border-radius: var(--coel-radius-lg);
    max-width: 100%;
  }

  .auth-header {
    padding: 2rem 1.5rem 1.75rem;
  }

  .auth-header::after {
    height: 30px;
  }

  .auth-header h1 {
    font-size: 1.5rem;
  }

  .auth-header p {
    font-size: 0.875rem;
  }

  .brand-logo {
    height: 42px;
    margin-bottom: 1rem;
  }

  .auth-form-container {
    padding: 1.5rem;
  }

  .auth-form {
    gap: 1rem;
  }

  .form-group label {
    font-size: 0.85rem;
  }

  .form-input {
    padding: 0.75rem 0.875rem;
    font-size: 16px; /* Previene zoom en iOS */
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
  }

  .btn-primary-auth {
    padding: 0.875rem;
    font-size: 0.95rem;
  }

  .back-link {
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
  }

  .back-link span {
    display: none;
  }

  .alert {
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
  }

  .toast {
    left: 1rem;
    right: 1rem;
    max-width: none;
    transform: translateY(calc(-100% - 1rem));
  }

  .toast.show {
    transform: translateY(0);
  }
}

/* ============================================
   SMALL MOBILE (< 380px)
   ============================================ */
@media (max-width: 379px) {
  .auth-container {
    padding: 0.25rem;
    padding-top: 3rem;
  }

  .auth-card {
    border-radius: var(--coel-radius);
  }

  .auth-header {
    padding: 1.5rem 1.25rem 1.5rem;
  }

  .auth-header h1 {
    font-size: 1.35rem;
  }

  .brand-logo {
    height: 38px;
  }

  .auth-form-container {
    padding: 1.25rem;
  }

  .form-input {
    padding: 0.625rem 0.75rem;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   FOCUS VISIBLE
   ============================================ */
*:focus-visible {
  outline: 2px solid var(--coel-primary);
  outline-offset: 2px;
}

/* ============================================
   LOADING STATE
   ============================================ */
.btn-primary-auth .fa-spinner {
  animation: spin 0.8s linear infinite;
}