/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  --font-family: 'Outfit', sans-serif;
  
  /* Color Palette */
  --bg-dark: #07070b;
  --bg-card: rgba(16, 16, 28, 0.55);
  --bg-card-border: rgba(255, 255, 255, 0.07);
  
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --btn-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #9333ea 50%, #db2777 100%);
  
  --color-primary: #818cf8;
  --color-secondary: #c084fc;
  --color-accent: #f472b6;
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Status Colors */
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.2);
  --info: #3b82f6;
  --info-glow: rgba(59, 130, 246, 0.2);
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.8s cubic-bezier(0.77, 0, 0.175, 1);
  
  /* Shadow */
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.25);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ==========================================================================
   ANIMATED BACKGROUND
   ========================================================================== */
.bg-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background-color: var(--bg-dark);
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  mix-blend-mode: screen;
  pointer-events: none;
}

.orb-1 {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.8) 0%, rgba(168, 85, 247, 0) 70%);
  animation: orbFloat 25s infinite alternate ease-in-out;
}

.orb-2 {
  bottom: -15%;
  right: -5%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.7) 0%, rgba(99, 102, 241, 0) 75%);
  animation: orbFloat 30s infinite alternate-reverse ease-in-out;
}

.orb-3 {
  top: 30%;
  left: 35%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.6) 0%, rgba(236, 72, 153, 0) 70%);
  animation: orbFloat 20s infinite alternate ease-in-out 5s;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 10%) scale(1.1); }
  100% { transform: translate(-5%, -5%) scale(0.9); }
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  width: calc(100vw - 48px);
}

.toast {
  position: relative;
  background: rgba(18, 18, 30, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-premium);
  display: grid;
  grid-template-columns: 24px 1fr 18px;
  gap: 12px;
  align-items: center;
  overflow: hidden;
  transform: translateX(120%);
  transition: transform var(--transition-normal);
  animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes toastIn {
  to { transform: translateX(0); }
}

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

@keyframes toastOut {
  to { transform: translateX(120%); opacity: 0; }
}

.toast i.toast-icon {
  font-size: 20px;
}

.toast-success i.toast-icon { color: var(--success); }
.toast-error i.toast-icon { color: var(--error); }
.toast-info i.toast-icon { color: var(--info); }

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--error); }
.toast-info { border-left: 4px solid var(--info); }

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--primary-gradient);
  width: 100%;
  transform-origin: left;
}

/* ==========================================================================
   AUTH LAYOUT CONTAINER
   ========================================================================== */
.main-wrapper {
  width: 100%;
  max-width: 1000px;
  padding: 24px;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
}

.auth-card {
  background: var(--bg-card);
  backdrop-filter: blur(25px) saturate(160%);
  -webkit-backdrop-filter: blur(25px) saturate(160%);
  border: 1px solid var(--bg-card-border);
  border-radius: 24px;
  box-shadow: var(--shadow-premium), var(--shadow-glow);
  position: relative;
  overflow: hidden;
  width: 850px;
  max-width: 100%;
  min-height: 580px;
  display: flex;
  transition: transform var(--transition-slow);
}

/* ==========================================================================
   FORM CONTAINER & COMPONENTS
   ========================================================================== */
.form-container {
  position: absolute;
  top: 0;
  height: 100%;
  transition: all var(--transition-slow);
}

.sign-in-container {
  left: 0;
  width: 50%;
  z-index: 2;
}

.sign-up-container {
  left: 0;
  width: 50%;
  opacity: 0;
  z-index: 1;
}

/* Toggle card active states for signup mode (Desktop) */
.auth-card.active-signup .sign-in-container {
  transform: translateX(100%);
  opacity: 0;
  z-index: 1;
}

.auth-card.active-signup .sign-up-container {
  transform: translateX(100%);
  opacity: 1;
  z-index: 5;
  animation: showSignUpPanel 0.8s forwards;
}

@keyframes showSignUpPanel {
  0%, 49.99% { opacity: 0; z-index: 1; }
  50%, 100% { opacity: 1; z-index: 5; }
}

form {
  padding: 40px 50px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.brand-logo i {
  font-size: 26px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.fa-spin-slow {
  animation: spinSlow 8s linear infinite;
}

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

.brand-logo span {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

form h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #ffffff 0%, #d1d5db 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
  font-weight: 400;
}

/* ==========================================================================
   INPUTS DESIGN
   ========================================================================== */
.input-group {
  position: relative;
  margin-bottom: 20px;
  width: 100%;
}

.input-group input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  outline: none;
  font-family: inherit;
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
}

/* Floating labels */
.input-group label {
  position: absolute;
  left: 44px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 14px;
  pointer-events: none;
  transition: all var(--transition-fast);
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
  top: 0;
  left: 14px;
  font-size: 11px;
  padding: 2px 8px;
  background: #111120;
  border-radius: 4px;
  color: var(--color-primary);
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.input-group input:focus {
  border-color: var(--color-primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
  transition: color var(--transition-fast);
}

.input-group input:focus ~ .input-icon {
  color: var(--color-primary);
}

.toggle-password {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

/* Validation Feedback styles */
.input-group.invalid input {
  border-color: var(--error);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
}

.input-group.invalid .input-icon {
  color: var(--error);
}

.input-group.invalid label {
  color: var(--error);
}

.error-msg {
  display: block;
  font-size: 11px;
  color: var(--error);
  margin-top: 4px;
  margin-left: 4px;
  height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.input-group.invalid .error-msg {
  height: 16px;
  opacity: 1;
}

/* ==========================================================================
   FORM ACTIONS & UTILITIES
   ========================================================================== */
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 13px;
}

/* Custom Checkbox */
.checkbox-container {
  display: block;
  position: relative;
  padding-left: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  height: 16px;
  width: 16px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.checkbox-container input:checked ~ .checkmark {
  background: var(--primary-gradient);
  border-color: transparent;
}

.checkmark::after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark::after {
  display: block;
}

.checkbox-container .checkmark::after {
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.forgot-pass-btn {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.forgot-pass-btn:hover {
  color: var(--color-secondary);
  text-decoration: underline;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: all var(--transition-fast);
  outline: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  background: var(--btn-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -4px rgba(99, 102, 241, 0.5);
}

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

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #ffffff;
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--error);
  width: 100%;
}

.btn-danger:hover {
  background: var(--error);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.divider::before { margin-right: 12px; }
.divider::after { margin-left: 12px; }

.btn-social {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn-social img {
  width: 18px;
  height: 18px;
}

.btn-social:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* ==========================================================================
   DESKTOP OVERLAY SLIDER
   ========================================================================== */
.overlay-container {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: transform var(--transition-slow);
  z-index: 100;
}

.auth-card.active-signup .overlay-container {
  transform: translateX(-100%);
}

.overlay {
  background: linear-gradient(135deg, rgba(20, 20, 35, 0.8) 0%, rgba(10, 10, 20, 0.95) 100%);
  background-size: cover;
  background-position: center;
  color: #ffffff;
  position: relative;
  left: -100%;
  height: 100%;
  width: 200%;
  transform: translateX(0);
  transition: transform var(--transition-slow);
}

/* Decorative backdrop within overlay for premium styling */
.overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 30%, rgba(99, 102, 241, 0.18) 0%, transparent 60%),
              radial-gradient(circle at 20% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.auth-card.active-signup .overlay {
  transform: translateX(50%);
}

.overlay-panel {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0 40px;
  text-align: center;
  top: 0;
  height: 100%;
  width: 50%;
  transform: translateX(0);
  transition: transform var(--transition-slow);
}

.overlay-left {
  transform: translateX(-20%);
}

.auth-card.active-signup .overlay-left {
  transform: translateX(0);
}

.overlay-right {
  right: 0;
  transform: translateX(0);
}

.auth-card.active-signup .overlay-right {
  transform: translateX(20%);
}

.overlay-panel h2 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(to right, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.overlay-panel p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 30px;
  color: var(--text-secondary);
}

.switch-text-mobile {
  display: none;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 24px;
}

.switch-text-mobile a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.switch-text-mobile a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   AUTHENTICATED STATE UI
   ========================================================================== */
.dashboard-card {
  background: var(--bg-card);
  backdrop-filter: blur(25px) saturate(160%);
  -webkit-backdrop-filter: blur(25px) saturate(160%);
  border: 1px solid var(--bg-card-border);
  border-radius: 24px;
  box-shadow: var(--shadow-premium), var(--shadow-glow);
  width: 450px;
  max-width: 100%;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all var(--transition-normal);
  animation: cardFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.hidden {
  display: none !important;
}

.user-avatar-container {
  position: relative;
  margin: 24px 0 16px;
}

.user-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
  border: 4px solid rgba(255, 255, 255, 0.05);
}

.dashboard-card h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.user-email-display {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.dashboard-content {
  width: 100%;
  margin-bottom: 32px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--success);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 28px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.quick-links {
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
}

.quick-links h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 600;
}

.links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.link-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.link-item i {
  font-size: 20px;
  color: var(--color-primary);
  transition: transform var(--transition-fast);
}

.link-item:hover:not(.disabled) {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

.link-item:hover:not(.disabled) i {
  transform: translateY(-2px);
  color: var(--color-secondary);
}

.link-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
  .auth-card {
    width: 420px;
    min-height: 520px;
    flex-direction: column;
  }
  
  .sign-in-container, .sign-up-container {
    width: 100%;
    position: relative;
    height: auto;
    opacity: 1;
    z-index: 1;
    transform: none !important;
  }
  
  .sign-up-container {
    display: none;
  }
  
  .auth-card.active-signup .sign-in-container {
    display: none;
  }
  
  .auth-card.active-signup .sign-up-container {
    display: block;
    opacity: 1;
    z-index: 5;
    animation: none;
  }
  
  .overlay-container {
    display: none;
  }
  
  .switch-text-mobile {
    display: block;
  }
  
  form {
    padding: 30px;
  }
  
  form h1 {
    font-size: 26px;
  }
}
