/* ═══════════════════════════════════════════════════
   CHERY LOGIN — AI-GRADE PREMIUM DESIGN
   Glassmorphism • Particles • Neon • Responsive
   ═══════════════════════════════════════════════════ */

:root {
  --bg-deep: #06090F;
  --bg-surface: #0C1220;
  --bg-card: rgba(15, 23, 42, 0.65);
  --bg-card-solid: #111827;
  --glass-bg: rgba(15, 23, 42, 0.55);
  --glass-border: rgba(56, 71, 105, 0.35);
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #4B5E7A;
  --border: rgba(51, 65, 85, 0.5);
  --accent: #3B82F6;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --accent-rgb: 59, 130, 246;
  --emerald: #10B981;
  --rose: #F43F5E;
  --violet: #8B5CF6;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-ar: 'Alexandria', sans-serif;
  --font-en: 'Inter', sans-serif;
  --font-zh: 'Noto Sans SC', sans-serif;
}

[data-theme="light"] {
  --bg-deep: #EFF3FA;
  --bg-surface: #FFFFFF;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-solid: #FFFFFF;
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(203, 213, 225, 0.6);
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: rgba(203, 213, 225, 0.7);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
html[lang="ar"] { font-family: var(--font-ar); }
html[lang="en"] { font-family: var(--font-en); }
html[lang="zh"] { font-family: var(--font-zh); }

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* ─── PARTICLE CANVAS ─── */
#particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* ─── GRADIENT ORBS ─── */
.gradient-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  animation: float-orb 20s ease-in-out infinite;
}
.orb-1 { width: 600px; height: 600px; background: var(--accent); top: -200px; right: -150px; opacity: 0.12; }
.orb-2 { width: 450px; height: 450px; background: var(--violet); bottom: -150px; left: -100px; opacity: 0.10; animation-delay: -7s; }
.orb-3 { width: 350px; height: 350px; background: var(--emerald); top: 50%; left: 50%; opacity: 0.06; animation-delay: -14s; }
[data-theme="light"] .gradient-orb { opacity: 0.06; }
@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}

/* ─── LOGIN CONTAINER ─── */
.login-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  width: 960px;
  max-width: 94vw;
  min-height: 580px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 32px 80px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
  animation: card-enter 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes card-enter {
  from { opacity: 0; transform: scale(0.92) translateY(30px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── LEFT PANEL (Branding & Visual) ─── */
.login-visual {
  flex: 1;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.15), rgba(139, 92, 246, 0.1));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}
.login-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 70%, rgba(var(--accent-rgb), 0.12), transparent 60%);
}

.visual-content { position: relative; z-index: 2; text-align: center; }

.brand-logo-img-box {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.login-logo-img {
  max-height: 76px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.15));
  transition: transform var(--transition);
}
.login-logo-img:hover {
  transform: scale(1.04);
}

.brand-logo-box {
  width: 90px; height: 90px;
  background: linear-gradient(135deg, #EF4444, #B91C1C);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  margin: 0 auto 24px;
  position: relative;
  box-shadow: 0 12px 40px rgba(239, 68, 68, 0.3);
}
.brand-logo-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 26px;
  background: linear-gradient(135deg, #EF4444, #B91C1C);
  opacity: 0.2;
  animation: logo-pulse 3s ease-in-out infinite;
}
@keyframes logo-pulse {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.15); }
}

.visual-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.visual-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 260px;
  margin: 0 auto 30px;
}

/* Animated car */
.car-animation {
  position: relative;
  width: 200px;
  height: 80px;
  margin: 0 auto;
}
.car-silhouette {
  font-size: 64px;
  color: var(--accent);
  opacity: 0.25;
  animation: car-drive 8s ease-in-out infinite;
}
@keyframes car-drive {
  0% { transform: translateX(-30px); opacity: 0.15; }
  50% { transform: translateX(30px); opacity: 0.35; }
  100% { transform: translateX(-30px); opacity: 0.15; }
}
.road-line {
  width: 160px;
  height: 2px;
  margin: 8px auto 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.2;
  border-radius: 2px;
}

/* Stats badges */
.visual-stats {
  display: flex;
  gap: 16px;
  margin-top: 30px;
}
.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 30px;
  font-size: 12px;
  color: var(--text-secondary);
}
[data-theme="light"] .stat-pill {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
}
.stat-pill i { font-size: 14px; }
.stat-pill .num { font-weight: 800; color: var(--accent); }

/* ─── RIGHT PANEL (Form) ─── */
.login-form-panel {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Top Controls */
.login-top-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.lang-switcher { position: relative; }
.lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition);
}
.lang-btn:hover { border-color: var(--accent); }
.flag-img { width: 22px; height: 16px; border-radius: 3px; object-fit: cover; }
.lang-btn i { font-size: 10px; color: var(--text-muted); }

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  background: var(--bg-card-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 6px;
  min-width: 200px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition);
  z-index: 200;
}
html[dir="rtl"] .lang-dropdown { right: 0; }
html[dir="ltr"] .lang-dropdown { left: 0; }
.lang-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
  transition: background var(--transition);
}
.lang-option:hover { background: rgba(var(--accent-rgb), 0.08); }
.lang-option strong { font-size: 13px; }
.lang-option small { font-size: 11px; color: var(--text-muted); margin-inline-start: auto; }

/* Theme Toggle */
.theme-toggle {
  background: none; border: none; cursor: pointer; padding: 4px;
}
.toggle-track {
  width: 48px; height: 26px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 6px;
  justify-content: space-between;
}
[data-theme="light"] .toggle-track { background: rgba(0,0,0,0.04); }
.sun-icon { font-size: 11px; color: #FBBF24; }
.moon-icon { font-size: 11px; color: #94A3B8; }
.toggle-thumb {
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: all var(--transition);
  top: 2px;
}
html[dir="rtl"] .toggle-thumb { right: 3px; }
html[dir="ltr"] .toggle-thumb { left: 3px; }
[data-theme="light"] .toggle-thumb { background: #FBBF24; box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4); }
html[dir="rtl"] [data-theme="light"] .toggle-thumb { right: 24px; }
html[dir="ltr"] [data-theme="light"] .toggle-thumb { left: 24px; }

/* Form Content */
.form-header {
  margin-bottom: 28px;
}
.form-header h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}
.form-header p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Input Groups */
.input-group {
  margin-bottom: 18px;
}
.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0 16px;
  height: 48px;
  gap: 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-wrap i { color: var(--text-muted); font-size: 15px; flex-shrink: 0; }
.input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  height: 100%;
}
.input-wrap input::placeholder { color: var(--text-muted); }
.input-wrap .toggle-password {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px;
  transition: color var(--transition);
}
.input-wrap .toggle-password:hover { color: var(--accent); }

/* Remember & Forgot */
.form-extras {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.remember-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}
.remember-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.forgot-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}
.forgot-link:hover { color: #60A5FA; }

/* Submit Button */
.btn-login {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), #1D4ED8);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 24px var(--accent-glow);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.btn-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 10px 32px var(--accent-glow); }
.btn-login:hover::before { opacity: 1; }
.btn-login:active { transform: translateY(0); }

/* Divider */
.form-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
}
.form-divider::before, .form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.form-divider span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Social Login */
.social-row {
  display: flex;
  gap: 12px;
}
.btn-social {
  flex: 1;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
[data-theme="light"] .btn-social { background: rgba(0,0,0,0.02); }
.btn-social:hover { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb), 0.05); }
.btn-social i { font-size: 16px; }

/* Footer */
.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}
.login-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}
.login-footer a:hover { text-decoration: underline; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .login-visual { display: none; }
  .login-wrapper {
    width: 100%;
    max-width: 440px;
    min-height: auto;
    margin: 16px;
  }
  .login-form-panel { padding: 28px 24px; }
}

@media (max-width: 480px) {
  .login-wrapper { margin: 10px; border-radius: var(--radius-lg); }
  .login-form-panel { padding: 24px 18px; }
  .form-header h2 { font-size: 20px; }
  .social-row { flex-direction: column; }
  .login-top-controls { gap: 8px; }
  .lang-btn span { display: none; }
}

/* ─── FLASH MESSAGES ─── */
.flash-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: auto;
  min-width: 320px;
  max-width: 90vw;
  pointer-events: auto;
}
.message {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: flash-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin-bottom: 8px;
}
@keyframes flash-enter {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.message.info {
  background: rgba(59, 130, 246, 0.9);
  color: #FFFFFF;
  border: 1px solid rgba(96, 165, 250, 0.4);
}
.message.success {
  background: rgba(16, 185, 129, 0.9);
  color: #FFFFFF;
  border: 1px solid rgba(52, 211, 153, 0.4);
}
.message.error {
  background: rgba(244, 63, 94, 0.9);
  color: #FFFFFF;
  border: 1px solid rgba(251, 113, 133, 0.4);
}

