/* Container per i pulsanti - FORZATO */
.buttons-container {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 16px !important;
  margin: 8px auto !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: 450px !important; /* Limita la larghezza massima */
  flex-wrap: wrap !important;
  text-align: center !important;
  flex-direction: column !important;
}

/* Discord Trapdoor Animation - Base */
.trapdoor {
  -webkit-transform: translateZ(0px);
  transform: translateZ(0px);
  -webkit-font-smoothing: antialiased;
  position: relative;
  margin: 0 !important; /* FORZATO a zero */
  width: 200px !important;
  height: 50px !important;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid;
  /* Ottimizzazioni per performance */
  will-change: transform, background-color, box-shadow;
  contain: layout style paint;
  -webkit-transition: all 400ms ease-in-out;
  -moz-transition: all 400ms ease-in-out;
  -ms-transition: all 400ms ease-in-out;
  -o-transition: all 400ms ease-in-out;
  transition: all 400ms ease-in-out;
  flex-shrink: 0 !important; /* Impedisce al flex item di restringersi */
}

/* Stili specifici per Discord */
.trapdoor.discord {
  box-shadow: 
    inset -7px 0px 12px -8px rgba(0,0,0,0.3), 
    inset 7px 0px 12px -8px rgba(0,0,0,0.3);
  background: rgba(88, 101, 242, 0.2);
  border-color: rgba(88, 101, 242, 0.5);
}

.trapdoor.discord:hover {
  background: rgba(88, 101, 242, 0.1);
  border-color: #5865F2;
  box-shadow: 0px 0px 20px rgba(88, 101, 242, 0.4);
}

.trapdoor.discord:hover .door {
  box-shadow: 0px 0px 15px rgba(0,0,0,0.3);
  -webkit-transform: scale(1.05);
  -moz-transform: scale(1.05);
  -ms-transform: scale(1.05);
  -o-transform: scale(1.05);
  transform: scale(1.05);
}

.trapdoor.discord .door {
  background: linear-gradient(135deg, #5865F2, #4752C4);
}

.trapdoor.discord:hover .discord-link {
  color: #5865F2;
  text-shadow: 0 0 10px rgba(88, 101, 242, 0.8);
}

/* Stili specifici per Reddit */
.trapdoor.reddit {
  box-shadow: 
    inset -7px 0px 12px -8px rgba(0,0,0,0.3), 
    inset 7px 0px 12px -8px rgba(0,0,0,0.3);
  background: rgba(255, 69, 0, 0.2);
  border-color: rgba(255, 69, 0, 0.5);
}

.trapdoor.reddit:hover {
  background: rgba(255, 69, 0, 0.1);
  border-color: #FF4500;
  box-shadow: 0px 0px 20px rgba(255, 69, 0, 0.4);
}

.trapdoor.reddit:hover .door {
  box-shadow: 0px 0px 15px rgba(0,0,0,0.3);
  -webkit-transform: scale(1.05);
  -moz-transform: scale(1.05);
  -ms-transform: scale(1.05);
  -o-transform: scale(1.05);
  transform: scale(1.05);
}

.trapdoor.reddit .door {
  background: linear-gradient(135deg, #FF4500, #CC3600);
}

.trapdoor.reddit:hover .discord-link {
  color: #FF4500;
  text-shadow: 0 0 10px rgba(255, 69, 0, 0.8);
}

/* Stili comuni per hover */
.trapdoor:hover .top {
  top: -55%;
}

.trapdoor:hover .bottom {
  top: 105%;
}

/* Nascondi l'icona quando il trapdoor viene hoverato */
.trapdoor:hover .discord-icon {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
}

.discord-link {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: white;
  text-decoration: none;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 600;
  font-size: 14px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 10px rgba(0,0,0,0.8);
  transition: all 300ms ease-in-out;
}

.trapdoor:hover .discord-link {
  opacity: 1;
  pointer-events: auto;
}

.door {
  -webkit-transition: all 500ms ease-in-out;
  -moz-transition: all 500ms ease-in-out;
  -ms-transition: all 500ms ease-in-out;
  -o-transition: all 500ms ease-in-out;
  transition: all 500ms ease-in-out;
  position: absolute;
  overflow: hidden;
  width: 100%;
  z-index: 2;
  height: 50%;
  box-shadow: 
    0px 2px 8px rgba(0,0,0,0.2),
    inset 0px 1px 0px rgba(255,255,255,0.2);
  /* Ottimizzazioni per performance */
  will-change: transform, top;
  contain: layout style paint;
  backface-visibility: hidden;
}

.top {
  top: 0%;
  left: 0px;
  border-radius: 8px 8px 0 0;
  transform-origin: bottom center;
}

.bottom {
  top: 50%;
  left: 0px;
  border-radius: 0 0 8px 8px;
  transform-origin: top center;
}

.door:before {
  content: none;
}

.discord-icon {
  position: absolute;
  font-size: 35px;
  color: white;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  transition: all 300ms ease-in-out;
  pointer-events: none;
}

.trapdoor:active {
  transform: scale(0.98);
}

@keyframes doorOpen {
  0% { transform: scale(1) rotateX(0deg); }
  50% { transform: scale(1.1) rotateX(-10deg); }
  100% { transform: scale(1.05) rotateX(0deg); }
}

.trapdoor:hover .door {
  animation: doorOpen 0.6s ease-in-out;
}

/* Bollino NEW per Reddit */
.new-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  background: linear-gradient(135deg, #FF4500, #FF6B35);
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  z-index: 15;
  box-shadow: 0 2px 8px rgba(255, 69, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  letter-spacing: 0.5px;
  animation: newBadgePulse 2s ease-in-out infinite;
}

@keyframes newBadgePulse {
  0%, 100% { 
    transform: scale(1); 
    box-shadow: 0 2px 8px rgba(255, 69, 0, 0.4);
  }
  50% { 
    transform: scale(1.1); 
    box-shadow: 0 4px 15px rgba(255, 69, 0, 0.6);
  }
}
/* Mantiene il bollino visibile anche durante l'hover del trapdoor */
.trapdoor.reddit:hover .new-badge {
  z-index: 20;
}

@media (min-width: 640px) {
  .buttons-container {
    gap: 16px !important; /* Gap aumentato anche per desktop (orizzontale) */
    flex-direction: row !important;
  }
}