/* ========================================
   IMPORTAR FUENTE
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ========================================
   VARIABLES CSS
   ======================================== */
:root {
  /* Colores */
  --primary: #1e293b;
  --primary-light: #334155;
  --primary-dark: #0f172a;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  
  --success: #10b981;
  --error: #ef4444;
  
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Espaciado */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  
  /* Border radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ========================================
   RESET BÁSICO
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--gray-800);
  line-height: 1.6;
}

/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ========================================
   TARJETA DE LOGIN
   ======================================== */
.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   HEADER
   ======================================== */
.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.icon-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.lock-icon {
  width: 28px;
  height: 28px;
  color: var(--white);
  stroke: currentColor;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.login-subtitle {
  font-size: 0.9375rem;
  color: var(--gray-600);
  font-weight: 400;
}

/* ========================================
   ALERTAS
   ======================================== */
.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-error .alert-icon {
  color: var(--error);
}

.alert-success {
  background: #f0fdf4;
  color: #065f46;
  border: 1px solid #bbf7d0;
}

.alert-success .alert-icon {
  color: var(--success);
}

/* ========================================
   FORMULARIO
   ======================================== */
.login-form {
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--gray-400);
  pointer-events: none;
  z-index: 1;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--gray-900);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  outline: none;
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:focus ~ .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--accent);
}

/* ========================================
   BOTONES
   ======================================== */
.btn {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  text-align: center;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--white);
  box-shadow: 0 4px 12px rgba(30, 41, 59, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(30, 41, 59, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(30, 41, 59, 0.3);
}

.btn-secondary {
  background: var(--white);
  color: var(--primary);
  border: 2px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary:active {
  transform: translateY(0);
  background: var(--gray-100);
}

/* ========================================
   DIVISOR
   ======================================== */
.divider {
  position: relative;
  text-align: center;
  margin: 1.5rem 0;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gray-200);
}

.divider span {
  position: relative;
  display: inline-block;
  padding: 0 1rem;
  background: var(--white);
  color: var(--gray-400);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ========================================
   SECCIÓN DE REGISTRO
   ======================================== */
.register-section {
  text-align: center;
  margin-bottom: 1.5rem;
}

.register-text {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: 1rem;
  font-weight: 500;
}

/* ========================================
   FOOTER
   ======================================== */
.login-footer {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-100);
}

.footer-link {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */

/* Móviles pequeños */
@media (max-width: 374px) {
  .login-card {
    padding: 1.5rem;
  }
  
  .icon-container {
    width: 50px;
    height: 50px;
  }
  
  .lock-icon {
    width: 24px;
    height: 24px;
  }
  
  .login-title {
    font-size: 1.5rem;
  }
  
  .form-input {
    font-size: 16px; /* Evita zoom en iOS */
  }
}

/* Móviles estándar (iPhone, Android) */
@media (min-width: 375px) and (max-width: 767px) {
  .login-card {
    padding: 2rem 1.5rem;
  }
  
  .form-input {
    font-size: 16px; /* Evita zoom en iOS */
    padding: 0.875rem 1rem 0.875rem 2.75rem;
  }
  
  .btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }
}

/* Tablets */
@media (min-width: 768px) {
  .login-container {
    padding: 2rem;
  }
  
  .login-card {
    max-width: 480px;
    padding: 2.5rem;
  }
  
  .login-header {
    margin-bottom: 2.5rem;
  }
  
  .icon-container {
    width: 70px;
    height: 70px;
  }
  
  .lock-icon {
    width: 32px;
    height: 32px;
  }
  
  .login-title {
    font-size: 2rem;
  }
  
  .login-subtitle {
    font-size: 1rem;
  }
  
  .form-input {
    padding: 1rem 1.25rem 1rem 3rem;
    font-size: 1rem;
  }
  
  .btn {
    padding: 1rem 1.75rem;
    font-size: 1rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .login-card {
    max-width: 500px;
  }
  
  .login-card:hover {
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.3);
    transform: translateY(-4px);
    transition: all 0.3s ease;
  }
}

/* ========================================
   ACCESIBILIDAD
   ======================================== */

/* Focus visible mejorado */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   UTILIDADES
   ======================================== */
.text-center {
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}