:root {
  --bg-gradient: radial-gradient(circle at 50% 50%, #150933 0%, #060212 100%);
  --accent: #a855f7;
  --accent-glow: rgba(168, 85, 247, 0.45);
  --glass-bg: rgba(22, 10, 45, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3e8ff;
  --text-muted: #c084fc;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-gradient);
  color: var(--text-primary);
  overflow: hidden;
  position: relative;
  perspective: 1000px;
}

/* 3D Moving Blobs Background */
.background-blobs {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.55;
  animation: float 20s infinite alternate ease-in-out;
  mix-blend-mode: screen;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #7c3aed 0%, rgba(124,58,237,0) 70%);
  top: -10%;
  left: 10%;
  animation-duration: 25s;
}

.blob-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #db2777 0%, rgba(219,39,119,0) 70%);
  bottom: -15%;
  right: 10%;
  animation-duration: 28s;
  animation-delay: -5s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #2563eb 0%, rgba(37,99,235,0) 70%);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 22s;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(60px, 40px) scale(1.15) rotate(180deg); }
  100% { transform: translate(-40px, -60px) scale(0.9) rotate(360deg); }
}

/* Interactive 3D Card Wrapper */
.card-container {
  z-index: 2;
  width: 100%;
  max-width: 420px;
  padding: 20px;
  transition: transform 0.1s ease-out;
  will-change: transform;
}

.card {
  width: 100%;
  padding: 36px 30px;
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

/* Interactive Monkey Avatar (Telegram style) */
.monkey-avatar-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.monkey-svg {
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}

.monkey-hand {
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.left-hand {
  transform-origin: 70px 158px;
}

.right-hand {
  transform-origin: 130px 158px;
}

/* Monkey Animation States */
.monkey-svg.hands-down .left-hand {
  transform: translate(0, 0);
}
.monkey-svg.hands-down .right-hand {
  transform: translate(0, 0);
}

.monkey-svg.hands-up .left-hand {
  transform: translate(16px, -56px);
}
.monkey-svg.hands-up .right-hand {
  transform: translate(-16px, -56px);
}

/* Peek state: left hand covers, right hand tilts down to peek */
.monkey-svg.peek .left-hand {
  transform: translate(16px, -56px);
}
.monkey-svg.peek .right-hand {
  transform: translate(-8px, -34px) rotate(-22deg);
}

h2 {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, #d8b4fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}

/* Tabs */
.tabs {
  display: flex;
  background: rgba(10, 5, 20, 0.6);
  padding: 5px;
  border-radius: 14px;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  z-index: 1;
}

.tabs button {
  flex: 1;
  background: transparent;
  border: none;
  color: #a78bfa;
  font-size: 15px;
  font-weight: 600;
  padding: 11px;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.tabs button.active {
  color: white;
  background: rgba(168, 85, 247, 0.25);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.2), inset 0 1px 0 rgba(255,255,255,0.1);
  border: 1px solid rgba(168, 85, 247, 0.4);
}

/* Inputs */
.form-group {
  margin-top: 14px;
  position: relative;
  z-index: 1;
}

input {
  width: 100%;
  padding: 15px 18px;
  background: rgba(10, 5, 22, 0.7);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 14px;
  color: white;
  font-size: 15px;
  font-weight: 400;
  transition: all 0.3s ease;
  outline: none;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.05);
  background: rgba(10, 5, 22, 0.95);
}

/* View Password Toggle styling */
.password-group {
  position: relative;
}

.password-group input {
  padding-right: 48px;
}

.view-password-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 16px;
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s ease;
  outline: none;
}

.view-password-btn:hover {
  color: var(--accent);
}

/* Button styling */
button.main {
  width: 100%;
  margin-top: 24px;
  padding: 15px;
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  border: none;
  border-radius: 14px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button.main:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.5);
  filter: brightness(1.1);
}

button.main:active {
  transform: translateY(0);
}

/* Custom Success State Overlay */
.success-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0d061c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 10;
}

.success-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.success-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: pulseSuccess 2s infinite;
}

.success-checkmark {
  font-size: 36px;
  color: white;
  animation: scaleCheck 0.5s 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.success-text {
  margin-top: 20px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  animation: fadeInUp 0.5s 0.4s both;
}

@keyframes pulseSuccess {
  0% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.6); }
  70% { box-shadow: 0 0 0 15px rgba(168, 85, 247, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}

@keyframes scaleCheck {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(15px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Modern Toasts */
.toast-container {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
  width: 90%;
  max-width: 360px;
}

.toast {
  background: rgba(18, 9, 36, 0.9);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid;
  border-radius: 12px;
  padding: 14px 18px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  transform: translateY(-20px);
  opacity: 0;
  animation: slideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  transition: all 0.3s ease;
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.3);
  border-left: 4px solid #22c55e;
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
  border-left: 4px solid #ef4444;
}

@keyframes slideIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Forgot Password Link and Back button styling */
.forgot-link {
  display: block;
  text-align: right;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.forgot-link:hover {
  color: var(--accent);
}

.back-to-login {
  text-align: center;
  margin-top: 18px;
}

.back-to-login a {
  color: var(--text-muted);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.back-to-login a:hover {
  color: var(--accent);
}

/* Responsive adjustment */
@media (max-width: 480px) {
  .card {
    padding: 30px 20px;
    border-radius: 20px;
  }
  h2 {
    font-size: 24px;
  }
  input, button.main {
    padding: 13px;
    font-size: 14px;
  }
}
