/* === Grundlayout & Sticky Footer === */
html, body {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    scroll-behavior: smooth;
}

.page-wrapper {
    min-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

/* === Parallax Hero Bereich === */
.hero {
    background-image: url('../images/hero-bg.jpg');
    background-attachment: fixed;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: white;
    position: relative;
    padding-bottom: 20px; /* Weiter reduziert auf 20px, um die Nachricht noch näher zum unteren Rand zu bringen */
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2); /* Transparenz von 0.4 auf 0.2 reduziert für weniger Abdunkelung */
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    background: rgba(0, 0, 0, 0.6);
    padding: 2rem 3rem;
    border-radius: 10px;
    text-align: center;
    backdrop-filter: blur(4px);
}

/* === Dienstleistungen === */
.service-box {
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background-color: white;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.service-box:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.service-box img {
    border-radius: 8px;
    max-height: 200px;
    object-fit: cover;
}

.service-box h4 {
    color: #343a40;
    font-size: 1.5rem;
    margin-top: 15px;
}

.service-box p {
    color: #6c757d;
    margin-top: 10px;
}

/* Optimierte Scroll-Animation */
.scroll-fade {
  opacity: 0;
  transform: translateY(20px); /* Reduziert von 30px auf 20px für bessere Performance */
  transition: opacity 0.8s ease, transform 0.8s ease;
  will-change: opacity, transform;
}

.scroll-fade.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === Überschriften === */
h3 {
    font-size: 2rem;
    margin-bottom: 20px;
}

/* === Testimonials & Galerie === */
.row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 20px;
}

.row .col-md-4 {
    text-align: center;
    margin-bottom: 20px;
}

.row .col-md-4 img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
}

.row .col-md-4 h4 {
    margin-top: 10px;
    font-size: 1.2rem;
}

.row .col-md-4 p {
    color: #6c757d;
}

/* === Footer === */
footer {
    background-color: #f8f9fa;
    padding: 1rem 0;
    width: 100%;
    margin-top: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    padding: 0 15px;
}

footer .container p {
    text-align: center;
    margin-bottom: 0;
    flex: 1;
}

footer .container .text-end {
    text-align: right;
}

footer .container .text-end a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

/* === Responsive Styles === */
@media (max-width: 768px) {
    .hero {
        justify-content: center;
        padding-left: 0;
        text-align: center;
    }

    .hero-content {
        text-align: center;
    }

    footer .container {
        flex-direction: column;
        align-items: center;
    }

    footer .container p {
        margin-bottom: 10px;
    }

    footer .container .text-end {
        text-align: center;
    }

    .row {
        flex-direction: column;
        align-items: center;
    }

    .row .col-md-4 {
        width: 80%;
        margin-bottom: 20px;
    }
}

/* === Enhanced Animations CSS === */

/* GENERAL ANIMATION UTILITIES */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  60% { transform: translateY(-10px); }
}

.animate-delay-100 { animation-delay: 0.1s; }
.animate-delay-200 { animation-delay: 0.2s; }
.animate-delay-300 { animation-delay: 0.3s; }
.animate-delay-400 { animation-delay: 0.4s; }
.animate-delay-500 { animation-delay: 0.5s; }

/* === ENHANCED HERO SECTION === */
.hero {
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 0%, rgba(0,0,0,0.15) 100%); /* Transparenz von 0.3 auf 0.15 reduziert */
  z-index: 1;
}

.hero-content {
  animation: fadeIn 1.5s ease-out forwards;
  box-shadow: 0 15px 30px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
}

.hero-content h1 {
  animation: slideInUp 1s ease-out forwards;
}

.hero-content p {
  animation: slideInUp 1s ease-out 0.2s forwards;
  opacity: 0;
}

.hero-content .btn {
  animation: slideInUp 1s ease-out 0.4s forwards;
  opacity: 0;
  transition: all 0.3s ease;
}

.hero-content .btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Animated scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  animation: bounce 2s infinite;
  cursor: pointer;
}

.scroll-indicator::before {
  content: '';
  display: block;
  width: 30px;
  height: 30px;
  border-right: 3px solid white;
  border-bottom: 3px solid white;
  transform: rotate(45deg);
}

/* Reduzierte Animationen für bessere Performance */
@keyframes slowPan {
  0% { background-position: center center; }
  50% { background-position: calc(50% - 5px) calc(50% - 5px); }
  100% { background-position: center center; }
}

.hero {
  background-size: 105% auto; /* Weniger aufwändige Animation */
  animation: slowPan 60s ease-in-out infinite; /* Längere Animation für weniger Performance-Probleme */
}

/* Performance-Optimierungen */
.scroll-fade {
  will-change: opacity, transform;
  backface-visibility: hidden;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

/* === ENHANCED SERVICE BOXES === */
.service-box {
  position: relative;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}

.service-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 70%);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.5s ease;
  z-index: 0;
}

.service-box:hover::before {
  opacity: 1;
  transform: scale(1);
}

.service-box:hover {
  transform: translateY(-10px) scale(1.03);
  box-shadow: 0 20px 30px rgba(0,0,0,0.1);
}

.service-box img {
  transition: all 0.5s ease;
}

.service-box:hover img {
  transform: scale(1.1);
}

.service-box h4 {
  position: relative;
  display: inline-block;
}

.service-box h4::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 0;
  height: 3px;
  background: #0d6efd;
  transition: width 0.3s ease;
}

.service-box:hover h4::after {
  width: 100%;
}

/* Flip card effect */
.flip-card {
  perspective: 1000px;
  height: 300px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  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: 8px;
}

.flip-card-front {
  background-color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.flip-card-back {
  background-color: #0d6efd;
  color: white;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* === TESTIMONIALS SECTION === */
.testimonial {
  position: relative;
  padding: 30px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.testimonial:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.testimonial::before {
  content: '"';
  position: absolute;
  top: 15px;
  left: 15px;
  font-size: 60px;
  color: #0d6efd;
  opacity: 0.2;
  font-family: Georgia, serif;
}

.testimonial p {
  position: relative;
  z-index: 2;
  font-style: italic;
}

.testimonial footer {
  margin-top: 15px;
  font-weight: bold;
  text-align: right;
}

/* Rating stars */
.rating {
  display: flex;
  margin-bottom: 10px;
  justify-content: center;
}

.star {
  color: #ffc107;
  font-size: 20px;
  margin: 0 2px;
}

.star:nth-child(1) { animation: fadeIn 0.5s ease-out 0.1s forwards; opacity: 0; }
.star:nth-child(2) { animation: fadeIn 0.5s ease-out 0.2s forwards; opacity: 0; }
.star:nth-child(3) { animation: fadeIn 0.5s ease-out 0.3s forwards; opacity: 0; }
.star:nth-child(4) { animation: fadeIn 0.5s ease-out 0.4s forwards; opacity: 0; }
.star:nth-child(5) { animation: fadeIn 0.5s ease-out 0.5s forwards; opacity: 0; }

/* === VERBESSERTE GALERIE FÜR "UNSERE ARBEITEN" === */
.gallery-section {
  padding: 30px 0;
}

.gallery-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.gallery-item {
  position: relative;
  width: 100%;
  margin-bottom: 25px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.gallery-item img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* Fehlerbehandlung für nicht geladene Bilder */
.gallery-item img.error {
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}

.gallery-item img.error::after {
  content: 'Bild konnte nicht geladen werden';
  color: #6c757d;
  font-size: 14px;
  text-align: center;
}

/* Bildunterschriften für Vorher/Nachher */
.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 10px 15px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
  transform: translateY(100%);
}

.gallery-item:hover .gallery-caption {
  transform: translateY(0);
}

/* Vor/Nach-Vergleich Containerstil */
.before-after-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: 30px;
}

.before-after-container .img-fluid {
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.before-after-container .img-fluid:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

/* Labels für Vorher/Nachher */
.before-after-label {
  display: inline-block;
  padding: 5px 10px;
  background-color: #0d6efd;
  color: white;
  font-size: 12px;
  font-weight: bold;
  border-radius: 4px;
  margin: 10px 0;
}

/* Responsive Anpassungen für die Galerie */
@media (min-width: 768px) {
  .before-after-container {
    flex-direction: row;
    gap: 20px;
  }
  
  .before-after-container .col-md-4 {
    flex: 0 0 33.333333%;
  }
}

/* Image comparison slider */
.comparison-slider {
  position: relative;
  width: 100%;
  height: 300px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 30px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.comparison-slider .before,
.comparison-slider .after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.comparison-slider .before img,
.comparison-slider .after img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comparison-slider .after {
  width: 50%;
  border-right: 3px solid white;
}

.comparison-slider .slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 40px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: ew-resize;
}

.comparison-slider .slider-handle::before {
  content: '↔';
  background: white;
  color: #0d6efd;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Enhanced image gallery styling */
.image-container {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  height: 300px; /* Fixed height for gallery containers */
  margin-bottom: 30px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

/* === GENERAL UI ENHANCEMENTS === */
/* Call to action button animation */
.btn-animated {
  position: relative;
  overflow: hidden;
  z-index: 1;
  transition: all 0.5s ease;
}

.btn-animated::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.2);
  transition: all 0.5s ease;
  z-index: -1;
}

.btn-animated:hover::before {
  left: 100%;
}

.btn-animated:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Pulse animation for CTA */
.btn-pulse {
  animation: pulse 2s infinite;
}

/* Number counter animation */
.counter-box {
  text-align: center;
  padding: 20px;
  margin-bottom: 30px;
}

.counter {
  font-size: 3rem;
  font-weight: bold;
  color: #0d6efd;
  margin-bottom: 10px;
}

.counter-title {
  font-size: 1.2rem;
  color: #6c757d;
}

/* Loading animation */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #0d6efd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Navbar scroll effect */
.navbar {
  transition: all 0.3s ease;
}

.navbar.scrolled {
  background-color: white !important;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  padding-top: 5px;
  padding-bottom: 5px;
}

/* Custom section dividers */
.wave-divider {
  position: relative;
  height: 150px;
  margin-top: -150px;
}

.wave-divider svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  fill: white;
}

/* === Image Consistency Fixes === */

/* Fallback für fehlerhafte Bilder */
img.img-fluid {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 8px;
}

img.img-fluid:not([src]), 
img.img-fluid[src=""], 
img.img-fluid[src="undefined"], 
img.img-fluid[src="#"] {
  background-color: #f8f9fa;
  position: relative;
}

img.img-fluid:not([src])::after, 
img.img-fluid[src=""]::after, 
img.img-fluid[src="undefined"]::after, 
img.img-fluid[src="#"]::after {
  content: 'Bild nicht verfügbar';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #6c757d;
  font-size: 14px;
  text-align: center;
}

/* Ladezustand für Bilder */
.img-loading-state {
  position: relative;
  min-height: 300px;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.img-loading-state::before {
  content: '';
  width: 30px;
  height: 30px;
  border: 3px solid #e9ecef;
  border-top: 3px solid #0d6efd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Optimierte Darstellung für Vorher/Nachher im Vergleich */
.project-comparison {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
}

.project-image {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.project-image img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.project-image:hover img {
  transform: scale(1.05);
}

.project-label {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgba(13, 110, 253, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

@media (min-width: 768px) {
  .project-comparison {
    flex-direction: row;
  }
  
  .project-image {
    flex: 1;
  }
}

/* Service box image consistency */
.service-box img {
  height: 200px; /* Consistent height for service images */
  width: 100%;
  object-fit: cover;
  border-radius: 8px 8px 0 0; /* Rounded corners only at top */
  margin-bottom: 15px;
}

/* Better hero background handling */
.hero {
  background-image: url('../images/hero-bg.jpg');
  background-attachment: fixed;
  background-size: cover; /* Cover instead of stretched */
  background-position: center center;
  background-repeat: no-repeat;
  width: 100%;
  height: 80vh; /* Slightly shorter than 100vh to ensure it looks good */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: white;
  position: relative;
  padding-bottom: 20px; /* Weiter reduziert auf 20px */
}

/* Fix for mobile devices where fixed background can cause issues */
@media (max-width: 768px) {
  .hero {
    background-attachment: scroll; /* Better mobile performance */
    height: 70vh; /* Slightly shorter on mobile */
  }
}

/* Enhanced image gallery styling */
.image-container {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  height: 300px; /* Fixed height for gallery containers */
  margin-bottom: 30px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

/* JavaScript-Unterstützung für Bilderfehler */
.js-error-fallback {
  display: none;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 250px;
  background-color: #f8f9fa;
  color: #6c757d;
  text-align: center;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.js-error-fallback i {
  font-size: 40px;
  color: #dc3545;
  margin-bottom: 10px;
}

.js-error-fallback p {
  margin: 0;
  font-size: 14px;
}

/* Vorher/Nachher-Container mit optimierter Handhabung */
.before-after-pair {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
}

.before-after-image {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.before-after-image img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: all 0.3s ease;
}

.before-after-image:hover img {
  transform: scale(1.05);
}

.before-after-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(0,0,0,0.7);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  z-index: 2;
}

.before-after-pair .before-badge {
  background-color: rgba(220, 53, 69, 0.8); /* Bootstrap danger color */
}

.before-after-pair .after-badge {
  background-color: rgba(25, 135, 84, 0.8); /* Bootstrap success color */
}

@media (min-width: 768px) {
  .before-after-pair {
    flex-direction: row;
  }
  
  .before-after-image {
    flex: 1;
  }
}

/* Animation für die Bildanzeige */
@keyframes imageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gallery-section .img-fluid {
  animation: imageFadeIn 0.5s ease-in-out forwards;
}

/* Testimonial images consistency */
.testimonial img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 15px auto;
  border: 3px solid #0d6efd;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Flip card consistent sizing */
.flip-card {
  height: 350px; /* Fixed height for flip cards */
  perspective: 1000px;
  margin-bottom: 30px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  overflow: hidden;
}

.flip-card-front img {
  height: 180px; /* Consistent image height in flip cards */
  width: 100%;
  object-fit: cover;
}

/* Fix für die hero animation */
@keyframes slowPan {
  0% { background-position: center center; }
  50% { background-position: calc(50% - 5px) calc(50% - 5px); }
  100% { background-position: center center; }
}

.hero {
  animation: slowPan 60s ease-in-out infinite;
  background-size: 105% auto; /* Reduziert um Performance zu verbessern */
}

/* === Additional image styling and effects === */

/* Comparison slider labels */
.comparison-label {
  position: absolute;
  bottom: 10px;
  color: white;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  z-index: 5;
}

.before-label {
  left: 10px;
}

.after-label {
  right: 10px;
}

/* Image hover effects */
.image-container {
  overflow: hidden;
  position: relative;
}

.image-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 60%, rgba(0,0,0,0.7) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-container:hover::after {
  opacity: 1;
}

/* Service box image animation */
.service-box {
  overflow: hidden;
}

.service-box img {
  transition: transform 0.5s ease, filter 0.5s ease;
}

.service-box:hover img {
  transform: scale(1.05);
  filter: brightness(1.1);
}

/* Hero background loading state */
.hero {
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.3) 100%); /* Transparenz angepasst von 0.2/0.6 zu 0.1/0.3 */
  z-index: 1;
}

.hero.bg-loaded {
  animation: heroBgLoaded 1s forwards;
}

@keyframes heroBgLoaded {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

/* Fall back for hero background if image fails to load */
.hero.bg-fallback {
  background-image: linear-gradient(135deg, #0062cc, #0096ff) !important;
  animation: none;
}

/* Loading indicator for images */
.img-loading {
  position: relative;
}

.img-loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  margin-left: -15px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #0d6efd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 10;
}

/* Image placeholders with gradient */
.img-placeholder {
  background: linear-gradient(45deg, #e9ecef 25%, #dee2e6 25%, #dee2e6 50%, #e9ecef 50%, #e9ecef 75%, #dee2e6 75%, #dee2e6 100%);
  background-size: 20px 20px;
  position: relative;
}

.img-placeholder::after {
  content: '\1F4F7';  /* Camera emoji */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: #6c757d;
}

/* Fix for flip card images */
.flip-card-front {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flip-card-front img {
  flex: 0 0 180px;
  width: 100%;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
}

.flip-card-front h4 {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  margin: 0;
  padding: 15px;
}

/* Enhanced comparison slider design */
.comparison-slider {
  position: relative;
  height: 300px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.comparison-slider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 3;
  border-radius: 8px;
}

.comparison-slider .slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: white;
  transform: translateX(-50%);
  z-index: 3;
  cursor: ew-resize;
}

.comparison-slider .slider-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.comparison-slider .slider-handle::after {
  content: '↔';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #0d6efd;
  font-size: 16px;
  font-weight: bold;
}

/* Image gallery with consistent spacing */
.row.gallery-row {
  margin-left: -15px;
  margin-right: -15px;
}

.row.gallery-row .col-md-4 {
  padding: 15px;
}

/* Verbesserte Intersection Observer Implementation */
/* Der Selektor und die Animation bleiben gleich, nur der JavaScript-Teil wird angepasst */
/* Dies muss in der JavaScript-Datei aktualisiert werden, nicht im CSS */

/* Optimierung für mobile Geräte */
@media (max-width: 768px) {
  .hero {
    background-attachment: scroll;
    background-position: center center;
    animation: none !important;
  }
  
  /* Alternative mobile hero animation - deaktiviert für Performance */
  .hero {
    animation: none !important;
    background-size: 100% auto;
  }
  
  /* Reduzierte Animationen auf Mobilgeräten */
  .service-box:hover {
    transform: translateY(-5px) scale(1.02); /* Weniger intensive Animation */
  }
  
  .scroll-fade {
    transition: opacity 0.5s ease, transform 0.5s ease; /* Schnellere Übergänge */
  }
}