/* ==================== CSS CUSTOM PROPERTIES ==================== */
:root {
  /* Background */
  --bg-primary: #050510;
  --bg-secondary: #0a0a1a;
  --bg-card: rgba(15, 15, 30, 0.9);
  
  /* Brand Colors */
  --primary: #00ff9d;
  --primary-dark: #00cc7d;
  --primary-glow: rgba(0, 255, 157, 0.4);
  --secondary: #00d4ff;
  --accent: #ff00ff;
  --warning: #fdcb6e;
  --error: #ef4444;
  --success: #10b981;
  
  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(0, 255, 157, 0.3);
  
  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Typography */
  --font-tech: 'Orbitron', monospace;
  --font-main: 'Vazirmatn', sans-serif;
  
  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 50px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 30px var(--primary-glow);
  --shadow-card: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 60px rgba(0, 255, 157, 0.08);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse at 30% 20%, rgba(0, 255, 157, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(0, 212, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 0, 255, 0.04) 0%, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==================== BACKGROUND EFFECTS ==================== */
.bg-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  animation: orbFloat 20s infinite alternate ease-in-out;
}

.orb-1 {
  width: 40vw;
  height: 40vw;
  max-width: 500px;
  max-height: 500px;
  background: var(--primary);
  top: -10%;
  left: -10%;
}

.orb-2 {
  width: 35vw;
  height: 35vw;
  max-width: 400px;
  max-height: 400px;
  background: var(--secondary);
  bottom: -10%;
  right: -10%;
  animation-delay: 7s;
  animation-duration: 25s;
}

.orb-3 {
  width: 25vw;
  height: 25vw;
  max-width: 300px;
  max-height: 300px;
  background: var(--accent);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 14s;
  animation-duration: 30s;
}

.orb-4 {
  width: 20vw;
  height: 20vw;
  max-width: 200px;
  max-height: 200px;
  background: var(--warning);
  top: 30%;
  right: 20%;
  animation-delay: 10s;
  animation-duration: 22s;
  opacity: 0.15;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(50px, -30px) scale(1.1); }
  66% { transform: translate(-30px, 40px) scale(0.9); }
  100% { transform: translate(20px, -20px) scale(1.05); }
}

/* Particles */
.particle {
  position: absolute;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  animation: particleRise linear infinite;
  opacity: 0;
}

@keyframes particleRise {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.2; }
  100% { transform: translateY(-100vh) scale(0); opacity: 0; }
}

/* ==================== LOADING OVERLAY ==================== */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 16, 0.98);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

#loadingOverlay.active {
  display: flex;
}

.loader-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 30px var(--primary-glow);
}

.loader-text {
  margin-top: 24px;
  font-family: var(--font-tech);
  color: var(--primary);
  font-size: 0.9rem;
  letter-spacing: 3px;
  animation: pulse 2s infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ==================== LOGIN WRAPPER ==================== */
.login-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeSlideUp 0.6s var(--transition-bounce);
}

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

/* ==================== DECORATIVE ELEMENTS ==================== */
.login-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.deco-circle {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  opacity: 0.3;
}

.deco-1 {
  width: 150px;
  height: 150px;
  top: -50px;
  right: -30px;
  border-color: var(--primary);
  animation: decoRotate 15s linear infinite;
}

.deco-2 {
  width: 100px;
  height: 100px;
  bottom: 100px;
  left: -40px;
  border-color: var(--secondary);
  animation: decoRotate 20s linear infinite reverse;
}

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

/* ==================== LOGIN CARD ==================== */
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 40px 28px;
  width: 100%;
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 255, 157, 0.03), transparent, rgba(0, 212, 255, 0.03));
  pointer-events: none;
}

/* ==================== LOGO SECTION ==================== */
.login-logo-section {
  text-align: center;
}

.login-logo {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: var(--primary);
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.4;
  animation: logoPulse 3s infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.6; }
}

.logo-icon {
  position: relative;
  z-index: 1;
  font-size: 4rem;
  display: block;
  animation: logoBounce 3s ease-in-out infinite;
}

@keyframes logoBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.login-title {
  font-family: var(--font-tech);
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.title-highlight {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ==================== DIVIDER ==================== */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-light), transparent);
}

.divider-text {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ==================== TAB SWITCHER ==================== */
.tab-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-smooth);
  font-family: var(--font-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn.active {
  background: var(--primary);
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 255, 157, 0.3);
}

.tab-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* ==================== AUTH FORMS ==================== */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.auth-form.active {
  display: flex;
}

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

/* ==================== INPUT GROUPS ==================== */
.input-group {
  position: relative;
}

.input-icon-wrapper {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  z-index: 1;
  pointer-events: none;
  transition: all var(--transition-smooth);
}

.auth-input {
  width: 100%;
  padding: 14px 40px 14px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-main);
  transition: all var(--transition-smooth);
  outline: none;
}

.auth-input::placeholder {
  color: var(--text-muted);
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 20px var(--primary-glow);
  background: rgba(255, 255, 255, 0.06);
}

.auth-input:focus + .input-icon-wrapper,
.auth-input:focus ~ .input-icon-wrapper {
  color: var(--primary);
}

/* Toggle Password */
.toggle-password {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.toggle-password:hover {
  color: var(--primary);
}

/* ==================== FORM OPTIONS ==================== */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light);
  border-radius: 4px;
  display: inline-block;
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.checkbox-label input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #000;
  font-size: 12px;
  font-weight: 900;
}

.link-btn, .link-text {
  background: none;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-main);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.link-btn:hover, .link-text:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ==================== PASSWORD STRENGTH ==================== */
.password-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
}

.strength-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: all 0.5s ease;
  width: 0%;
}

.strength-fill.weak { width: 25%; background: var(--error); }
.strength-fill.medium { width: 50%; background: var(--warning); }
.strength-fill.strong { width: 75%; background: var(--secondary); }
.strength-fill.very-strong { width: 100%; background: var(--success); }

.strength-text {
  color: var(--text-muted);
  min-width: 80px;
  text-align: left;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-main);
  transition: all var(--transition-smooth);
  letter-spacing: 0.3px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::after {
  left: 100%;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: var(--primary);
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 255, 157, 0.2);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-glow);
}

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

.btn-lg {
  width: 100%;
  padding: 16px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(0, 255, 157, 0.05);
}

/* ==================== SOCIAL SECTION ==================== */
.social-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.social-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all var(--transition-smooth);
  border: 1px solid var(--border-light);
}

.google-btn {
  background: white;
  color: #333;
  border: 1px solid #ddd;
}

.google-btn:hover {
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.google-btn:active {
  transform: scale(0.97);
}

/* ==================== GUEST SECTION ==================== */
.guest-section {
  display: flex;
  justify-content: center;
}

/* ==================== RESET INFO ==================== */
.reset-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--secondary);
  font-size: 0.85rem;
}

.reset-info i {
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* ==================== LOGIN FOOTER ==================== */
.login-footer {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 2;
}

.copyright {
  opacity: 0.6;
}

/* ==================== BACK TO HOME ==================== */
.back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-smooth);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.back-home:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(0, 255, 157, 0.05);
}

/* ==================== MODAL ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.4s var(--transition-bounce);
}

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

.modal-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: modalIconBounce 1s ease-in-out infinite;
}

@keyframes modalIconBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 12px;
  color: var(--primary);
}

.modal-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 8px;
  line-height: 1.6;
}

.modal-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 20px;
}

/* ==================== TOAST ==================== */
.toast-area {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: rgba(15, 15, 30, 0.95);
  border: 1px solid var(--primary);
  color: white;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.85rem;
  pointer-events: auto;
  animation: toastIn 0.4s var(--transition-bounce);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: center;
  justify-content: center;
}

.toast.error { border-color: var(--error); }
.toast.success { border-color: var(--success); }
.toast.warning { border-color: var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.out {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-30px); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 380px) {
  .login-card {
    padding: 28px 18px;
  }
  
  .login-title {
    font-size: 1.6rem;
  }
  
  .logo-icon {
    font-size: 3rem;
  }
  
  .btn {
    padding: 12px 18px;
    font-size: 0.9rem;
  }
}

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

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}