:root {
  --bg-0: #070d18;
  --bg-1: #0f172a;
  --bg-2: #111c33;
  --card: rgba(15, 23, 42, 0.82);
  --card-border: rgba(148, 163, 184, 0.14);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-glow: rgba(59, 130, 246, 0.35);
  --input-bg: rgba(2, 6, 23, 0.55);
  --input-border: rgba(148, 163, 184, 0.18);
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-text: #fecaca;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: 'Vazirmatn', 'IRANSans', 'Tahoma', Arial, sans-serif;
  background: transparent;
  color: var(--text);
  direction: rtl;
}

body::before,
body::after {
  display: none;
}

.login-page {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

.login-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 28%),
    radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.12), transparent 32%),
    linear-gradient(145deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
  overflow: hidden;
  z-index: 0;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
}

.login-orb-1 {
  width: 320px;
  height: 320px;
  top: -80px;
  left: -60px;
  background: #2563eb;
}

.login-orb-2 {
  width: 280px;
  height: 280px;
  right: -40px;
  bottom: -60px;
  background: #0ea5e9;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(1080px, 92%);
  margin: auto;
  padding: 48px 0;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 28px;
  align-items: stretch;
}

.login-brand,
.login-card {
  border: 1px solid var(--card-border);
  border-radius: 24px;
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}

.login-brand {
  padding: 40px 36px;
  background: linear-gradient(160deg, rgba(30, 58, 138, 0.28), rgba(15, 23, 42, 0.35));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-badge {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 16px 40px var(--primary-glow);
  margin-bottom: 24px;
}

.brand-badge i {
  font-size: 30px;
  color: #fff;
}

.login-brand h1 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.35;
}

.login-brand > p {
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.8;
  max-width: 34ch;
}

.brand-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.brand-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #dbeafe;
  font-size: 0.95rem;
}

.brand-features i {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
  font-size: 0.9rem;
}

.login-card {
  padding: 36px 32px 28px;
  background: var(--card);
}

.login-card-header {
  margin-bottom: 28px;
}

.login-card-header h2 {
  margin: 0 0 8px;
  font-size: 1.55rem;
  font-weight: 800;
}

.login-card-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #cbd5e1;
  font-weight: 600;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.98rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-align: left;
  direction: ltr;
}

.input-wrap input::placeholder {
  color: #64748b;
}

.input-wrap input:focus {
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
  background: rgba(2, 6, 23, 0.75);
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 0.95rem;
  pointer-events: none;
}

.login-options {
  display: flex;
  align-items: center;
  margin-bottom: 22px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.login-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.login-options input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.login-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 32px var(--primary-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.42);
}

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

.login-btn .fa-spinner {
  animation: spin 1s linear infinite;
}

.error-message {
  margin-top: 14px;
  min-height: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 0.92rem;
  text-align: center;
}

.error-message:empty {
  display: none;
}

.login-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 16px 20px;
  color: #64748b;
  font-size: 0.82rem;
}

.error-popup,
.success-popup {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.error-popup-content,
.success-popup-content {
  background: #0f172a;
  border-radius: 18px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.14);
  text-align: center;
  position: relative;
  animation: slideUp 0.3s ease;
}

.error-popup-content {
  border-top: 3px solid #ef4444;
}

.success-popup-content {
  border-top: 3px solid #22c55e;
}

.error-icon,
.success-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
}

.error-icon {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.success-icon {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.error-text h3,
.success-text h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
}

.error-text h3 { color: #fca5a5; }
.success-text h3 { color: #86efac; }

.error-text p,
.success-text p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.error-close {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fca5a5;
}

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
    padding: 28px 0 18px;
  }

  .login-brand {
    padding: 28px 24px;
  }

  .brand-features {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .login-shell {
    width: 94%;
  }

  .login-brand,
  .login-card {
    border-radius: 18px;
  }

  .login-brand {
    padding: 22px 18px;
  }

  .login-card {
    padding: 24px 18px 20px;
  }

  .brand-badge {
    width: 60px;
    height: 60px;
    border-radius: 16px;
  }

  .brand-badge i {
    font-size: 24px;
  }

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

  .login-brand > p,
  .brand-features {
    display: none;
  }

  .input-wrap input {
    font-size: 16px;
    min-height: 48px;
  }

  .login-btn {
    min-height: 48px;
  }
}

@media (max-height: 700px) and (orientation: landscape) {
  .login-shell {
    padding: 16px 0;
  }

  .login-brand > p,
  .brand-features {
    display: none;
  }
}
