/* ============================================================
   GENIELEADS LOGIN — Design System aligned
   ============================================================ */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- Variables (Design System) ---------- */
:root {
  /* Brand */
  --color-brand-navy: #07133D;
  --color-brand-blue: #168BEA;
  --color-brand-purple: #A94FEF;

  /* Neutrals */
  --color-neutral-0: #FFFFFF;
  --color-neutral-50: #F8FAFC;
  --color-neutral-100: #F1F5F9;
  --color-neutral-200: #E2E8F0;
  --color-neutral-300: #CBD5E1;
  --color-neutral-400: #94A3B8;
  --color-neutral-500: #64748B;
  --color-neutral-600: #475569;
  --color-neutral-700: #334155;
  --color-neutral-800: #1E293B;
  --color-neutral-900: #0F172A;

  /* Semantic */
  --color-success: #16A34A;
  --color-warning: #F59E0B;
  --color-error: #DC2626;
  --color-info: #2563EB;

  /* Typography */
  --font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --text-display: 48px;
  --text-h1: 36px;
  --text-h2: 30px;
  --text-h3: 24px;
  --text-body: 16px;
  --text-caption: 12px;

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Sizing */
  --input-height: 44px;
  --button-height-md: 44px;
  --button-height-lg: 52px;

  /* Shadows */
  --shadow-floating: 0 8px 30px rgba(7, 19, 61, 0.08);
  --shadow-card: 0 4px 24px rgba(7, 19, 61, 0.06);
  --focus-ring: 0 0 0 3px rgba(22, 139, 234, 0.35);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
}

/* ---------- Base ---------- */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--text-body);
  line-height: 1.5;
  color: var(--color-neutral-800);
  background: var(--color-neutral-50);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--color-brand-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: #1270c4;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ---------- Page Layout ---------- */
.login-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* ---------- Left Brand Panel ---------- */
.login-brand {
  background: var(--color-brand-navy);
  color: var(--color-neutral-0);
  display: flex;
  flex-direction: column;
  padding: var(--space-8) var(--space-10);
  position: relative;
  overflow: hidden;
}

.brand-logo {
  margin-bottom: auto;
  display: inline-block;
  cursor: pointer;
  text-decoration: none;
}

.brand-logo img {
  height: 48px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.brand-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 480px;
  padding-block: var(--space-8);
}

.brand-headline {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-5);
  color: var(--color-neutral-0);
}

.gradient-text {
  background: linear-gradient(90deg, #168BEA 0%, #A94FEF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.brand-sub {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-neutral-300);
  max-width: 380px;
  margin-bottom: var(--space-10);
}

.brand-chart {
  width: 100%;
  max-width: 420px;
  margin-top: var(--space-4);
}

.growth-chart {
  width: 100%;
  height: auto;
  display: block;
}

/* Stats row */
.brand-stats {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: var(--space-8);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  min-width: 0;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(22, 139, 234, 0.15);
  color: var(--color-brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-neutral-0);
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--color-neutral-400);
  line-height: 1.3;
  white-space: nowrap;
}

/* ---------- Right Main Panel ---------- */
.login-main {
  background: var(--color-neutral-50);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  position: relative;
  min-height: 100vh;
}

/* Language switcher */
.lang-switcher {
  position: absolute;
  top: var(--space-6);
  inset-inline-end: var(--space-6);
  z-index: 20;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-neutral-0);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-neutral-700);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.lang-btn:hover {
  border-color: var(--color-neutral-300);
}

.lang-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  list-style: none;
  background: var(--color-neutral-0);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-floating);
  min-width: 140px;
  overflow: hidden;
  z-index: 30;
}

.lang-menu li {
  padding: var(--space-3) var(--space-4);
  font-size: 14px;
  color: var(--color-neutral-700);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.lang-menu li:hover,
.lang-menu li[aria-selected="true"] {
  background: var(--color-neutral-50);
  color: var(--color-brand-navy);
}

/* Login card */
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-neutral-0);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-neutral-100);
  box-shadow: var(--shadow-card);
  padding: var(--space-10) var(--space-8);
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-brand-navy);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}

.login-subtitle {
  font-size: 15px;
  color: var(--color-neutral-500);
  line-height: 1.4;
}

/* ---------- Form ---------- */
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-neutral-700);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  inset-inline-start: 14px;
  color: var(--color-neutral-400);
  display: flex;
  pointer-events: none;
  transition: color var(--transition-fast);
}

.form-input {
  width: 100%;
  height: var(--input-height);
  padding: 0 14px 0 42px;
  font-family: var(--font-family);
  font-size: 15px;
  color: var(--color-neutral-800);
  background: var(--color-neutral-0);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input::placeholder {
  color: var(--color-neutral-400);
}

.form-input:hover:not(:focus):not(:disabled) {
  border-color: var(--color-neutral-300);
}

.form-input:focus {
  border-color: var(--color-brand-blue);
  box-shadow: var(--focus-ring);
}

.input-wrapper:focus-within .input-icon {
  color: var(--color-brand-blue);
}

/* Error state */
.form-group.has-error .form-input {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.form-group.has-error .input-icon {
  color: var(--color-error);
}

.field-error {
  font-size: 13px;
  color: var(--color-error);
  line-height: 1.3;
}

.field-error[hidden] {
  display: none;
}

/* Password toggle */
.password-wrapper .form-input {
  padding-inline-end: 44px;
}

.password-toggle {
  position: absolute;
  inset-inline-end: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-neutral-400);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.password-toggle:hover {
  color: var(--color-neutral-600);
  background: var(--color-neutral-50);
}

.password-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  color: var(--color-brand-blue);
}

/* Form row (forgot) */
.form-row {
  display: flex;
  justify-content: flex-end;
  margin-top: calc(var(--space-2) * -1);
}

.forgot-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-brand-blue);
}

.forgot-link:hover {
  color: #1270c4;
  text-decoration: underline;
}

/* Primary button */
.btn-primary {
  width: 100%;
  height: var(--button-height-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--color-brand-navy);
  color: var(--color-neutral-0);
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: background var(--transition-base), transform var(--transition-fast), box-shadow var(--transition-fast);
  margin-top: var(--space-1);
}

.btn-primary:hover:not(:disabled) {
  background: #0a1a4d;
  box-shadow: 0 4px 14px rgba(7, 19, 61, 0.25);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

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

.btn-primary.is-loading .btn-text {
  visibility: hidden;
}

.btn-primary.is-loading .btn-loader {
  display: flex !important;
  position: absolute;
}

.btn-primary {
  position: relative;
}

.btn-loader[hidden] {
  display: none !important;
}

.spinner {
  animation: spin 0.8s linear infinite;
}

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

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-neutral-400);
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-neutral-200);
}

/* Social buttons */
.social-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.btn-social {
  width: 100%;
  height: var(--button-height-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  background: var(--color-neutral-0);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-neutral-800);
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-social:hover {
  background: var(--color-neutral-50);
  border-color: var(--color-neutral-300);
}

.btn-social:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-social:active {
  transform: scale(0.99);
}

/* Signup prompt */
.signup-prompt {
  text-align: center;
  font-size: 14px;
  color: var(--color-neutral-500);
  margin-top: var(--space-1);
}

.signup-link {
  font-weight: 600;
  color: var(--color-brand-blue);
}

.signup-link:hover {
  text-decoration: underline;
}

/* Form-level error */
.form-error {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-md);
  color: var(--color-error);
  font-size: 14px;
  text-align: center;
}

.form-error[hidden] {
  display: none;
}

/* Legal */
.legal {
  margin-top: var(--space-6);
  font-size: 12px;
  color: var(--color-neutral-400);
  text-align: center;
  max-width: 360px;
  line-height: 1.5;
}

.legal a {
  color: var(--color-brand-blue);
  font-weight: 500;
}

.legal a:hover {
  text-decoration: underline;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.login-brand {
  animation: fadeIn 0.5s ease both;
}

.brand-headline {
  animation: fadeUp 0.55s ease 0.1s both;
}

.brand-sub {
  animation: fadeUp 0.55s ease 0.2s both;
}

.brand-chart {
  animation: fadeUp 0.6s ease 0.3s both;
}

.brand-stats {
  animation: fadeUp 0.55s ease 0.4s both;
}

.login-card {
  animation: fadeUp 0.5s ease 0.15s both;
}

.lang-switcher {
  animation: fadeIn 0.4s ease 0.3s both;
}

.legal {
  animation: fadeIn 0.4s ease 0.4s both;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .login-page {
    grid-template-columns: 1fr 1.1fr;
  }

  .login-brand {
    padding: var(--space-6) var(--space-6);
  }

  .brand-headline {
    font-size: 36px;
  }
}

@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-main {
    min-height: 100vh;
    padding: var(--space-16) var(--space-4) var(--space-8);
  }

  .login-card {
    max-width: 400px;
    padding: var(--space-8) var(--space-6);
  }

  .lang-switcher {
    top: var(--space-4);
    inset-inline-end: var(--space-4);
  }
}

@media (max-width: 480px) {
  .login-main {
    padding: var(--space-12) var(--space-3) var(--space-6);
  }

  .login-card {
    padding: var(--space-6) var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: none;
    border: 1px solid var(--color-neutral-200);
  }

  .login-title {
    font-size: 24px;
  }

  .btn-primary {
    height: 48px;
  }

  .form-input {
    font-size: 16px; /* prevent iOS zoom */
  }
}

/* RTL support */
[dir="rtl"] .form-input {
  padding: 0 42px 0 14px;
}

[dir="rtl"] .password-wrapper .form-input {
  padding-inline-start: 42px;
  padding-inline-end: 44px;
}

[dir="rtl"] .input-icon {
  inset-inline-start: 14px;
  inset-inline-end: auto;
}

[dir="rtl"] .password-toggle {
  inset-inline-end: 10px;
  inset-inline-start: auto;
}

[dir="rtl"] .form-row {
  justify-content: flex-start;
}