/*=============================================
=        Login 2-Step Flow — Styles            =
=    Load order: Bootstrap → app-colors → this  =
=    ALL colors via --color-* variables         =
=============================================*/

/* ---------- Page Background ---------- */
.bg-login {
  margin: 0;
  background: var(--color-background) url('../images/bg-login.svg') center / cover no-repeat fixed;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Language Switcher ---------- */
.login-lang-switcher {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 0px));
  right: max(20px, env(safe-area-inset-right, 0px));
  z-index: 1050;
}

.login-lang-switcher .btn-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.85) !important;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.login-lang-switcher .btn-lang i {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}

.login-lang-switcher .btn-lang:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  transform: translateY(-1px);
}

.login-lang-switcher .btn-lang:hover i {
  transform: rotate(20deg);
}

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

.login-lang-switcher .btn-lang:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

/* ---------- Container & Card ---------- */
.login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 450px;
  padding: 40px 32px 32px;
  position: relative;

  /* Card entrance animation */
  animation: loginCardIn 0.5s ease-out both;
}

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

/* ---------- Logo ---------- */
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo img {
  height: 48px;
}

/* ---------- Step Panels ---------- */
.login-step {
  display: none;

  /* Step transition: fade + slight slide */
  animation: stepFadeIn 0.3s ease-out both;
}

.login-step.active {
  display: block;
}

@keyframes stepFadeIn {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---------- Typography ---------- */
.login-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-link-blue);
}

.login-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-gray-dark);
  margin-bottom: 24px;
}

/* ---------- Form Elements ---------- */
.login-input-group {
  position: relative;
  margin-bottom: 16px;
}

.login-input-group .form-control {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  border: 1px solid var(--color-gray-light);
  border-radius: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
  color: var(--color-primary-dark);
}

.login-input-group .form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(34, 57, 118, 0.18);
  outline: none;
}

/* Shake animation for invalid input */
.login-input-group.shake .form-control {
  animation: shakeInput 0.4s ease-out;
  border-color: var(--color-deficiency-text);
}

@keyframes shakeInput {
  0%, 100% { transform: translateX(0); }
  15%  { transform: translateX(-6px); }
  30%  { transform: translateX(6px); }
  45%  { transform: translateX(-4px); }
  60%  { transform: translateX(4px); }
  75%  { transform: translateX(-2px); }
  90%  { transform: translateX(2px); }
}

/* ---------- Next / Submit Button ---------- */
.btn-login-next {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
  margin-bottom: 20px;
}

.btn-login-next:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.btn-login-next:focus-visible {
  outline: 3px solid rgba(34, 57, 118, 0.45);
  outline-offset: 2px;
}

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

.btn-login-next:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Button loading spinner */
.btn-login-next .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: button-spin 0.6s linear infinite;
}

.btn-login-next.loading .spinner {
  display: inline-block;
}

.btn-login-next.loading .btn-text {
  display: none;
}

@keyframes button-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ---------- Forgot Password Link ---------- */
.forgot-link {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--color-link-blue);
  text-decoration: none;
  margin-bottom: 20px;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

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

.forgot-link:focus-visible {
  outline: 2px solid var(--color-link-blue);
  outline-offset: 2px;
}

/* ---------- Divider ("or") ---------- */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--color-gray-dark);
  font-size: 0.85rem;
  text-transform: uppercase;
}

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

/* ---------- Google Login Button ---------- */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  background: #fff;
  border: 1px solid var(--color-gray-light);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-gray-dark);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 12px;
}

.btn-google:hover {
  background: var(--color-gray-lightest);
  border-color: #d1d5db;
  color: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.btn-google:focus-visible {
  outline: 3px solid rgba(34, 57, 118, 0.2);
  outline-offset: 2px;
}

.btn-google i {
  font-size: 1.2rem;
}

/* ---------- Facebook Login Button ---------- */
.btn-facebook {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  background: #fff;
  border: 1px solid var(--color-gray-light);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-gray-dark);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 24px;
}

.btn-facebook:hover {
  background: var(--color-gray-lightest);
  border-color: #d1d5db;
  color: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.btn-facebook:focus-visible {
  outline: 3px solid rgba(24, 119, 242, 0.2);
  outline-offset: 2px;
}

.btn-facebook i {
  font-size: 1.2rem;
  color: #1877f2 !important;
}

/* ---------- Register Link ---------- */
.register-link {
  text-align: center;
  font-size: 0.88rem;
  color: var(--color-gray-dark);
}

.register-link a {
  color: var(--color-link-blue);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

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

.register-link a:focus-visible {
  outline: 2px solid var(--color-link-blue);
  outline-offset: 2px;
}

/* ---------- Email Chip (Step 2) ---------- */
.email-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-gray-lightest);
  border: 1px solid var(--color-gray-light);
  border-radius: 20px;
  padding: 6px 14px 6px 14px;
  font-size: 0.88rem;
  color: var(--color-primary-dark);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  margin-bottom: 20px;
  max-width: 100%;

  /* Scale-in animation */
  animation: chipScaleIn 0.35s ease-out both;
}

@keyframes chipScaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.email-chip:hover {
  background: var(--color-white);
  border-color: var(--color-primary);
  transform: scale(1.03);
}

.email-chip:focus-visible {
  outline: 3px solid rgba(34, 57, 118, 0.35);
  outline-offset: 2px;
}

.email-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.email-chip-icon {
  font-size: 0.8rem;
  color: var(--color-gray-dark);
  flex-shrink: 0;
}

/* ---------- Password Toggle ---------- */
.toggle-password {
  position: absolute;
  right: 8px;
  top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  padding: 0;
  color: var(--color-gray-dark);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  z-index: 2;
  border-radius: 6px;
}

.toggle-password i {
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  text-align: center;
}

.toggle-password:hover {
  color: var(--color-primary);
  background: var(--color-gray-lightest);
}

.toggle-password:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ---------- Footer (in-flow, pushed to bottom by flex body) ---------- */
.login-footer {
  text-align: center;
  padding: 16px 20px;
  font-size: 0.82rem;
  background: none;
}

.login-footer a {
  color: #fff;
  text-decoration: none;
  transition: opacity 0.2s ease, text-decoration 0.2s ease;
  margin: 0 10px;
}

.login-footer a:hover {
  color: var(--color-blue-light) !important; 
  text-decoration: underline;
}

.login-footer a:focus-visible {
  outline: 2px solid var(--color-blue-light) !important;
  outline-offset: 2px;
}

.login-footer span {
  color: rgba(255, 255, 255, 0.5);
}


/* ---------- Noscript Banner ---------- */
noscript .noscript-banner {
  display: block;
}

.noscript-banner {
  display: none;
  background: var(--color-yellow-bg);
  color: var(--color-yellow-text);
  text-align: center;
  padding: 10px;
  font-size: 0.88rem;
  border-bottom: 2px solid var(--color-yellow-text);
}

/* ---------- Responsive ---------- */
@media (max-width: 576px) {
  .bg-login {
    background-attachment: scroll;
  }

  .login-container {
    padding: max(16px, env(safe-area-inset-top, 0px)) 12px max(16px, env(safe-area-inset-bottom, 0px));
  }

  .login-card {
    max-width: 100%;
    border-radius: 0;
    padding: 32px 20px 24px;
  }

  .login-heading {
    font-size: 1.35rem;
  }

  .login-subtitle {
    font-size: 0.9rem;
  }

  .login-lang-switcher {
    top: max(10px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
  }

  .email-chip-text {
    max-width: 200px;
  }

  .login-footer {
    padding: 12px 16px 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
  }
}
