/* ========================================
   QMS 登录页面样式
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.login-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #1890ff 100%);
  position: relative;
  overflow: hidden;
}

/* Background decoration */
.login-bg-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.login-bg-shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
  filter: blur(40px);
}

.login-bg-shape.shape-1 {
  width: 500px;
  height: 500px;
  background: #fff;
  top: -150px;
  left: -100px;
  animation: floatShape 20s ease-in-out infinite;
}

.login-bg-shape.shape-2 {
  width: 400px;
  height: 400px;
  background: #fff;
  bottom: -100px;
  right: -80px;
  animation: floatShape 25s ease-in-out infinite reverse;
}

.login-bg-shape.shape-3 {
  width: 300px;
  height: 300px;
  background: #4facfe;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: floatShape 30s ease-in-out infinite;
}

@keyframes floatShape {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.login-bg-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* Login wrapper */
.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 420px;
  animation: loginFadeIn 0.8s ease-out;
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login card */
.login-card {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 18px;
  padding: 32px 32px 28px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2, #1890ff, #667eea);
  background-size: 300% 100%;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Login header */
.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.login-logo-img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: contain;
  background: #f5f7fa;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(24, 144, 255, 0.25);
}

.login-logo-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow:
    0 10px 30px rgba(102, 126, 234, 0.4),
    0 0 0 4px rgba(102, 126, 234, 0.1);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4), 0 0 0 4px rgba(102, 126, 234, 0.1); }
  50% { box-shadow: 0 10px 40px rgba(102, 126, 234, 0.5), 0 0 0 8px rgba(102, 126, 234, 0.08); }
}

.login-title {
  margin: 0 0 10px 0;
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: -0.5px;
}

.login-subtitle {
  margin: 0;
  font-size: 14px;
  color: #8892b0;
  font-weight: 400;
}

/* Login error message */
.login-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fff1f0 0%, #fff5f5 100%);
  border: 1px solid #ffccc7;
  border-radius: 10px;
  color: #cf1322;
  font-size: 13px;
  margin-bottom: 20px;
  animation: errorShake 0.4s ease-out, fadeInUp 0.3s ease-out;
  transition: all 0.3s ease;
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-error svg { flex-shrink: 0; }

/* Login form */
.login-form { margin-bottom: 24px; }
.login-form-item { margin-bottom: 20px; }

.login-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #4a5568;
  margin-bottom: 8px;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  color: #a0aec0;
  display: flex;
  align-items: center;
  transition: color 0.3s ease;
  pointer-events: none;
}

.login-input-wrap.focused .login-input-icon { color: #667eea; }

.login-input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 44px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  color: #2d3748;
  background: #f8fafc;
  transition: all 0.3s ease;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}

.login-input::placeholder { color: #a0aec0; }
.login-input:hover { border-color: #cbd5e0; background: #fff; }
.login-input:focus {
  border-color: #667eea;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.12);
}

.login-password-toggle {
  position: absolute;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #a0aec0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.login-password-toggle:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.08);
}

.login-btn {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  letter-spacing: 2px;
  font-family: inherit;
}

.login-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.6s ease;
}

.login-btn:hover::before { left: 100%; }
.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}
.login-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}
.login-btn.loading { opacity: 0.8; cursor: not-allowed; }
.login-btn .login-btn-loading { display: none; }
.login-btn.loading .login-btn-text { display: none; }
.login-btn.loading .login-btn-loading { display: flex !important; align-items: center; justify-content: center; gap: 8px; }

.login-spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login footer */
.login-footer {
  text-align: center;
  color: #a0aec0;
  font-size: 12px;
  padding-top: 20px;
  border-top: 1px solid #edf2f7;
}
.login-footer p { margin: 0; }

.login-beian {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  text-align: center;
  color: #7d8598;
  font-size: 12px;
  line-height: 1.7;
}
.login-beian p { margin: 0; line-height: 1.7; }
.login-beian a { color: #7d8598; text-decoration: none; transition: color 0.2s ease; }
.login-beian a:hover { color: #1890ff; }
.login-beian a .beian-svg { vertical-align: -2px; margin-right: 4px; }

.login-footer-bottom {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-top: 28px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  line-height: 2;
  padding: 0 20px 10px 20px;
}
.login-footer-bottom a { color: rgba(255, 255, 255, 0.9); text-decoration: none; transition: color 0.2s ease; }
.login-footer-bottom a:hover { color: #fff; text-decoration: underline; }

/* Divider & Feishu */
.login-divider {
  position: relative;
  text-align: center;
  margin: 20px 0 16px;
  color: #98a2b8;
  font-size: 12px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
}
.login-divider::before { left: 0; }
.login-divider::after { right: 0; }

.login-feishu-section { margin-bottom: 4px; }

.login-feishu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  border: 1px solid #cfd8e3;
  border-radius: 12px;
  background: #fff;
  color: #3370ff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.login-feishu-btn:hover {
  background: linear-gradient(135deg, #3370ff 0%, #2d64e3 100%);
  color: #fff;
  border-color: #3370ff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(51,112,255,0.25);
}
.login-feishu-btn svg { flex-shrink: 0; }

/* Responsive */
@media (max-width: 480px) {
  .login-wrapper { padding: 10px; align-items: flex-start; padding-top: 30px; }
  .login-card { padding: 28px 22px; border-radius: 16px; }
  .login-header { margin-bottom: 24px; }
  .login-logo-img, .login-logo-icon { width: 60px; height: 60px; border-radius: 14px; }
  .login-title { font-size: 20px; }
  .login-subtitle { font-size: 13px; }
  .login-form-item { margin-bottom: 16px; }
  .login-input { height: 44px; }
  .login-btn { height: 46px; font-size: 15px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .login-wrapper { align-items: flex-start; padding: 10px; }
  .login-card { padding: 20px; }
  .login-header { margin-bottom: 16px; }
  .login-logo { margin-bottom: 12px; }
  .login-logo-img, .login-logo-icon { width: 48px; height: 48px; border-radius: 12px; }
  .login-title { font-size: 18px; margin-bottom: 4px; }
  .login-form-item { margin-bottom: 12px; }
}