/* ==========================================================================
   DESIGN SYSTEM & GLOBAL STYLES
   ========================================================================== */

:root {
  /* Fonts */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.86, 0, 0.07, 1);
}

/* Dark Theme Tokens */
html[data-theme="dark"] {
  --bg-primary: #0a0f1d;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  
  --card-bg: rgba(15, 23, 42, 0.45);
  --card-border: rgba(255, 255, 255, 0.06);
  --shadow-color: rgba(0, 0, 0, 0.6);
  
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --btn-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #9333ea 50%, #db2777 100%);
  
  --input-bg: rgba(15, 23, 42, 0.6);
  --input-border: rgba(255, 255, 255, 0.08);
  --input-border-hover: rgba(255, 255, 255, 0.2);
  --input-focus: #a855f7;
  
  --accent-purple: #a855f7;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  
  --sso-bg: rgba(255, 255, 255, 0.04);
  --sso-border: rgba(255, 255, 255, 0.08);
  --sso-hover: rgba(255, 255, 255, 0.1);
  
  --divider-color: rgba(255, 255, 255, 0.08);
  --glass-blur: 20px;
  
  --blob-opacity: 0.45;
}

/* Light Theme Tokens */
html[data-theme="light"] {
  --bg-primary: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  
  --card-bg: rgba(255, 255, 255, 0.65);
  --card-border: rgba(0, 0, 0, 0.06);
  --shadow-color: rgba(79, 70, 229, 0.08);
  
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
  --btn-gradient-hover: linear-gradient(135deg, #3730a3 0%, #6d28d9 50%, #be185d 100%);
  
  --input-bg: rgba(255, 255, 255, 0.7);
  --input-border: rgba(0, 0, 0, 0.1);
  --input-border-hover: rgba(0, 0, 0, 0.2);
  --input-focus: #7c3aed;
  
  --accent-purple: #7c3aed;
  --accent-cyan: #0891b2;
  --accent-pink: #db2777;
  
  --sso-bg: rgba(0, 0, 0, 0.02);
  --sso-border: rgba(0, 0, 0, 0.06);
  --sso-hover: rgba(0, 0, 0, 0.06);
  
  --divider-color: rgba(0, 0, 0, 0.08);
  --glass-blur: 20px;
  
  --blob-opacity: 0.35;
}

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

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

/* ==========================================================================
   BACKGROUND AURORA BLOBS (Mesmerizing Moving Glow)
   ========================================================================== */

.aurora-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  mix-blend-mode: screen;
  opacity: var(--blob-opacity);
  transition: opacity var(--transition-normal);
}

/* Dynamic positioning & distinct sizes */
.blob-1 {
  width: 50vw;
  height: 50vw;
  max-width: 500px;
  max-height: 500px;
  background: var(--accent-purple);
  top: -10%;
  left: -10%;
  animation: moveBlob1 25s infinite alternate ease-in-out;
}

.blob-2 {
  width: 60vw;
  height: 60vw;
  max-width: 600px;
  max-height: 600px;
  background: var(--accent-cyan);
  bottom: -20%;
  right: -10%;
  animation: moveBlob2 30s infinite alternate ease-in-out;
}

.blob-3 {
  width: 45vw;
  height: 45vw;
  max-width: 450px;
  max-height: 450px;
  background: var(--accent-pink);
  top: 40%;
  left: 50%;
  animation: moveBlob3 20s infinite alternate ease-in-out;
}

@keyframes moveBlob1 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(100px, 80px) scale(1.2) rotate(180deg); }
  100% { transform: translate(-50px, 150px) scale(0.9) rotate(360deg); }
}

@keyframes moveBlob2 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(-120px, -100px) scale(0.8) rotate(-180deg); }
  100% { transform: translate(60px, -40px) scale(1.1) rotate(-360deg); }
}

@keyframes moveBlob3 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-80px, 120px) scale(1.3); }
  100% { transform: translate(100px, -80px) scale(0.8); }
}

/* ==========================================================================
   THEME TOGGLE BUTTON
   ========================================================================== */

.theme-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(var(--glass-blur));
  padding: 12px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-primary);
  box-shadow: 0 4px 12px var(--shadow-color);
  transition: all var(--transition-normal);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  border-color: var(--accent-purple);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Switch visibility based on state */
html[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}
html[data-theme="light"] .theme-toggle .sun-icon {
  display: none;
}

/* ==========================================================================
   AUTH LAYOUT & LOGO
   ========================================================================== */

.auth-container {
  width: 100%;
  max-width: 480px;
  padding: 20px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-header {
  display: flex;
  justify-content: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.logo svg {
  width: 28px;
  height: 28px;
  color: var(--accent-purple);
  filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
}

/* ==========================================================================
   GLASSMORTPHISM AUTH CARD
   ========================================================================== */

.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(var(--glass-blur));
  border-radius: 24px;
  box-shadow: 0 20px 40px var(--shadow-color);
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.auth-card:hover {
  box-shadow: 0 30px 60px var(--shadow-color);
}

/* Tab Switching Header */
.tabs-header {
  display: flex;
  position: relative;
  border-bottom: 1px solid var(--divider-color);
  padding: 8px 16px;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 16px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-normal);
  position: relative;
  z-index: 2;
}

.tab-btn.active {
  color: var(--text-primary);
}

/* Sliding active tab indicator */
.tab-indicator {
  position: absolute;
  bottom: 0;
  left: 16px;
  height: 3px;
  width: calc(50% - 16px);
  background: var(--primary-gradient);
  border-radius: 3px 3px 0 0;
  transition: transform var(--transition-slow);
  z-index: 1;
}

/* ==========================================================================
   SLIDER CAROUSEL FOR FORMS
   ========================================================================== */

.form-slider {
  width: 100%;
  overflow: hidden;
}

.form-wrapper {
  display: flex;
  width: 200%; /* Space for both forms */
  transition: transform var(--transition-slow);
  align-items: flex-start;
}

/* Toggle positions via classes on wrapper */
.form-wrapper.slide-register {
  transform: translateX(-50%);
}

.auth-form {
  width: 50%;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
}

.form-intro h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.form-intro p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* ==========================================================================
   FORM CONTROLS (Floating Labels & Validation)
   ========================================================================== */

.input-group {
  position: relative;
  display: flex;
  flex-direction: column;
}

.input-group input {
  width: 100%;
  padding: 16px 44px; /* Space for icons on left and right */
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-group input:hover {
  border-color: var(--input-border-hover);
}

.input-group input:focus {
  border-color: var(--input-focus);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

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

/* Float label to top when input is focused or not empty */
.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
  top: 0;
  left: 12px;
  transform: translateY(-50%) scale(0.85);
  background: var(--bg-primary);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--input-focus);
  font-weight: 600;
}

/* Icons inside Input */
.input-icon {
  position: absolute;
  left: 16px;
  top: 17px;
  color: var(--text-secondary);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.input-icon svg {
  width: 18px;
  height: 18px;
}

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

/* Password Toggle Button */
.password-toggle {
  position: absolute;
  right: 16px;
  top: 17px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

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

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.hidden {
  display: none !important;
}

/* Error Message styling */
.error-msg {
  color: var(--accent-pink);
  font-size: 0.8rem;
  margin-top: 5px;
  padding-left: 4px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.input-group.invalid input {
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.input-group.invalid .error-msg {
  opacity: 1;
  max-height: 24px;
  margin-top: 6px;
}

/* ==========================================================================
   PASSWORD STRENGTH METER
   ========================================================================== */

.strength-meter {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.strength-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--divider-color);
  border-radius: 2px;
  overflow: hidden;
}

.strength-bar {
  width: 0%;
  height: 100%;
  border-radius: 2px;
  transition: width var(--transition-normal), background-color var(--transition-normal);
}

.strength-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: color var(--transition-normal);
}

/* ==========================================================================
   SSO / SOCIAL AUTH
   ========================================================================== */

.sso-container {
  display: flex;
  gap: 12px;
  width: 100%;
}

.sso-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: var(--sso-bg);
  border: 1px solid var(--sso-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sso-btn:hover {
  background: var(--sso-hover);
  transform: translateY(-1px);
}

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

.sso-icon {
  width: 20px;
  height: 20px;
}

/* Divider styling */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 8px 0;
}

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

.divider span {
  padding: 0 10px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ==========================================================================
   FORM CHECKBOX & LINKS
   ========================================================================== */

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 26px;
  cursor: pointer;
  user-select: none;
}

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

/* Custom checkmark design */
.checkmark {
  position: absolute;
  left: 0;
  height: 18px;
  width: 18px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 5px;
  transition: all var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--input-border-hover);
}

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

/* Indicator mark */
.checkmark::after {
  content: "";
  position: absolute;
  display: none;
}

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

/* Stylize tick mark */
.checkbox-container .checkmark::after {
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label {
  color: var(--text-secondary);
}

.checkbox-label a {
  color: var(--accent-purple);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--transition-fast);
}

.checkbox-label a:hover {
  text-decoration: underline;
}

.forgot-link {
  color: var(--accent-purple);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--transition-fast);
}

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

/* ==========================================================================
   SUBMIT BUTTONS
   ========================================================================== */

.submit-btn {
  background: var(--primary-gradient);
  border: none;
  border-radius: 12px;
  padding: 16px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px var(--shadow-color);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  position: relative;
  overflow: hidden;
}

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

.submit-btn:hover::before {
  left: 100%;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--shadow-color);
}

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

.submit-btn svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.submit-btn:hover svg {
  transform: translateX(4px);
}

/* ==========================================================================
   RESET PASSWORD MODAL
   ========================================================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(var(--glass-blur));
  width: 90%;
  max-width: 400px;
  padding: 32px;
  border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  position: relative;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal.active .modal-card {
  transform: scale(1);
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

.close-btn svg {
  width: 20px;
  height: 20px;
}

.modal-intro h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal-intro p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* ==========================================================================
   TOAST NOTIFICATION SYSTEM
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
}

.toast {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(var(--glass-blur));
  border-radius: 12px;
  padding: 16px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 10px 25px var(--shadow-color);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(120%);
  animation: slideInToast 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: opacity 0.3s ease;
}

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

.toast.removing {
  opacity: 0;
  transform: translateX(120%);
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 6px;
}

.toast-success .toast-icon {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.toast-info .toast-icon {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.toast-icon svg {
  width: 20px;
  height: 20px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.toast-message {
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.3;
}

/* Toast Close Button */
.toast-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.toast-close:hover {
  opacity: 1;
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */

@media (max-width: 480px) {
  body {
    padding: 16px;
    justify-content: flex-start;
  }
  
  .auth-container {
    padding: 0;
    max-width: 100%;
  }
  
  .auth-card {
    border-radius: 20px;
  }
  
  .auth-form {
    padding: 24px;
    gap: 16px;
  }

  .theme-toggle {
    top: 16px;
    right: 16px;
    padding: 10px;
  }
  
  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px; /* Span full width on mobile */
  }
  
  .toast {
    min-width: unset;
  }
}
