/* =============================================
   LOGIN PAGE — PREMIUM STANDALONE STYLING
   ============================================= */

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.login-page {
  font-family: 'Quicksand', 'Poppins', 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 30%, #0f3460 60%, #e94560 100%);
  background-size: 400% 400%;
  animation: bgShift 15s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

@keyframes bgShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* === FLOATING PARTICLES (Chinese characters) === */
body.login-page::before {
  content: '学 习 中 文 你 好 加 油 努 力';
  position: fixed;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  font-size: 4rem;
  color: rgba(255, 255, 255, 0.03);
  word-spacing: 80px;
  line-height: 2.5;
  letter-spacing: 60px;
  pointer-events: none;
  z-index: 0;
  animation: floatChars 30s linear infinite;
  white-space: pre-wrap;
}

@keyframes floatChars {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-50px, -80px) rotate(3deg); }
}

/* === MAIN CONTAINER === */
.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 15px;
}

/* === BACK LINK === */
.login-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(5px);
}

.login-back-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(-3px);
}

/* === AUTH CARD === */
.login-card {
  background: rgba(255, 255, 255, 0.97);
  border-radius: 20px;
  padding: 35px 30px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: cardSlideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #d32f2f, #ff5252, #ff8a80, #d32f2f);
  background-size: 300% 100%;
  animation: shimmerBar 3s ease-in-out infinite;
}

@keyframes shimmerBar {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@keyframes cardSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* === LOGO / BRAND === */
.login-brand {
  text-align: center;
  margin-bottom: 25px;
}

.login-brand img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #d32f2f;
  box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
  margin-bottom: 10px;
}

.login-brand h1 {
  font-size: 1.3rem;
  color: #1a1a2e;
  font-weight: 700;
  margin-bottom: 3px;
}

.login-brand p {
  font-size: 0.8rem;
  color: #888;
}

/* === TABS === */
.login-tabs {
  display: flex;
  border-bottom: 2px solid #f0f0f0;
  margin-bottom: 22px;
  position: relative;
}

.login-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  color: #aaa;
  transition: color 0.3s ease;
  position: relative;
  user-select: none;
}

.login-tab.active {
  color: #d32f2f;
}

.login-tab::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 3px;
  background: #d32f2f;
  border-radius: 3px 3px 0 0;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateX(-50%);
}

.login-tab.active::after {
  width: 70%;
}

/* === FORM PANELS === */
.login-form-panel {
  display: none;
  animation: fadeIn 0.35s ease;
}

.login-form-panel.active {
  display: block;
}

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

.login-form-panel h3 {
  text-align: center;
  color: #333;
  font-size: 1rem;
  margin-bottom: 18px;
  font-weight: 600;
}

/* === INPUTS === */
.login-input-group {
  position: relative;
  margin-bottom: 14px;
}

.login-input {
  width: 100%;
  padding: 13px 16px;
  padding-right: 42px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fafafa;
  color: #333;
  transition: all 0.3s ease;
  outline: none;
}

.login-input:focus {
  border-color: #d32f2f;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.login-input::placeholder {
  color: #bbb;
}

.login-eye-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #999;
  font-size: 1rem;
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 4px;
}

.login-eye-toggle:hover {
  color: #d32f2f;
}

/* === FORGOT PASSWORD === */
.login-forgot {
  text-align: right;
  margin-bottom: 16px;
}

.login-forgot a {
  color: #888;
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.2s;
}

.login-forgot a:hover {
  color: #d32f2f;
  text-decoration: underline;
}

/* === REGISTER FIELDS ROW === */
.login-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.login-row .login-input {
  margin-bottom: 0;
}

.login-row select.login-input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* === REGISTER SCROLL AREA === */
.login-register-scroll {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 5px;
  margin-bottom: 5px;
}

.login-register-scroll::-webkit-scrollbar {
  width: 4px;
}

.login-register-scroll::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* === BUTTONS === */
.login-btn-primary {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  background: linear-gradient(135deg, #d32f2f, #e53935);
  color: white;
  box-shadow: 0 4px 15px rgba(211, 47, 47, 0.35);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.login-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(211, 47, 47, 0.45);
}

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

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

/* Loading spinner overlay */
.login-btn-primary.loading {
  color: transparent;
  pointer-events: none;
}

.login-btn-primary.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* === DIVIDER === */
.login-divider {
  position: relative;
  text-align: center;
  margin: 22px 0;
}

.login-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #eee;
}

.login-divider span {
  position: relative;
  background: white;
  padding: 0 12px;
  color: #aaa;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* === GOOGLE BUTTON === */
.login-btn-google {
  width: 100%;
  padding: 11px;
  cursor: pointer;
  background: white;
  border: 2px solid #eee;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: #555;
  transition: all 0.3s ease;
}

.login-btn-google:hover {
  border-color: #ccc;
  background: #f8f8f8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.login-btn-google img {
  width: 20px;
  height: 20px;
}

/* === RATE LIMIT WARNING === */
.login-rate-warning {
  display: none;
  background: #fff3cd;
  color: #856404;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  margin-bottom: 14px;
  border: 1px solid #ffc107;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.login-rate-warning.show {
  display: block;
}

/* === ERROR MESSAGE === */
.login-error {
  display: none;
  background: #fde8e8;
  color: #c62828;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 14px;
  border: 1px solid #ef9a9a;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.login-error.show {
  display: block;
}

/* === SUCCESS MESSAGE === */
.login-success {
  display: none;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 14px;
  border: 1px solid #a5d6a7;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.login-success.show {
  display: block;
}

/* === FOOTER === */
.login-footer {
  text-align: center;
  margin-top: 20px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
}

.login-footer a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
}

.login-footer a:hover {
  color: #fff;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 480px) {
  .login-container {
    padding: 10px;
  }

  .login-card {
    padding: 25px 20px;
    border-radius: 16px;
  }

  .login-brand img {
    width: 50px;
    height: 50px;
  }

  .login-brand h1 {
    font-size: 1.15rem;
  }

  .login-row {
    flex-direction: column;
    gap: 0;
  }

  .login-row .login-input-group {
    margin-bottom: 14px;
  }

  body.login-page::before {
    font-size: 2.5rem;
    letter-spacing: 30px;
    word-spacing: 40px;
  }
}

@media (min-width: 768px) {
  .login-card {
    padding: 40px 35px;
  }
}
