/* ============================================
   LOGIN - CIMA Sistema Institucional
   ============================================ */

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

.login-body {
  font-family: var(--font-primary);
  background: var(--color-bg-main);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

/* ============================================
   WRAPPER PRINCIPAL
   ============================================ */

.login-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ============================================
   PANEL IZQUIERDO - BRANDING
   ============================================ */

.login-brand {
  flex: 0 0 45%;
  background: linear-gradient(160deg, var(--color-navy) 0%, #002d5a 50%, #0056b3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
}

.login-brand-content {
  position: relative;
  z-index: 2;
  max-width: 380px;
  width: 100%;
}

.login-logo {
  width: 200px;
  /* Logo ya es blanco/transparente — sin filter */
  filter: none;
  margin-bottom: 32px;
  display: block;
}

.login-brand-title {
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
  color: rgba(255,255,255,0.95);
  line-height: 1.3;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.login-brand-subtitle {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.55);
  margin-bottom: 48px;
  font-weight: var(--font-weight-medium);
}

.login-brand-features {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(255,255,255,0.8);
  font-size: 0.875rem;
  font-weight: var(--font-weight-medium);
}

.feature-icon {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

/* Decoraciones de fondo */
.login-brand-decor {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.decor-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.decor-1 {
  width: 350px;
  height: 350px;
  top: -80px;
  right: -100px;
}

.decor-2 {
  width: 220px;
  height: 220px;
  bottom: 40px;
  left: -60px;
}

.decor-3 {
  width: 140px;
  height: 140px;
  bottom: 180px;
  right: 30px;
}

/* ============================================
   PANEL DERECHO - FORMULARIO
   ============================================ */

.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  background: #ffffff;
}

.login-form-container {
  width: 100%;
  max-width: 420px;
}

.login-form-header {
  margin-bottom: 32px;
}

.login-form-header h2 {
  font-size: 1.875rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-navy);
  margin-bottom: 8px;
  letter-spacing: -0.4px;
}

.login-form-header p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ============================================
   ALERTAS
   ============================================ */

.login-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: var(--font-weight-medium);
  margin-bottom: 24px;
  animation: alertSlideIn 0.25s ease;
}

.login-alert.hidden {
  display: none;
}

.login-alert-error {
  background: rgba(220, 53, 69, 0.08);
  border: 1px solid rgba(220, 53, 69, 0.2);
  color: #b91c1c;
}

.login-alert-success {
  background: rgba(40, 167, 69, 0.08);
  border: 1px solid rgba(40, 167, 69, 0.2);
  color: #15803d;
}

.alert-icon {
  font-size: 16px;
  flex-shrink: 0;
}

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

/* ============================================
   GRUPOS DE FORMULARIO
   ============================================ */

.form-group {
  margin-bottom: 24px;
  position: relative;
}

.form-group::before {
  content: '';
  display: block;
  width: 3px;
  height: calc(100% - 28px);
  background: linear-gradient(180deg, #001f3f, #0056b3);
  border-radius: 2px;
  position: absolute;
  left: -16px;
  top: 28px;
  opacity: 0;
  transition: opacity 0.2s;
}

.form-group:focus-within::before {
  opacity: 1;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: var(--font-weight-bold);
  color: #1a2a45;
  margin-bottom: 8px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.label-icon {
  font-size: 14px;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #001f3f, #0056b3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.form-input {
  width: 100%;
  padding: 14px 44px 14px 16px;
  border: 2px solid #dce3ef;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font-primary);
  color: #1a2a45;
  background: #f8faff;
  transition: all var(--transition-fast);
  outline: none;
  letter-spacing: 0.2px;
}

.form-input::placeholder {
  color: #9aabc2;
  font-size: 0.9rem;
}

.form-input:focus {
  border-color: var(--color-navy);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 31, 63, 0.1);
}

.form-input.input-error {
  border-color: #dc3545;
  background: #fff5f5;
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.08);
}

.form-input.input-valid {
  border-color: #28a745;
  background: #f6fff8;
}

.input-status {
  position: absolute;
  right: 44px;
  font-size: 16px;
  pointer-events: none;
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: var(--radius-xs);
  opacity: 0.6;
  transition: opacity var(--transition-fast);
  line-height: 1;
}

.toggle-password:hover {
  opacity: 1;
}

.form-hint {
  font-size: 0.78rem;
  color: #dc3545;
  margin-top: 6px;
}

.form-hint.hidden {
  display: none;
}

/* ============================================
   OPCIONES DEL FORMULARIO
   ============================================ */

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  user-select: none;
}

.remember-me input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--color-border-medium);
  border-radius: 4px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.remember-me input:checked + .checkbox-custom {
  background: var(--color-navy);
  border-color: var(--color-navy);
}

.remember-me input:checked + .checkbox-custom::after {
  content: '✓';
  font-size: 11px;
  color: white;
  font-weight: bold;
}

.forgot-link {
  font-size: 0.875rem;
  color: var(--color-accent);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  transition: color var(--transition-fast);
}

.forgot-link:hover {
  color: var(--color-navy);
  text-decoration: underline;
}

/* ============================================
   BOTONES
   ============================================ */

.btn-login {
  width: 100%;
  padding: 14px 24px;
  background: var(--color-navy);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: 0.2px;
  margin-bottom: 20px;
}

.btn-login:hover:not(:disabled) {
  background: #002d5a;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 31, 63, 0.25);
}

.btn-login:active {
  transform: translateY(0);
}

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

.btn-text {
  transition: opacity var(--transition-fast);
}

.btn-loader {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-loader.hidden {
  display: none;
}

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

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

/* Divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border-light);
}

/* Botón SSO */
.btn-sso {
  width: 100%;
  padding: 12px 24px;
  background: white;
  color: var(--color-text-primary);
  border: 1.5px solid var(--color-border-medium);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: var(--font-weight-medium);
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-sso:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-navy);
  transform: translateY(-1px);
}

.sso-icon {
  font-size: 18px;
}

/* ============================================
   FOOTER DEL FORMULARIO
   ============================================ */

.login-form-footer {
  margin-top: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-form-footer p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.login-form-footer a {
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
}

.login-form-footer a:hover {
  text-decoration: underline;
}

.login-version {
  font-size: 0.75rem !important;
  color: var(--color-text-disabled) !important;
  margin-top: 4px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .login-brand {
    flex: 0 0 40%;
    padding: 48px 36px;
  }

  .login-form-panel {
    padding: 48px 36px;
  }
}

@media (max-width: 768px) {
  .login-wrapper {
    flex-direction: column;
  }

  .login-brand {
    flex: none;
    min-height: 240px;
    padding: 40px 32px;
  }

  .login-brand-features {
    display: none;
  }

  .login-brand-title {
    font-size: 1.2rem;
  }

  .login-logo {
    width: 140px;
    margin-bottom: 16px;
  }

  .login-form-panel {
    padding: 40px 24px;
    background: #fafafa;
  }

  .login-form-header h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .login-brand {
    min-height: 180px;
    padding: 32px 20px;
  }

  .login-form-panel {
    padding: 32px 20px;
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}