/* ===================================
   LOGIN PROFESIONAL - FUSIÓN D3
   =================================== */

:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --dark-color: #1e293b;
  --light-color: #f8fafc;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --white: #ffffff;
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --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);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Reset y configuración base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gradient);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  color: var(--text-primary);
}

.h-100 {
  height: 100vh !important;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  text-align: center;
}

/* Main Login Container */
.login-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

/* Sección de Login */
.login-section {
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

.login-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 2rem 0;
}

/* Header del Login */
.login-header {
  margin-bottom: 2.5rem;
}

.company-logo {
  width: 120px;
  height: auto;
  filter: drop-shadow(var(--shadow-sm));
  transition: transform 0.3s ease;
}

.company-logo:hover {
  transform: scale(1.05);
}

.login-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.login-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 0;
}

/* Alertas personalizadas */
.alert-custom {
  border: none;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid;
}

.alert-success {
  background: #f0fdf4;
  color: #15803d;
  border-left-color: var(--success-color);
}

.alert-danger {
  background: #fef2f2;
  color: #dc2626;
  border-left-color: var(--danger-color);
}

/* Formulario */
.login-form {
  margin-bottom: 2rem;
}

.form-group {
  position: relative;
}

.form-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
}

.form-label i {
  color: var(--primary-color);
  font-size: 0.875rem;
}

/* Input personalizado */
.input-wrapper {
  position: relative;
}

.form-control-custom {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--white);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.3s ease;
  outline: none;
}

.form-control-custom::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.form-control-custom:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: #fafbff;
}

.input-wrapper.focused .input-focus-border {
  transform: scaleX(1);
}

.input-focus-border {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  transform: scaleX(0);
  transition: transform 0.3s ease;
  border-radius: 0 0 12px 12px;
}

/* Password toggle */
.password-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.3s ease;
  z-index: 10;
}

.password-toggle:hover {
  color: var(--primary-color);
}

/* Checkbox personalizado */
.form-check {
  margin-bottom: 1.5rem;
}

.form-check-input {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.125rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.form-check-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-left: 0.5rem;
}

/* Botón de login */
.btn-login {
  background: var(--gradient);
  border: none;
  color: var(--white);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.875rem 1.5rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  letter-spacing: 0.025em;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.btn-login:active {
  transform: translateY(0);
  box-shadow: var(--shadow-md);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Footer del login */
.login-footer {
  margin-top: 2rem;
}

.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(--border-color);
}

.divider span {
  background: var(--white);
  padding: 0 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.security-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.security-text i {
  color: var(--success-color);
}

/* Sección de Branding */
.branding-section {
  position: relative;
  overflow: hidden;
}

.branding-content {
  position: relative;
  height: 100%;
}

.branding-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.branding-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.9) 0%,
    rgba(88, 80, 236, 0.9) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.branding-text {
  color: var(--white);
  text-align: center;
  max-width: 500px;
}

.branding-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.branding-subtitle {
  font-size: 1.125rem;
  margin-bottom: 2.5rem;
  opacity: 0.9;
  line-height: 1.6;
}

.branding-features {
  display: grid;
  gap: 1rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.feature-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(10px);
}

.feature-item i {
  font-size: 1.5rem;
  opacity: 0.9;
}

.feature-item span {
  font-weight: 500;
  font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .login-section {
    padding: 1rem;
  }
  
  .login-container {
    padding: 1rem 0;
  }
  
  .login-title {
    font-size: 1.75rem;
  }
  
  .branding-title {
    font-size: 2rem;
  }
  
  .branding-subtitle {
    font-size: 1rem;
  }
  
  .branding-overlay {
    padding: 2rem;
  }
  
  .feature-item {
    padding: 0.75rem;
  }
}

@media (max-width: 576px) {
  .login-title {
    font-size: 1.5rem;
  }
  
  .company-logo {
    width: 100px;
  }
  
  .form-control-custom {
    padding: 0.75rem;
  }
  
  .btn-login {
    padding: 0.75rem 1.25rem;
  }
}

/* Animaciones adicionales */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-container > * {
  animation: fadeInUp 0.6s ease forwards;
}

.login-container > *:nth-child(1) { animation-delay: 0.1s; }
.login-container > *:nth-child(2) { animation-delay: 0.2s; }
.login-container > *:nth-child(3) { animation-delay: 0.3s; }
.login-container > *:nth-child(4) { animation-delay: 0.4s; }

/* Estados de error en inputs */
.form-control-custom.is-invalid {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-control-custom.is-valid {
  border-color: var(--success-color);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Mejoras de accesibilidad */
.form-control-custom:focus,
.btn-login:focus,
.form-check-input:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Dark mode support (opcional) */
@media (prefers-color-scheme: dark) {
  :root {
    --white: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --light-color: #0f172a;
  }
}
