/* ====================================================================
   BIONUL EDTECH PLATFORM — PREMIUM 3D INTERACTIVE AUTHENTICATION UI
   css/auth.css — Email + Password Auth | Dark 3D Theme | Mobile First
   ==================================================================== */

:root {
  --auth-bg-dark: #070512;
  --auth-bg-darker: #04030A;
  --auth-purple-glow: rgba(91, 61, 245, 0.28);
  --auth-indigo-glow: rgba(124, 58, 237, 0.22);
  --auth-cyan-glow: rgba(14, 165, 233, 0.16);
  --auth-card-bg: #FFFFFF;
  --auth-card-border: rgba(255, 255, 255, 0.85);
  --auth-card-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 8px 24px rgba(91, 61, 245, 0.2);
  --auth-text-dark: #0F172A;
  --auth-text-muted: #64748B;
  --auth-text-light: #94A3B8;
  --auth-input-border: #E2E8F0;
  --auth-primary: #5B3DF5;
  --auth-primary-hover: #4F2EF0;
  --auth-primary-gradient: linear-gradient(135deg, #5B3DF5 0%, #7C3AED 100%);
}

/* ====================================================================
   1. BASE PAGE & DARK 3D CANVAS WRAPPER
   ==================================================================== */
* {
  box-sizing: border-box;
}

body.auth-3d-page {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background-color: var(--auth-bg-dark);
  background-image: 
    radial-gradient(circle at 50% 12%, rgba(91, 61, 245, 0.26) 0%, transparent 60%),
    radial-gradient(circle at 10% 75%, rgba(124, 58, 237, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.16) 0%, transparent 50%),
    linear-gradient(180deg, #070512 0%, #0B0820 50%, #06040E 100%);
  color: #FFFFFF;
  font-family: var(--font-family, -apple-system, BlinkMacSystemFont, "Plus Jakarta Sans", "Segoe UI", Roboto, sans-serif);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  perspective: 1200px;
}

/* Background Interactive Canvas */
#auth-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Cursor Ambient Light */
.cursor-ambient-glow {
  position: fixed;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 61, 245, 0.22) 0%, rgba(124, 58, 237, 0.08) 45%, transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1;
  transition: opacity 0.4s ease, transform 0.15s ease-out;
  opacity: 0.85;
}

/* ====================================================================
   2. FLOATING 3D PROPS — MOVING OVER & AROUND THE LOGIN/SIGNUP BOX
   ==================================================================== */
.floating-3d-scene {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10; /* Floats over and around the card */
  overflow: visible;
}

.prop-3d {
  position: absolute;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 14px 28px rgba(91, 61, 245, 0.5));
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 1. Graduation Cap: Floats over top-left corner */
.prop-grad-cap {
  top: calc(50% - 310px);
  left: calc(50% - 245px);
  width: 76px;
  height: 76px;
  animation: floatGradCap 7s ease-in-out infinite alternate;
}

@keyframes floatGradCap {
  0% {
    transform: translateY(0) rotate(-6deg) scale(1);
  }
  50% {
    transform: translateY(-16px) translateX(6px) rotate(-1deg) scale(1.06);
  }
  100% {
    transform: translateY(12px) translateX(-4px) rotate(-10deg) scale(0.96);
  }
}

/* 2. Planet with Orbital Ring: Floats over top center */
.prop-planet-ring {
  top: calc(50% - 340px);
  left: 50%;
  transform: translateX(-50%);
  width: 84px;
  height: 84px;
  animation: floatPlanetRing 9s ease-in-out infinite alternate;
}

@keyframes floatPlanetRing {
  0% {
    transform: translateX(-50%) translateY(0) rotate(0deg) scale(1);
  }
  50% {
    transform: translateX(-50%) translateY(-14px) rotate(8deg) scale(1.08);
  }
  100% {
    transform: translateX(-50%) translateY(10px) rotate(-6deg) scale(0.95);
  }
}

/* 3. Crystal Cube: Floats over top-right corner */
.prop-crystal-cube {
  top: calc(50% - 300px);
  left: calc(50% + 180px);
  width: 72px;
  height: 72px;
  animation: floatCrystalCube 8s ease-in-out infinite alternate;
}

@keyframes floatCrystalCube {
  0% {
    transform: translateY(0) rotate(6deg) scale(1);
  }
  50% {
    transform: translateY(-18px) translateX(-8px) rotate(14deg) scale(1.05);
  }
  100% {
    transform: translateY(14px) translateX(4px) rotate(2deg) scale(0.95);
  }
}

/* 4. Open Book Orb: Floats over the left side card border */
.prop-book-orb {
  top: calc(50% - 60px);
  left: calc(50% - 260px);
  width: 66px;
  height: 66px;
  animation: floatBookOrb 7.5s ease-in-out infinite alternate;
}

@keyframes floatBookOrb {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg) scale(1);
  }
  50% {
    transform: translateY(-15px) translateX(12px) rotate(6deg) scale(1.07);
  }
  100% {
    transform: translateY(12px) translateX(-6px) rotate(-5deg) scale(0.96);
  }
}

/* 5. DNA Double Helix: Floats over the right side card border */
.prop-dna-helix {
  top: calc(50% - 40px);
  left: calc(50% + 205px);
  width: 60px;
  height: 90px;
  animation: floatDNAHelix 8.5s ease-in-out infinite alternate;
}

@keyframes floatDNAHelix {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  50% {
    transform: translateY(-20px) translateX(-10px) rotate(-8deg) scale(1.06);
  }
  100% {
    transform: translateY(15px) translateX(6px) rotate(5deg) scale(0.95);
  }
}

/* 6. Glowing Torus Ring: Floats over the bottom-left card corner */
.prop-torus-ring {
  top: calc(50% + 220px);
  left: calc(50% - 245px);
  width: 74px;
  height: 74px;
  animation: floatTorusRing 10s ease-in-out infinite alternate;
}

@keyframes floatTorusRing {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  50% {
    transform: translateY(-16px) translateX(10px) rotate(12deg) scale(1.08);
  }
  100% {
    transform: translateY(12px) translateX(-8px) rotate(-8deg) scale(0.94);
  }
}

/* 7. 3D Trophy Orb: Floats over the bottom-right card corner */
.prop-trophy-orb {
  top: calc(50% + 210px);
  left: calc(50% + 185px);
  width: 78px;
  height: 78px;
  animation: floatTrophyOrb 8s ease-in-out infinite alternate;
}

@keyframes floatTrophyOrb {
  0% {
    transform: translateY(0) rotate(-4deg) scale(1);
  }
  50% {
    transform: translateY(-18px) translateX(-10px) rotate(6deg) scale(1.09);
  }
  100% {
    transform: translateY(14px) translateX(6px) rotate(-10deg) scale(0.95);
  }
}

/* ====================================================================
   3. MAIN AUTHENTICATION CONTAINER & 3D CARD
   ==================================================================== */
.auth-page-main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  position: relative;
  z-index: 2;
  flex: 1;
}

/* 3D Tilt Card Container */
.auth-3d-card-wrapper {
  width: 100%;
  max-width: 440px;
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out;
  will-change: transform;
  position: relative;
}

.auth-3d-card {
  width: 100%;
  background: #FFFFFF;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 
    0 24px 60px rgba(0, 0, 0, 0.52),
    0 8px 24px rgba(91, 61, 245, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  padding: 30px 24px 24px 24px;
  position: relative;
  overflow: hidden;
  color: var(--auth-text-dark);
}

/* Top Subtle Card Highlight */
.auth-3d-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--auth-primary-gradient);
}

/* Brand Header Inside Card */
.auth-card-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 18px;
}

.auth-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  text-decoration: none;
}

.auth-logo-img {
  height: 44px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(0 2px 8px rgba(91, 61, 245, 0.15));
}

.auth-header-title {
  font-size: 1.38rem;
  font-weight: 850;
  color: var(--auth-text-dark);
  letter-spacing: -0.02em;
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.auth-header-sub {
  font-size: 0.82rem;
  color: var(--auth-text-muted);
  line-height: 1.42;
  margin: 0;
  max-width: 320px;
}

/* Mode Switcher Tabs */
.auth-tabs-pill {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #F1F5F9;
  border-radius: 9999px;
  padding: 4px;
  gap: 4px;
  margin: 16px 0 20px 0;
  border: 1px solid #E2E8F0;
}

.auth-tab-btn {
  padding: 9px 0;
  border: none;
  background: transparent;
  border-radius: 9999px;
  font-size: 0.86rem;
  font-weight: 750;
  color: var(--auth-text-muted);
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.auth-tab-btn:hover:not(.active) {
  color: var(--auth-text-dark);
}

.auth-tab-btn.active {
  background: var(--auth-primary-gradient);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(91, 61, 245, 0.35);
}

/* ====================================================================
   4. FORM ELEMENTS, INPUTS & FOCUS MICRO-INTERACTIONS
   ==================================================================== */
.auth-views-viewport {
  position: relative;
  overflow: hidden;
}

.auth-form-view {
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: block;
}

.auth-form-view.hidden {
  display: none;
  opacity: 0;
  transform: translateX(16px);
}

.auth-form-view.slide-left {
  animation: slideInFromLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-form-view.slide-right {
  animation: slideInFromRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInFromRight {
  0% { opacity: 0; transform: translateX(18px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes slideInFromLeft {
  0% { opacity: 0; transform: translateX(-18px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* Field Groups */
.auth-group {
  margin-bottom: 14px;
}

.auth-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.auth-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--auth-text-dark);
  letter-spacing: 0.01em;
  margin-bottom: 5px;
}

.auth-forgot-link {
  font-size: 0.76rem;
  font-weight: 750;
  color: var(--auth-primary);
  text-decoration: none;
  transition: color 0.18s;
  cursor: pointer;
}

.auth-forgot-link:hover {
  color: var(--auth-primary-hover);
  text-decoration: underline;
}

.auth-input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon-svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  fill: var(--auth-text-light);
  pointer-events: none;
  transition: fill 0.2s ease, transform 0.2s ease;
}

.auth-input {
  width: 100%;
  height: 48px;
  padding: 10px 14px 10px 42px;
  background: #F8FAFC;
  border: 1.5px solid var(--auth-input-border);
  border-radius: 14px;
  font-size: 0.92rem;
  color: var(--auth-text-dark);
  font-family: inherit;
  font-weight: 550;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-input::placeholder {
  color: #94A3B8;
  font-weight: 450;
}

.auth-input:hover {
  border-color: #CBD5E1;
  background: #FFFFFF;
}

.auth-input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3.5px rgba(91, 61, 245, 0.16), 0 2px 6px rgba(91, 61, 245, 0.08);
}

.auth-input:focus ~ .auth-input-icon-svg {
  fill: var(--auth-primary);
  transform: scale(1.08);
}

/* Custom Dropdown Select */
select.auth-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748B'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px;
  cursor: pointer;
  padding-right: 40px;
}

/* Password Eye Toggle */
.auth-eye-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  padding: 6px;
  color: var(--auth-text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.auth-eye-toggle:hover {
  color: var(--auth-primary);
  background: rgba(91, 61, 245, 0.08);
}

/* Helper Caption */
.auth-field-hint {
  font-size: 0.7rem;
  color: var(--auth-text-muted);
  margin-top: 4px;
  display: block;
}

/* Inline Alert / Error Banner */
.auth-alert-banner {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  animation: alertFadeIn 0.25s ease-out;
}

.auth-alert-banner.error {
  display: flex;
  background: #FEE2E2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.auth-alert-banner.success {
  display: flex;
  background: #ECFDF5;
  color: #059669;
  border: 1px solid #A7F3D0;
}

@keyframes alertFadeIn {
  0% { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Primary Submit Button */
.btn-auth-action {
  width: 100%;
  height: 50px;
  background: var(--auth-primary-gradient);
  color: #FFFFFF;
  border: none;
  border-radius: 14px;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 22px rgba(91, 61, 245, 0.38);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 16px;
  position: relative;
  overflow: hidden;
}

.btn-auth-action:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 10px 28px rgba(91, 61, 245, 0.48);
}

.btn-auth-action:active {
  transform: translateY(1px) scale(0.99);
}

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

/* Spinner inside button */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: btnSpin 0.75s linear infinite;
}

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

/* ====================================================================
   5. FEATURE HIGHLIGHT STRIP & TRUST BADGES
   ==================================================================== */
/* 3-Pill Feature Strip on Sign In (from reference) */
.auth-feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #F1F5F9;
}

.auth-feature-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.auth-feature-card:hover {
  transform: translateY(-2px);
  border-color: #CBD5E1;
  background: #FFFFFF;
}

.auth-feat-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #EDE9FE;
  color: var(--auth-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.auth-feat-icon-badge svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.auth-feat-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--auth-text-dark);
  line-height: 1.2;
  margin-bottom: 2px;
}

.auth-feat-desc {
  font-size: 0.64rem;
  color: var(--auth-text-muted);
  line-height: 1.2;
}

/* Trust Badges row on Create Account */
.auth-trust-pills-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #F1F5F9;
  flex-wrap: wrap;
}

.auth-trust-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 750;
  color: var(--auth-text-muted);
}

.auth-trust-pill-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ECFDF5;
  color: #10B981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
}

/* Back to Website Link */
.auth-footer-return {
  text-align: center;
  margin-top: 16px;
}

.auth-return-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--auth-text-muted);
  text-decoration: none;
  transition: color 0.18s ease;
}

.auth-return-btn:hover {
  color: var(--auth-primary);
}

/* ====================================================================
   6. FORGOT PASSWORD MODAL SHEET
   ==================================================================== */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 3, 10, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: modalOverlayFade 0.2s ease-out;
}

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

.auth-modal-card {
  width: 100%;
  max-width: 400px;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--auth-text-dark);
}

@keyframes modalOverlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.auth-modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #F1F5F9;
  border: none;
  font-size: 1.2rem;
  color: var(--auth-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
}

.auth-modal-close-btn:hover {
  background: #E2E8F0;
  color: var(--auth-text-dark);
}

/* ====================================================================
   7. RESPONSIVE BREAKPOINTS & MOBILE PERFORMANCE OPTIMIZATION
   ==================================================================== */
@media (max-width: 768px) {
  body.auth-3d-page {
    perspective: none !important;
    padding: 16px 0;
    -webkit-overflow-scrolling: touch;
  }

  /* Disable heavy 3D elements on mobile for 100% smooth 60fps experience */
  #auth-canvas {
    display: none !important;
  }

  .floating-3d-scene {
    display: none !important;
  }

  .cursor-ambient-glow {
    display: none !important;
  }

  .auth-3d-card-wrapper {
    transform: none !important;
    transition: none !important;
  }

  .auth-page-main {
    padding: 24px 14px 20px 14px;
  }

  .auth-3d-card {
    border-radius: 20px;
    padding: 24px 18px 20px 18px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  }

  .auth-logo-img {
    height: 40px;
  }

  .auth-header-title {
    font-size: 1.25rem;
  }

  /* 16px prevents iOS Safari auto-zoom lag */
  .auth-input {
    height: 48px;
    font-size: 16px !important;
    touch-action: manipulation;
  }

  .auth-feature-strip {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .auth-feat-title {
    font-size: 0.68rem;
  }

  .auth-feat-desc {
    display: none;
  }
}

@media (max-width: 480px) {
  .auth-3d-card {
    border-radius: 18px;
    padding: 20px 16px 18px 16px;
  }

  .auth-feature-strip {
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prop-3d {
    animation: none !important;
  }
  .auth-3d-card-wrapper {
    transition: none !important;
    transform: none !important;
  }
  .auth-form-view {
    transition: none !important;
  }
  .cursor-ambient-glow {
    display: none !important;
  }
  #auth-canvas {
    display: none !important;
  }
}
