.service {
  margin-top: 12rem;
}

.services-cards {
  display: flex;
  gap: 4rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.flip-container {
  perspective: 1200px;
  width: 420px;
  height: 320px;
  cursor: pointer;
}

.flip-box {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s ease;
}

/* Nur Desktop: Hover aktiviert Flip */
@media (hover: hover) and (pointer: fine) {
  .flip-container:hover .flip-box {
    transform: rotateY(180deg);
  }
}

/* Touch-Geräte: Flip durch Klick (per JS) */
.flip-container.flipped .flip-box {
  transform: rotateY(180deg);
}


.flip-front,
.flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  box-shadow: 0 0 25px rgba(144, 150, 158, 0.2);
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.flip-front {
  background: white;
  z-index: 2;
}

.flip-front h3 {
  font-size: 2.2rem;
  color: var(--main-color);
  margin-bottom: 1rem;
}

.flip-front p {
  font-size: 1.6rem;
  color: var(--text-color);
}

.flip-back {
  background: #f3f3f3;
  transform: rotateY(180deg);
  color: var(--text-color);
}

.flip-back p {
  font-size: 1.5rem;
  margin-bottom: 5rem;
}

/* Button-Stil */
.flip-back a,
.flip-back button {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.8rem 1.6rem;
  border: 0.2rem solid var(--main-color);
  background: transparent;
  color: var(--main-color);
  font-size: 1.4rem;
  border-radius: 8px;
  z-index: 1;
  overflow: hidden;
  transition: 0.5s;
}

.flip-back a:hover,
.flip-back button:hover {
  color: var(--bg-color);
}

.flip-back a::before,
.flip-back button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: var(--main-color);
  z-index: -1;
  transition: 0.5s;
}

.flip-back a:hover::before,
.flip-back button:hover::before {
  width: 100%;
}

/* Detailkarten-Overlay */
.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.detail-overlay:target {
  display: flex;
}

.detail-card {
  background: var(--bg-color);
  padding: 3rem;
  max-width: 600px;
  border-radius: 20px;
  color: var(--text-color);
  position: relative;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.detail-card h3 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

.detail-card h4 {
  font-size: 1.8rem;
  color: var(--main-color);
}

.detail-card p {
  font-size: 1.6rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.detail-card ul {
  margin-left: 4rem;
  font-size: 1.3rem;
}

.close-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-size: 2.5rem;
  color: var(--main-color);
  text-decoration: none;
  background: none;
  cursor: pointer;
}

.old-price {
  text-decoration: line-through;
  color: #999;
  margin-right: 1rem;
  font-size: 1.5rem;
}

.new-price {
  color: var(--main-color);
  font-weight: bold;
  font-size: 1.7rem;
}

/* Responsive Anpassungen */
@media (max-width: 991px) {
  .flip-container {
    width: 90%;
    height: auto;
    min-height: 300px;
  }

  .flip-front h3,
  .flip-back p {
    font-size: 2rem;
  }

  .flip-front p {
    font-size: 1.5rem;
  }

  .flip-back {
    padding: 2rem;
  }

  .flip-back a {
    font-size: 1.4rem;
    padding: 0.7rem 1.2rem;
  }

  .detail-card {
    width: 90%;
    max-width: 90%;
    padding: 2rem;
  }

  .detail-card h3 {
    font-size: 2.2rem;
  }

  .detail-card h4 {
    font-size: 1.6rem;
  }

  .detail-card p,
  .detail-card ul {
    font-size: 1.4rem;
  }

  .close-btn {
    font-size: 2rem;
  }
}

@media (max-width: 520px) {
  .flip-container {
    width: 100%;
    height: auto;
    min-height: 280px;
  }

  .flip-front h3 {
    font-size: 1.8rem;
  }

  .flip-front p {
    font-size: 1.4rem;
  }

  .flip-back p {
    font-size: 1.4rem;
  }

  .flip-back a {
    font-size: 1.2rem;
    padding: 0.6rem 1rem;
  }

  .detail-card {
    padding: 1.5rem;
  }

  .detail-card h3 {
    font-size: 2rem;
  }

  .detail-card p,
  .detail-card ul {
    font-size: 1.3rem;
  }

  .detail-card ul {
    margin-left: 2rem;
  }
}
