/* Advanced 3D Effects for ERP Company Website */

/* 3D Base Setup */
.preserve-3d {
  transform-style: preserve-3d;
  perspective: var(--perspective, 1000px);
}

.backface-hidden {
  backface-visibility: hidden;
}

/* Custom Mouse Cursor */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  mix-blend-mode: difference;
  transition: all 0.1s ease;
  transform: translate(-50%, -50%);
}

.cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transition: all 0.3s ease;
  transform: translate(-50%, -50%);
  opacity: 0.5;
}

.cursor-hover .cursor {
  transform: translate(-50%, -50%) scale(1.5);
  background: var(--accent-color);
}

.cursor-hover .cursor-follower {
  transform: translate(-50%, -50%) scale(1.2);
  border-color: var(--accent-color);
}

/* Loading Screen with 3D Cube */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-loading);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: white;
}

.cube-loader {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 2rem;
  transform-style: preserve-3d;
  animation: cubeRotate 2s infinite linear;
}

.cube-loader .cube {
  position: absolute;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.cube-loader .cube:nth-child(1) {
  transform: rotateX(0deg) rotateY(0deg) translateZ(40px);
  animation: cubeFloat 1s ease-in-out infinite alternate;
}

.cube-loader .cube:nth-child(2) {
  transform: rotateX(0deg) rotateY(90deg) translateZ(40px);
  animation: cubeFloat 1s ease-in-out infinite alternate 0.25s;
}

.cube-loader .cube:nth-child(3) {
  transform: rotateX(0deg) rotateY(180deg) translateZ(40px);
  animation: cubeFloat 1s ease-in-out infinite alternate 0.5s;
}

.cube-loader .cube:nth-child(4) {
  transform: rotateX(0deg) rotateY(270deg) translateZ(40px);
  animation: cubeFloat 1s ease-in-out infinite alternate 0.75s;
}

@keyframes cubeRotate {
  0% { transform: rotateX(0deg) rotateY(0deg); }
  100% { transform: rotateX(360deg) rotateY(360deg); }
}

@keyframes cubeFloat {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-10px); }
}

.progress-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 1rem auto;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: white;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* 3D Buttons */
.btn-3d {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  box-shadow: 
    0 4px 8px rgba(37, 99, 235, 0.2),
    0 0 0 1px rgba(37, 99, 235, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-3d::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn-3d:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 16px rgba(37, 99, 235, 0.3),
    0 0 0 1px rgba(37, 99, 235, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-3d:hover::before {
  transform: translateX(100%);
}

.btn-3d:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 4px rgba(37, 99, 235, 0.2),
    0 0 0 1px rgba(37, 99, 235, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  box-shadow: 
    0 4px 8px rgba(37, 99, 235, 0.1),
    inset 0 1px 0 rgba(37, 99, 235, 0.1);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 
    0 8px 16px rgba(37, 99, 235, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* 3D Cards */
.card-3d {
  position: relative;
  background: white;
  border-radius: var(--radius-xl);
  padding: 2rem;
  transition: all 0.4s ease;
  transform-style: preserve-3d;
  cursor: pointer;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 
    0 4px 6px rgba(0, 0, 0, 0.05),
    0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-3d::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.card-3d:hover {
  transform: translateY(-8px) rotateX(5deg);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 8px 16px rgba(0, 0, 0, 0.06);
}

.card-3d:hover::before {
  opacity: 0.03;
}

/* Floating Shapes */
.floating-shapes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  opacity: 0.1;
  animation: float 6s ease-in-out infinite;
}

.shape-1 {
  width: 60px;
  height: 60px;
  top: 20%;
  left: 10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 40px;
  height: 40px;
  top: 60%;
  left: 80%;
  animation-delay: 1s;
}

.shape-3 {
  width: 80px;
  height: 80px;
  top: 80%;
  left: 20%;
  animation-delay: 2s;
}

.shape-4 {
  width: 30px;
  height: 30px;
  top: 30%;
  left: 70%;
  animation-delay: 3s;
}

.shape-5 {
  width: 50px;
  height: 50px;
  top: 70%;
  left: 60%;
  animation-delay: 4s;
}

@keyframes float {
  0%, 100% { 
    transform: translateY(0) rotate(0deg); 
  }
  50% { 
    transform: translateY(-20px) rotate(180deg); 
  }
}

/* Particles Container */
.particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: particleFloat 8s linear infinite;
}

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-10vh) translateX(100px);
    opacity: 0;
  }
}

/* Hologram Effect */
.hologram-effect {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto;
  perspective: 1000px;
}

.hologram-grid {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  transform: translate(-50%, -50%) rotateX(60deg);
  background-image: 
    linear-gradient(rgba(59, 130, 246, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.3) 1px, transparent 1px);
  background-size: 20px 20px;
  animation: gridRotate 4s linear infinite;
}

.hologram-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary-color);
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
  animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes gridRotate {
  0% { transform: translate(-50%, -50%) rotateX(60deg) rotateZ(0deg); }
  100% { transform: translate(-50%, -50%) rotateX(60deg) rotateZ(360deg); }
}

@keyframes textGlow {
  0% { 
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    transform: translate(-50%, -50%) scale(1);
  }
  100% { 
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.8);
    transform: translate(-50%, -50%) scale(1.05);
  }
}

/* Floating Elements */
.floating-elements {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 400px;
  transform: translate(-50%, -50%);
}

.element {
  position: absolute;
  width: 60px;
  height: 60px;
  background: rgba(59, 130, 246, 0.1);
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--primary-color);
  animation: elementFloat 6s ease-in-out infinite;
}

.element-1 {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 0s;
}

.element-2 {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  animation-delay: 1.5s;
}

.element-3 {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 3s;
}

.element-4 {
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  animation-delay: 4.5s;
}

@keyframes elementFloat {
  0%, 100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  25% {
    transform: translateX(-50%) translateY(-10px) scale(1.1);
  }
  50% {
    transform: translateX(-50%) translateY(-5px) scale(1.05);
  }
  75% {
    transform: translateX(-50%) translateY(-15px) scale(1.1);
  }
}

/* 3D Flip Cards */
.flip-card {
  background-color: transparent;
  perspective: 1000px;
  height: 300px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem;
}

.flip-card-front {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: white;
}

.flip-card-back {
  background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
  color: white;
  transform: rotateY(180deg);
}

/* Tilt Effect */
.tilt-effect {
  transition: transform 0.3s ease;
  cursor: pointer;
}

.tilt-effect:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(5deg) scale3d(1.05, 1.05, 1.05);
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  animation: scrollBounce 2s infinite;
}

.scroll-mouse {
  width: 24px;
  height: 40px;
  border: 2px solid white;
  border-radius: 12px;
  position: relative;
  margin-bottom: 0.5rem;
}

.scroll-wheel {
  width: 4px;
  height: 8px;
  background: white;
  border-radius: 2px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollWheel 2s infinite;
}

@keyframes scrollBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-10px);
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

@keyframes scrollWheel {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
}

/* Responsive 3D Effects */
@media (max-width: 768px) {
  .card-3d:hover {
    transform: translateY(-4px) rotateX(2deg);
  }
  
  .btn-3d:hover {
    transform: translateY(-1px);
  }
  
  .hologram-effect {
    width: 250px;
    height: 250px;
  }
  
  .hologram-text {
    font-size: 2rem;
  }
  
  .floating-elements {
    width: 300px;
    height: 300px;
  }
  
  .element {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* Disable 3D effects for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .card-3d,
  .btn-3d,
  .flip-card-inner,
  .tilt-effect {
    transform: none !important;
  }
  
  .floating-shapes .shape,
  .floating-elements .element,
  .cube-loader,
  .scroll-indicator {
    animation: none !important;
  }
}

/* Performance optimizations */
.card-3d,
.btn-3d,
.flip-card-inner,
.tilt-effect {
  will-change: transform;
}

.floating-shapes .shape,
.floating-elements .element {
  will-change: transform, opacity;
}
