/* ══ Auth Module Styles ══ */

.auth-modal {
  display: none;
  z-index: 200000 !important;
}

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

.auth-modal-content {
  background: rgba(20, 20, 35, 0.85);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
  animation: authModalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

@media (max-width: 480px) {
  .auth-modal-content {
    width: 95%;
    max-width: 100%;
    border-radius: 20px;
  }
  .auth-modal-header {
    padding: 20px 20px 0 !important;
  }
  .auth-modal-body {
    padding: 20px !important;
  }
  .auth-modal-footer {
    padding: 0 20px 20px !important;
  }
  .auth-modal-header h2 {
    font-size: 20px !important;
  }
}

@keyframes authModalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.auth-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 0;
}

.auth-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary, #fff);
}

.auth-close-btn {
  background: none;
  border: none;
  color: var(--text-muted, #666);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.auth-close-btn:hover {
  background: var(--hover-bg, #252525);
  color: var(--text-primary, #fff);
}

.auth-modal-body {
  padding: 24px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) transparent;
}

.auth-modal-body::-webkit-scrollbar {
  width: 6px;
}

.auth-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.auth-modal-body::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
}

.auth-form-group {
  margin-bottom: 20px;
}

.auth-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary, #fff);
}

.auth-form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-color, #0f0f0f);
  border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 12px;
  color: var(--text-primary, #fff);
  font-size: 15px;
  transition: all 0.2s;
}

.auth-form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-form-group input::placeholder {
  color: var(--text-muted, #666);
}

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.auth-submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-gradient);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-submit-btn.loading {
  position: relative;
  color: transparent;
}

.auth-submit-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
}

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

.auth-modal-footer {
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.auth-link {
  color: var(--primary-color);
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}

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

.auth-divider {
  margin: 24px 0;
  text-align: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-divider span {
  position: relative;
  background: #1c1c2e; /* Matches modal dark base */
  padding: 0 16px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 20px;
}


.auth-telegram-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #0088cc 0%, #00a8e8 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.2);
}

.auth-telegram-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 136, 204, 0.3);
  filter: brightness(1.1);
}

.auth-telegram-btn:active {
  transform: translateY(0);
}

.auth-footer-links {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
  width: 100%;
}

.auth-footer-label {
  color: var(--text-muted, #888);
  font-size: 13px;
  margin-bottom: 4px;
}

.auth-link {
  color: var(--primary-color, #667eea);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
  filter: brightness(1.2);
}

/* Блок пользователя в сайдбаре */
.auth-user-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin: 0 16px 16px;
  background: var(--hover-bg, #252525);
  border-radius: 12px;
  border: 1px solid var(--border-color, #2a2a2a);
}

.auth-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.auth-user-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.auth-user-info:hover .auth-user-name {
  color: var(--primary-color);
}

.auth-user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.auth-user-email {
  font-size: 12px;
  color: var(--text-muted, #666);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-logout-btn {
  background: none;
  border: none;
  color: var(--text-muted, #666);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.auth-logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* ── LIGHT THEME — AuthModule ── */
[data-mode="light"] .auth-modal-overlay {
  background: rgba(0, 0, 0, 0.25) !important;
}
[data-mode="light"] .auth-modal-content {
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(0, 0, 0, 0.10) !important;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.12) !important;
}
[data-mode="light"] .auth-modal-header h2 { color: #0f172a !important; }
[data-mode="light"] .auth-close-btn { color: #64748b !important; }
[data-mode="light"] .auth-form-group label { color: #334155 !important; }
[data-mode="light"] .auth-form-group input {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.10) !important;
  color: #0f172a !important;
}
[data-mode="light"] .auth-form-group input::placeholder { color: #94a3b8 !important; }
[data-mode="light"] .auth-form-group input:focus {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: var(--primary-color) !important;
}
[data-mode="light"] .auth-divider::before { background: rgba(0, 0, 0, 0.08) !important; }
[data-mode="light"] .auth-divider span {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #64748b !important;
}
[data-mode="light"] .auth-footer-label { color: #64748b !important; }

/* ══ Onboarding Styles ══ */

.onboarding-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  padding: 0 20px;
}

.onboarding-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border-color, #2a2a2a);
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.onboarding-step.active {
  background: var(--accent-gradient);
  color: white;
}

.onboarding-step.completed {
  background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
  color: white;
}

.onboarding-line {
  flex: 1;
  height: 2px;
  background: var(--border-color, #2a2a2a);
  margin: 0 8px;
  transition: all 0.3s ease;
}

.onboarding-line.completed {
  background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
}

.theme-selector {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.theme-option {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.15);
  transition: all 0.2s ease;
  overflow: hidden;
  display: flex;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.theme-half {
  width: 50%;
  height: 100%;
  display: block;
}

.theme-option:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.theme-option.active {
  border-color: white;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3), 0 4px 16px rgba(0,0,0,0.4);
}

.telegram-icon-large {
  font-size: 64px;
  margin-bottom: 8px;
}

.telegram-connect-step {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* === Аватар бота === */
.avatar-selector {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.avatar-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.avatar-preset {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.avatar-emoji {
  font-size: 24px;
  line-height: 1;
}

.avatar-preset:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.1);
  transform: scale(1.1);
}

.avatar-preset.active {
  border-color: var(--primary-color, #667eea);
  background: rgba(102, 126, 234, 0.15);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.avatar-upload-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 2px dashed rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-size: 20px;
}

.avatar-upload-btn:hover {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.1);
  transform: scale(1.1);
}

.avatar-upload-btn.active {
  border-color: var(--primary-color, #667eea);
  border-style: solid;
  background: rgba(102, 126, 234, 0.15);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.avatar-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 2px solid var(--primary-color, #667eea);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(102, 126, 234, 0.3);
}

.avatar-preview-label {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-align: center;
  max-width: 64px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}
