/* ═══════════════════════════════════════════════════════
   StudyAI — Premium 3D Effects System (Performance Optimized)
   ═══════════════════════════════════════════════════════ */

/* GPU Acceleration Layer */
.tilt-card, .btn-3d, .card-lift, .magnetic-hover, .depth-shadow,
.shine-sweep, .entrance-3d, .float-3d, .glass-3d {
  will-change: transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  contain: layout style;
}

/* 3D Tilt Card */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.2s ease-out, box-shadow 0.3s ease;
}
.tilt-card:hover {
  box-shadow: 0 20px 60px rgba(99, 102, 241, 0.12), 0 8px 20px rgba(0, 0, 0, 0.06);
}

/* 3D Floating — reduced on mobile */
@keyframes float-3d {
  0%, 100% { transform: translateY(0px) translateZ(0); }
  50% { transform: translateY(-6px) translateZ(0); }
}
.float-3d {
  animation: float-3d 6s ease-in-out infinite;
}
@media (max-width: 768px) {
  .float-3d { animation: none; }
}

/* 3D Button Press */
.btn-3d {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-3d:hover {
  transform: translateY(-2px) translateZ(0);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2), 0 4px 8px rgba(0, 0, 0, 0.06);
}
.btn-3d:active {
  transform: translateY(1px) translateZ(0);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

/* 3D Glass — optimized blur */
.glass-3d {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
@media (max-width: 768px) {
  .glass-3d {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

/* 3D Entrance — simplified */
@keyframes entrance-3d {
  0% { opacity: 0; transform: translateY(20px) translateZ(0); }
  100% { opacity: 1; transform: translateY(0) translateZ(0); }
}
.entrance-3d {
  animation: entrance-3d 0.4s ease-out forwards;
}

/* Staggered entrance — fewer children */
.entrance-stagger > * {
  opacity: 0;
  animation: entrance-3d 0.35s ease-out forwards;
}
.entrance-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.entrance-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.entrance-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.entrance-stagger > *:nth-child(4) { animation-delay: 0.2s; }
.entrance-stagger > *:nth-child(5) { animation-delay: 0.25s; }
.entrance-stagger > *:nth-child(6) { animation-delay: 0.3s; }

/* Depth Shadow — simplified layers */
.depth-shadow {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04), 0 12px 28px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.depth-shadow:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06), 0 20px 48px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px) translateZ(0);
}

/* Shine Sweep — GPU optimized */
.shine-sweep {
  position: relative;
  overflow: hidden;
}
.shine-sweep::after {
  content: "";
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: translateZ(0);
  transition: left 0.5s ease;
  pointer-events: none;
}
.shine-sweep:hover::after {
  left: 100%;
}

/* Card Lift */
.card-lift {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card-lift:hover {
  transform: translateY(-4px) translateZ(0);
  box-shadow: 0 16px 36px rgba(99, 102, 241, 0.1), 0 6px 12px rgba(0, 0, 0, 0.05);
}

/* Gradient Border Glow */
.glow-border {
  position: relative;
  border: 1px solid transparent;
  background-clip: padding-box;
}
.glow-border::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(236,72,153,0.3), rgba(99,102,241,0.3));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.glow-border:hover::before {
  opacity: 1;
}

/* Parallax Drift — disabled on mobile */
@keyframes parallax-drift {
  0%, 100% { transform: translate(0, 0) translateZ(0); }
  50% { transform: translate(4px, -8px) translateZ(0); }
}
.parallax-drift {
  animation: parallax-drift 10s ease-in-out infinite;
}
@media (max-width: 768px) {
  .parallax-drift { animation: none; }
}

/* Pulse Ring — simplified */
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.35); }
  70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}
.pulse-ring {
  animation: pulse-ring 2.5s infinite;
}

/* Magnetic Hover */
.magnetic-hover {
  transition: transform 0.25s ease;
}
.magnetic-hover:hover {
  transform: scale(1.04) translateZ(0);
}

/* ═══════════════════════ MOBILE PERFORMANCE ═══════════════════════ */
@media (max-width: 768px) {
  .depth-shadow:hover { transform: none; }
  .card-lift:hover { transform: none; }
  .shine-sweep::after { display: none; }
  .glow-border::before { display: none; }
  .tilt-card:hover { box-shadow: none; }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
