@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* DARK THEME (Default) */
  --bg-color: #08080e;
  --card-bg: rgba(18, 18, 28, 0.76);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --input-bg: rgba(255, 255, 255, 0.05);
  --input-border: rgba(255, 255, 255, 0.12);
  --input-focus: #8E2DE2;
  --input-focus-glow: rgba(142, 45, 226, 0.25);
  --btn-gradient: linear-gradient(135deg, #8E2DE2 0%, #4A00E0 100%);
  --btn-glow: 0 8px 24px rgba(142, 45, 226, 0.4);
  --bot-card-bg: rgba(255, 255, 255, 0.03);
  --bot-card-border: rgba(142, 45, 226, 0.4);
  --nav-bg: rgba(8, 8, 14, 0.8);
  --nav-border: rgba(255, 255, 255, 0.06);
  --badge-bg: rgba(34, 197, 94, 0.12);
  --badge-border: rgba(34, 197, 94, 0.3);
  --badge-text: #4ade80;
  --toast-bg: rgba(20, 20, 32, 0.92);
}

body.light {
  /* LIGHT THEME */
  --bg-color: #f4f6fb;
  --card-bg: rgba(255, 255, 255, 0.88);
  --card-border: rgba(0, 0, 0, 0.07);
  --card-shadow: 0 20px 50px rgba(100, 116, 139, 0.14), 0 1px 3px rgba(0, 0, 0, 0.05);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --input-focus: #7c3aed;
  --input-focus-glow: rgba(124, 58, 237, 0.18);
  --btn-gradient: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  --btn-glow: 0 8px 20px rgba(124, 58, 237, 0.3);
  --bot-card-bg: #f8fafc;
  --bot-card-border: rgba(124, 58, 237, 0.3);
  --nav-bg: rgba(244, 246, 251, 0.85);
  --nav-border: rgba(0, 0, 0, 0.06);
  --badge-bg: rgba(22, 163, 74, 0.08);
  --badge-border: rgba(22, 163, 74, 0.25);
  --badge-text: #16a34a;
  --toast-bg: rgba(255, 255, 255, 0.96);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==============================================================
   AMBIENT BACKGROUND GLOW (Dynamic Lights)
   ============================================================== */
.ambient-glow-1 {
  position: fixed;
  width: 500px;
  height: 500px;
  top: -120px;
  left: -100px;
  background: radial-gradient(circle, rgba(142, 45, 226, 0.28) 0%, rgba(74, 0, 224, 0) 70%);
  filter: blur(90px);
  z-index: 0;
  pointer-events: none;
  animation: floatOrb1 18s ease-in-out infinite alternate;
}

.ambient-glow-2 {
  position: fixed;
  width: 480px;
  height: 480px;
  bottom: -100px;
  right: -80px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, rgba(142, 45, 226, 0) 70%);
  filter: blur(100px);
  z-index: 0;
  pointer-events: none;
  animation: floatOrb2 22s ease-in-out infinite alternate;
}

@keyframes floatOrb1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.1); }
  100% { transform: translate(-30px, 80px) scale(0.95); }
}

@keyframes floatOrb2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -40px) scale(1.15); }
  100% { transform: translate(40px, -60px) scale(0.9); }
}

#logo-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
}

/* ==============================================================
   TOP HEADER NAVIGATION (Brand + Language + Theme)
   ============================================================== */
.auth-top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--nav-border);
  z-index: 100;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.nav-brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(142, 45, 226, 0.4));
}

.nav-brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #8E2DE2 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Til tanlash pill/select */
.lang-select-box {
  position: relative;
  display: flex;
  align-items: center;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 8px 32px 8px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
}

.lang-select:hover, .lang-select:focus {
  border-color: var(--input-focus);
}

.lang-arrow {
  position: absolute;
  right: 12px;
  pointer-events: none;
  font-size: 10px;
  color: var(--text-muted);
}

/* Mavzu tugmasi */
.theme-toggle-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
}

.theme-toggle-btn:hover {
  transform: scale(1.05);
  border-color: var(--input-focus);
}

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

/* ==============================================================
   AUTH CARD CONTAINER & GLASS DESIGN
   ============================================================== */
.auth-main-wrap {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 400px;
  padding: 80px 18px 24px 18px;
}

.auth-card {
  background: var(--card-bg);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: var(--card-shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #8E2DE2, #38bdf8, transparent);
  opacity: 0.8;
}

.auth-brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.auth-header-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(142, 45, 226, 0.45));
  animation: pulseLogo 3s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulseLogo {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.auth-title {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #a855f7 0%, #8E2DE2 38%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0;
  letter-spacing: -0.3px;
  display: inline-block;
  line-height: 1.25;
}

body.light .auth-title {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 45%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.5;
}

/* ==============================================================
   INPUTS & LABELS
   ============================================================== */
.input-label {
  display: block;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 14px;
  outline: none;
  transition: all 0.25s ease;
}

.auth-input:focus {
  border-color: var(--input-focus);
  background: var(--card-bg);
  box-shadow: 0 0 0 4px var(--input-focus-glow);
}

.auth-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
  font-size: 13.5px;
}

.auth-input-code {
  letter-spacing: 6px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  padding: 14px 12px;
}

/* ==============================================================
   BUTTONS & LOADING ANIMATIONS
   ============================================================== */
.auth-btn {
  position: relative;
  width: 100%;
  padding: 13px 18px;
  background: var(--btn-gradient);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: var(--btn-glow);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
}

.auth-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.auth-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.auth-btn:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none !important;
}

/* Spinner Loader */
.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spinLoader 0.7s linear infinite;
}

.auth-btn.is-loading .btn-spinner {
  display: inline-block;
}

.auth-btn.is-loading .btn-text {
  opacity: 0.85;
}

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

/* ==============================================================
   STEP 2: TELEGRAM BOT VERIFICATION CARD
   ============================================================== */
.bot-verify-card {
  background: var(--bot-card-bg);
  border: 1.5px dashed var(--bot-card-border);
  border-radius: 16px;
  padding: 16px 14px;
  margin-bottom: 18px;
  text-align: center;
}

.bot-verify-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--btn-gradient);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.bot-verify-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
}

.bot-verify-desc b {
  color: var(--text-main);
}

.tg-open-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: all 0.2s ease;
}

.tg-open-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.phone-change-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-main);
}

.phone-change-btn {
  background: none;
  border: none;
  color: #a855f7;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s;
}

.phone-change-btn:hover {
  color: #c084fc;
  text-decoration: underline;
}

/* ==============================================================
   STEP 3: AVATAR PICKER WITH SHIMMER / LOADING
   ============================================================== */
.avatar-picker-wrap {
  margin: 10px auto 18px auto;
  cursor: pointer;
  display: inline-block;
  position: relative;
}

.avatar-preview-box {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto 8px auto;
}

.avatar-preview {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid #8E2DE2;
  object-fit: cover;
  display: block;
  box-shadow: 0 6px 18px rgba(142, 45, 226, 0.35);
  transition: transform 0.25s ease, filter 0.25s ease;
}

.avatar-picker-wrap:hover .avatar-preview {
  transform: scale(1.05);
  filter: brightness(0.9);
}

.avatar-camera-icon {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  background: var(--btn-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  border: 2px solid var(--card-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.avatar-upload-text {
  font-size: 12px;
  color: #a855f7;
  font-weight: 600;
  display: block;
}

/* Avatar uploading state */
.avatar-preview-box.is-uploading .avatar-preview {
  filter: blur(2px) brightness(0.6);
}

.avatar-preview-box.is-uploading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #8E2DE2;
  border-radius: 50%;
  animation: spinLoader 0.7s linear infinite;
}

/* ==============================================================
   STEP TRANSITIONS (Smooth Fade + Slide)
   ============================================================== */
.auth-step {
  animation: stepFadeSlide 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes stepFadeSlide {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.is-hidden {
  display: none !important;
}

/* Trust badge */
.auth-trust-badge {
  margin-top: 18px;
  text-align: center;
}

.trust-badge-pill {
  font-size: 11.5px;
  color: var(--badge-text);
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.2px;
}

/* ==============================================================
   TOAST NOTIFICATION COMPONENT (Modern Alerts)
   ============================================================== */
#toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}

.vibly-toast {
  background: var(--toast-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}

.vibly-toast.toast-error {
  border-left: 4px solid #ef4444;
}

.vibly-toast.toast-success {
  border-left: 4px solid #22c55e;
}

.vibly-toast.toast-info {
  border-left: 4px solid #38bdf8;
}

.vibly-toast.toast-hide {
  opacity: 0;
  transform: translateY(-16px) scale(0.95);
}

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

@media (max-width: 480px) {
  .auth-top-nav {
    padding: 12px 16px;
  }
  .auth-card {
    padding: 26px 20px;
  }
  .auth-title {
    font-size: 20px;
  }
}
