/* =========================================================
   RB 3D Web Experience Layer
   ========================================================= */
#rb-3d-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(circle at 82% 14%, rgba(14, 165, 233, 0.14), transparent 50%),
              radial-gradient(circle at 12% 82%, rgba(99, 102, 241, 0.10), transparent 50%);
}

#rb-3d-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

body.rb-3d-active #page,
body.rb-3d-active .site,
body.rb-3d-active .elementor-location-header,
body.rb-3d-active .elementor-location-footer,
body.rb-3d-active main {
  position: relative;
  z-index: 1;
}

/* Glassmorphism su header */
body.rb-3d-active header.site-header,
body.rb-3d-active .header-sticky {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(14, 165, 233, 0.15);
}

/* =========================================================
   CUBO 3D INTERATTIVO (Hero & Prodotti)
   ========================================================= */
.rb-3d-cube-wrapper {
  position: relative;
  width: 100%;
  margin: 0 auto 2.2rem;
  user-select: none;
}

.rb-3d-cube-viewport {
  position: relative;
  width: 100%;
  perspective: 1800px;
  --rb-cube-tz: 450px;
}

.rb-3d-cube {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.95s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.rb-3d-cube-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  border-radius: 20px;
  pointer-events: none;
}

.rb-3d-cube-face.is-front {
  pointer-events: auto;
}

.rb-3d-cube-face--0 { transform: rotateY(0deg) translateZ(var(--rb-cube-tz)); }
.rb-3d-cube-face--1 { transform: rotateY(90deg) translateZ(var(--rb-cube-tz)); }
.rb-3d-cube-face--2 { transform: rotateY(180deg) translateZ(var(--rb-cube-tz)); }
.rb-3d-cube-face--3 { transform: rotateY(-90deg) translateZ(var(--rb-cube-tz)); }

.rb-3d-cube-shadow {
  width: 78%;
  height: 22px;
  margin: 14px auto 0;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.28) 0%, transparent 72%);
  filter: blur(6px);
  pointer-events: none;
}

/* Hero Cube dimensioni e slide */
.rb-3d-cube--hero .rb-3d-cube-viewport {
  height: 460px;
}

@media (max-width: 767px) {
  .rb-3d-cube--hero .rb-3d-cube-viewport {
    height: 330px;
  }
}

.rb-3d-hero-slide {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-color: #0f172a;
  position: relative;
  border-radius: 20px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.rb-3d-hero-slide__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.28) 55%, rgba(15, 23, 42, 0.08) 100%);
  display: flex;
  align-items: center;
  padding: 2.5rem 4.2rem;
}

@media (max-width: 767px) {
  .rb-3d-hero-slide__overlay {
    padding: 1.5rem 3rem;
  }
}

.rb-3d-hero-slide__content {
  max-width: 560px;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.rb-3d-hero-slide__content h2 {
  color: #ffffff !important;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 0.7rem;
}

.rb-3d-hero-slide__content p {
  color: #e2e8f0;
  font-size: 1.05rem;
  margin: 0 0 1.25rem;
}

.rb-3d-hero-slide__btn {
  display: inline-block;
  padding: 0.75rem 1.65rem;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #ffffff !important;
  font-weight: 700;
  border-radius: 9999px;
  text-decoration: none;
  box-shadow: 0 10px 25px -5px rgba(14, 165, 233, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rb-3d-hero-slide__btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 15px 30px -5px rgba(37, 99, 235, 0.65);
}

/* Prodotti Cube dimensioni e griglia interna */
.rb-3d-cube--products .rb-3d-cube-viewport {
  height: 365px;
}

.rb-3d-cube--products .rb-3d-cube-face {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 18px 46px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

ul.rb-3d-prod-face-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 16px !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

ul.rb-3d-prod-face-grid.columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

ul.rb-3d-prod-face-grid.columns-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  max-width: 620px;
  margin: 0 auto !important;
}

ul.rb-3d-prod-face-grid.rb-3d-prod-face-grid--single {
  grid-template-columns: minmax(220px, 300px) !important;
  justify-content: center;
}

ul.rb-3d-prod-face-grid > li.product {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 10px !important;
  float: none !important;
}

@media (max-width: 767px) {
  .rb-3d-cube--products .rb-3d-cube-viewport {
    height: 340px;
  }
  ul.rb-3d-prod-face-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .rb-3d-cube--products .rb-3d-cube-face {
    padding: 12px 34px;
  }
}

/* Frecce & Indicatori Cubo 3D */
.rb-3d-cube-nav {
  position: absolute;
  top: 46%;
  transform: translateY(-50%);
  z-index: 12;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s ease, background 0.2s ease;
}

.rb-3d-cube-nav:hover {
  background: #0284c7;
  transform: translateY(-50%) scale(1.1);
}

.rb-3d-cube-nav--prev { left: 10px; }
.rb-3d-cube-nav--next { right: 10px; }

.rb-3d-cube-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.rb-3d-cube-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 9999px;
  border: none;
  background: rgba(100, 116, 139, 0.35);
  cursor: pointer;
  transition: width 0.25s ease, background 0.25s ease;
}

.rb-3d-cube-dot.is-active {
  width: 26px;
  background: linear-gradient(90deg, #0ea5e9, #2563eb);
}

/* Card corsi 3D */
.rb-3d-card-enhanced {
  position: relative;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
  transform-style: preserve-3d;
  will-change: transform;
  background: rgba(255, 255, 255, 0.92) !important;
  border-radius: 14px !important;
  border: 1px solid rgba(56, 189, 248, 0.22) !important;
  box-shadow: 0 10px 24px -10px rgba(15, 23, 42, 0.16), 0 0 1px rgba(14, 165, 233, 0.25) !important;
  overflow: hidden;
}

.rb-3d-card-enhanced::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--rb-glare-x, 50%) var(--rb-glare-y, 50%), rgba(255, 255, 255, 0.42), transparent 55%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.rb-3d-card-enhanced:hover {
  box-shadow: 0 22px 42px -12px rgba(37, 99, 235, 0.28), 0 0 0 1px rgba(56, 189, 248, 0.5) !important;
}

.rb-3d-card-enhanced:hover::after {
  opacity: 1;
}

/* Shortcode showcase 3D */
.rb-3d-hero-banner {
  padding: 2.5rem;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(30, 58, 138, 0.82));
  color: #ffffff;
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.45);
}

.rb-3d-badge {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
  margin-bottom: 0.85rem;
}

/* Su checkout disattiva filtri visivi pesanti per massima reattività dei form */
body.rb-3d-checkout #rb-3d-stage {
  opacity: 0.3;
}


/* Rifiniture layout & allineamento card e header */
body.rb-3d-active header.site-header,
body.rb-3d-active .site-header {
  z-index: 50 !important;
}

.rb-3d-cube--products .rb-3d-cube-face {
  padding: 18px 54px;
}

.rb-3d-cube--products .rb-3d-cube-nav {
  width: 34px;
  height: 34px;
  font-size: 15px;
}
.rb-3d-cube--products .rb-3d-cube-nav--prev { left: 6px; }
.rb-3d-cube--products .rb-3d-cube-nav--next { right: 6px; }

ul.rb-3d-prod-face-grid {
  align-items: stretch !important;
}

ul.rb-3d-prod-face-grid > li.product,
ul.rb-3d-prod-face-grid > li.product .product-inner {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

ul.rb-3d-prod-face-grid > li.product .product-summary {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
}

ul.rb-3d-prod-face-grid > li.product .button,
ul.rb-3d-prod-face-grid > li.product a.add_to_cart_button {
  margin-top: auto !important;
  white-space: nowrap;
  font-size: 12px !important;
}
