/* Gem Blue 3D Cube Loading Animation */
.gem-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 12, 20, 0.95);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.gem-loader-overlay.active {
  display: flex;
}

.gem-loader {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.gem-loader .grid {
  width: 280px;
  height: 280px;
  position: relative;
  transform: rotateX(-35deg) rotateY(-45deg);
  transform-style: preserve-3d;
}

.gem-loader .grid * {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-style: preserve-3d;
}

.gem-loader .cube {
  transform-style: preserve-3d;
}

.gem-loader .cube:nth-child(1) { transform: translate3d(245px, 100px, 245px); }
.gem-loader .cube:nth-child(2) { transform: translate3d(315px, 100px, 245px); }
.gem-loader .cube:nth-child(3) { transform: translate3d(385px, 100px, 245px); }
.gem-loader .cube:nth-child(4) { transform: translate3d(455px, 100px, 245px); }
.gem-loader .cube:nth-child(5) { transform: translate3d(245px, 100px, 315px); }
.gem-loader .cube:nth-child(6) { transform: translate3d(315px, 100px, 315px); }
.gem-loader .cube:nth-child(7) { transform: translate3d(385px, 100px, 315px); }
.gem-loader .cube:nth-child(8) { transform: translate3d(455px, 100px, 315px); }
.gem-loader .cube:nth-child(9) { transform: translate3d(245px, 100px, 385px); }
.gem-loader .cube:nth-child(10) { transform: translate3d(315px, 100px, 385px); }
.gem-loader .cube:nth-child(11) { transform: translate3d(385px, 100px, 385px); }
.gem-loader .cube:nth-child(12) { transform: translate3d(455px, 100px, 385px); }
.gem-loader .cube:nth-child(13) { transform: translate3d(245px, 100px, 455px); }
.gem-loader .cube:nth-child(14) { transform: translate3d(315px, 100px, 455px); }
.gem-loader .cube:nth-child(15) { transform: translate3d(385px, 100px, 455px); }
.gem-loader .cube:nth-child(16) { transform: translate3d(455px, 100px, 455px); }

.gem-loader .lifter {
  transform-origin: 0 16.5px;
  transform: scaleY(0);
  animation: liftCube 0.7875s cubic-bezier(0.5, 0.1, 0.5, 0.9) alternate infinite;
}

.gem-loader .cube:nth-child(1) .lifter,
.gem-loader .cube:nth-child(1) .cube__face:nth-child(1) { animation-delay: 0s; }
.gem-loader .cube:nth-child(2) .lifter,
.gem-loader .cube:nth-child(2) .cube__face:nth-child(1) { animation-delay: 0.147s; }
.gem-loader .cube:nth-child(3) .lifter,
.gem-loader .cube:nth-child(3) .cube__face:nth-child(1) { animation-delay: 0.294s; }
.gem-loader .cube:nth-child(4) .lifter,
.gem-loader .cube:nth-child(4) .cube__face:nth-child(1) { animation-delay: 0.441s; }
.gem-loader .cube:nth-child(5) .lifter,
.gem-loader .cube:nth-child(5) .cube__face:nth-child(1) { animation-delay: 0.147s; }
.gem-loader .cube:nth-child(6) .lifter,
.gem-loader .cube:nth-child(6) .cube__face:nth-child(1) { animation-delay: 0.294s; }
.gem-loader .cube:nth-child(7) .lifter,
.gem-loader .cube:nth-child(7) .cube__face:nth-child(1) { animation-delay: 0.441s; }
.gem-loader .cube:nth-child(8) .lifter,
.gem-loader .cube:nth-child(8) .cube__face:nth-child(1) { animation-delay: 0.588s; }
.gem-loader .cube:nth-child(9) .lifter,
.gem-loader .cube:nth-child(9) .cube__face:nth-child(1) { animation-delay: 0.294s; }
.gem-loader .cube:nth-child(10) .lifter,
.gem-loader .cube:nth-child(10) .cube__face:nth-child(1) { animation-delay: 0.441s; }
.gem-loader .cube:nth-child(11) .lifter,
.gem-loader .cube:nth-child(11) .cube__face:nth-child(1) { animation-delay: 0.588s; }
.gem-loader .cube:nth-child(12) .lifter,
.gem-loader .cube:nth-child(12) .cube__face:nth-child(1) { animation-delay: 0.735s; }
.gem-loader .cube:nth-child(13) .lifter,
.gem-loader .cube:nth-child(13) .cube__face:nth-child(1) { animation-delay: 0.441s; }
.gem-loader .cube:nth-child(14) .lifter,
.gem-loader .cube:nth-child(14) .cube__face:nth-child(1) { animation-delay: 0.588s; }
.gem-loader .cube:nth-child(15) .lifter,
.gem-loader .cube:nth-child(15) .cube__face:nth-child(1) { animation-delay: 0.735s; }
.gem-loader .cube:nth-child(16) .lifter,
.gem-loader .cube:nth-child(16) .cube__face:nth-child(1) { animation-delay: 0.882s; }

.gem-loader .cube__face {
  margin: -550px;
  width: 66px;
  height: 66px;
  transition: background 0.35s ease-out;
}

.gem-loader .cube__face:nth-child(1) {
  transform: rotateX(90deg) rotateY(90deg) translateZ(16.5px);
  background: #101C28;
  animation: pulseFace 0.7875s cubic-bezier(0.4, 0.2, 0.4, 0.6) alternate infinite;
}

.gem-loader .cube__face:nth-child(2) {
  transform: rotateY(90deg) translateZ(16.5px);
  background: #2D59C8;
}

.gem-loader .cube__face:nth-child(3) {
  transform: translateZ(16.5px);
  background: #10AAFF;
}

.gem-loader .cube__face:nth-child(4) {
  transform: rotateX(90deg) translateZ(16.5px);
  background: #1E4DB7;
}

@keyframes liftCube {
  0% { transform: scaleY(0); }
  100% { transform: scaleY(0.533); }
}

@keyframes pulseFace {
  0% { background: #1B2E6E; }
  100% { background: #101C28; }
}

.gem-loader-text {
  position: relative;
  color: #10AAFF;
  font-size: 20px;
  font-weight: 600;
  white-space: nowrap;
  animation: pulse 1.5s infinite;
  text-shadow: 0 0 10px rgba(16, 170, 255, 0.5);
  text-align: center;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Mobile Fixes */
@media (max-width: 768px) {
  .gem-loader .grid {
    width: 200px;
    height: 200px;
    transform: rotateX(-35deg) rotateY(-45deg);
  }
  
  .gem-loader .cube:nth-child(1) { transform: translate3d(170px, 70px, 170px); }
  .gem-loader .cube:nth-child(2) { transform: translate3d(220px, 70px, 170px); }
  .gem-loader .cube:nth-child(3) { transform: translate3d(270px, 70px, 170px); }
  .gem-loader .cube:nth-child(4) { transform: translate3d(320px, 70px, 170px); }
  .gem-loader .cube:nth-child(5) { transform: translate3d(170px, 70px, 220px); }
  .gem-loader .cube:nth-child(6) { transform: translate3d(220px, 70px, 220px); }
  .gem-loader .cube:nth-child(7) { transform: translate3d(270px, 70px, 220px); }
  .gem-loader .cube:nth-child(8) { transform: translate3d(320px, 70px, 220px); }
  .gem-loader .cube:nth-child(9) { transform: translate3d(170px, 70px, 270px); }
  .gem-loader .cube:nth-child(10) { transform: translate3d(220px, 70px, 270px); }
  .gem-loader .cube:nth-child(11) { transform: translate3d(270px, 70px, 270px); }
  .gem-loader .cube:nth-child(12) { transform: translate3d(320px, 70px, 270px); }
  .gem-loader .cube:nth-child(13) { transform: translate3d(170px, 70px, 320px); }
  .gem-loader .cube:nth-child(14) { transform: translate3d(220px, 70px, 320px); }
  .gem-loader .cube:nth-child(15) { transform: translate3d(270px, 70px, 320px); }
  .gem-loader .cube:nth-child(16) { transform: translate3d(320px, 70px, 320px); }
  
  .gem-loader-text {
    font-size: 16px;
  }
}
