/* ===== Login Page ===== */
.login-page {
  display: flex;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Left Panel - Brand */
.login-brand {
  flex: 0 0 42%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--login-brand-start, #2c3e7a) 0%, var(--login-brand-end, #1a2548) 100%);
  color: #fff;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.login-brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.login-brand-logo {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
}

.login-brand-logo span {
  font-weight: 300;
  opacity: 0.8;
}

.login-brand-tagline {
  font-size: 1.1rem;
  opacity: 0.75;
  font-weight: 300;
  max-width: 300px;
  line-height: 1.6;
}

.login-brand-features {
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
  text-align: left;
}

.login-brand-features li {
  padding: 0.5rem 0;
  font-size: 0.95rem;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.login-brand-features li i {
  font-size: 1.2rem;
  opacity: 0.9;
}

/* Right Panel - Form */
.login-form-panel {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  padding: 2rem;
}

.login-form-container {
  width: 100%;
  max-width: 420px;
}

.login-form-header {
  margin-bottom: 2rem;
}

.login-form-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

.login-form-header p {
  color: #6c757d;
  font-size: 0.95rem;
  margin: 0;
}

/* Login Method Tabs */
.login-method-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 0;
}

.login-method-tab {
  padding: 0.625rem 1rem;
  border: none;
  background: none;
  color: #6c757d;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.login-method-tab:hover {
  color: #495057;
}

.login-method-tab.active {
  color: var(--login-accent, #2c3e7a);
  border-bottom-color: var(--login-accent, #2c3e7a);
  font-weight: 500;
}

.login-method-tab i {
  font-size: 1.1rem;
}

/* Form Panels */
.login-panels-body {
  display: grid;
}

.login-panels-body > .login-panel {
  grid-area: 1 / 1;
  opacity: 0;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  visibility: hidden;
}

.login-panels-body > .login-panel.active {
  opacity: 1;
  pointer-events: auto;
  user-select: auto;
  visibility: visible;
  transition: opacity 0.2s ease, visibility 0s linear 0s;
}

/* Form Controls */
.login-form .form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: #495057;
}

.login-form .form-control {
  padding: 0.625rem 0.875rem;
  border-radius: 8px;
  border: 1.5px solid #dee2e6;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form .form-control:focus {
  border-color: var(--login-accent, #2c3e7a);
  box-shadow: 0 0 0 3px rgba(44, 62, 122, 0.1);
}

.login-form .input-group-text {
  background: #f8f9fa;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  color: #6c757d;
}

/* Narrow-only form brand logo */
.login-form-brand {
  display: none;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--login-accent, #2c3e7a);
  letter-spacing: 1px;
  margin-bottom: 1.25rem;
}

.login-form-brand span {
  font-weight: 300;
  opacity: 0.6;
}

/* Captcha */
.captcha-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#captcha-image {
  cursor: pointer;
}

.captcha-image {
  background: linear-gradient(135deg, #e3e7f1 0%, #d5dae8 100%);
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 6px;
  color: #2c3e7a;
  user-select: none;
  position: relative;
  min-width: 120px;
  text-align: center;
}

.captcha-image::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 10%;
  right: 10%;
  height: 1px;
  background: rgba(44, 62, 122, 0.3);
  transform: rotate(-5deg);
}

.captcha-refresh {
  border: none;
  background: none;
  color: #6c757d;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.2rem;
  transition: transform 0.3s;
}

.captcha-refresh:hover {
  transform: rotate(180deg);
  color: var(--login-accent, #2c3e7a);
}

/* Login Button */
.btn-login {
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  color: #fff;
  background: var(--login-accent, #2c3e7a);
  transition: opacity 0.2s, transform 0.1s;
}

.btn-login:hover {
  background: var(--login-accent, #2c3e7a) !important;
  color: #fff !important;
  filter: brightness(0.85);
}

.btn-login:active {
  transform: scale(0.98);
}

/* Passkey */
.passkey-container {
  text-align: center;
  padding: 2rem 0;
}

.passkey-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0f4ff 0%, #e3e7f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
  color: var(--login-accent, #2c3e7a);
}

.passkey-container h4 {
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

.passkey-container p {
  color: #6c757d;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.btn-passkey {
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  border: 2px solid var(--login-accent, #2c3e7a);
  color: var(--login-accent, #2c3e7a);
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-passkey:hover {
  background: var(--login-accent, #2c3e7a);
  color: #fff;
}

/* Email Token */
.email-token-step {
  display: none;
}

.email-token-step.active {
  display: block;
}

.token-sent-info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: #0369a1;
}

.token-sent-info i {
  margin-right: 0.5rem;
}

.token-countdown {
  font-weight: 600;
  color: #dc3545;
  font-size: 0.95rem;
}

.token-input-group {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.token-input-group input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.token-input-group input:focus {
  border-color: var(--login-accent, #2c3e7a);
  box-shadow: 0 0 0 3px rgba(44, 62, 122, 0.1);
}

/* 2FA */
.twofa-container {
  text-align: center;
}

.twofa-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
  color: #92400e;
}

.twofa-code-input {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.twofa-code-input input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.twofa-code-input input:focus {
  border-color: var(--login-accent, #2c3e7a);
}

/* Footer */
.login-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: #adb5bd;
}


/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Loading spinner for buttons */
.btn-login.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-login.loading::after {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Social Login */
.login-social {
  margin-top: 1.5rem;
}

.login-social-divider {
  display: flex;
  align-items: center;
  margin-bottom: 1.25rem;
}

.login-social-divider::before,
.login-social-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #dee2e6;
}

.login-social-divider span {
  padding: 0 1rem;
  font-size: 0.825rem;
  color: #adb5bd;
  white-space: nowrap;
}

.login-social-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-social {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.5rem;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  background: #fff;
  color: #495057;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-social:hover {
  border-color: #adb5bd;
  background: #f8f9fa;
}

.btn-social-google:hover { border-color: #4285F4; color: #4285F4; }
.btn-social-microsoft:hover { border-color: #00A4EF; color: #00A4EF; }
.btn-social-line:hover { border-color: #06C755; color: #06C755; }
.btn-social-apple:hover { border-color: #000; color: #000; }

/* Responsive */

/* Medium (768-991px)：Brand 縮為頂部橫幅，Form 全寬 */
@media (min-width: 768px) and (max-width: 991.98px) {
  .login-page {
    flex-direction: column;
  }

  .login-brand {
    flex: none;
    flex-direction: row;
    padding: 3rem 2rem;
    justify-content: center;
    align-items: center;
  }

  .login-brand-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.75rem;
    text-align: left;
  }

  .login-brand-logo {
    font-size: 2.25rem;
    margin-bottom: 0;
  }

  .login-brand-tagline {
    font-size: 1rem;
    margin: 0;
    max-width: none;
  }

  .login-brand-features {
    display: none;
  }

  .login-form-panel {
    flex: 1;
    padding: 2rem;
  }
}

/* Narrow (<768px)：Brand 縮為緊湊頂部橫幅，驗證碼換行 */
@media (max-width: 767.98px) {
  .login-page {
    flex-direction: column;
  }

  .login-brand {
    flex: none;
    flex-direction: row;
    padding: 1rem 1.5rem;
    justify-content: center;
    align-items: center;
  }

  .login-brand-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
  }

  .login-brand-logo {
    font-size: 1.6rem;
    margin-bottom: 0;
  }

  .login-brand-tagline {
    font-size: 0.85rem;
    margin: 0;
    max-width: none;
  }

  .login-brand-features {
    display: none;
  }

  .login-form-panel {
    padding: 1.5rem;
  }

  .login-method-tabs {
    overflow-x: auto;
  }

  .login-method-tab {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }

}
