/* Cookie Banner Overlay */
.cookie-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cookie-overlay.active {
  opacity: 1;
  visibility: visible;
}

.cookie-banner {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateZ(0);
  width: 90%;
  max-width: 500px;
  background: rgba(10, 26, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  z-index: 9999;
  color: #fff;
  text-align: center;
  font-size: 0.95rem;
  animation: slide-up 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

@keyframes slide-up {
  from {
    transform: translateX(-50%) translateY(120%) translateZ(0);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0) translateZ(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .cookie-banner {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    transform: translateZ(0);
    border-radius: 12px 12px 0 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 26, 10, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: slide-up-mobile 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-sizing: border-box;
    padding: 1.5rem 1rem calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
    /* Stabile Höhe trotz URL-Leiste: svh = "small viewport height" */
    max-height: 90svh;
    max-height: 90dvh; /* Fallback für Browser die svh nicht unterstützen */
    /* CSS Custom Property als Fallback für ältere Browser */
    max-height: calc(var(--vh, 1vh) * 90);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    will-change: transform, opacity;
  }

  .cookie-banner::-webkit-scrollbar {
    width: 8px;
  }

  .cookie-banner::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
  }

  .cookie-banner::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
  }

  .cookie-banner::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
  }

  .cookie-buttons {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .cookie-btn {
    width: 100%;
    padding: 0.8rem 1rem;
  }

  @keyframes slide-up-mobile {
    0% {
      transform: translateY(100%) translateZ(0);
      opacity: 0;
    }
    100% {
      transform: translateY(0) translateZ(0);
      opacity: 1;
    }
  }
}

@media (max-height: 600px) {
  .cookie-banner {
    max-height: 100svh;
    max-height: 100dvh;
    max-height: calc(var(--vh, 1vh) * 100);
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
  
  .cookie-banner h3 {
    margin-top: 0;
    margin-bottom: 0.3rem;
  }
  
  .cookie-banner p {
    margin-bottom: 0.7rem;
  }
  
  .cookie-setting-item {
    margin-bottom: 0.5rem;
    padding: 0.4rem;
  }
}

/* Drag Handle für Swipe-to-Dismiss auf Mobile */
.cookie-drag-handle {
  display: none;
}

@media (max-width: 768px) {
  .cookie-drag-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 0 auto 0.75rem;
    cursor: grab;
    touch-action: none;
  }
  
  .cookie-drag-handle:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.5);
  }
  
  /* Verhindern dass Touch auf dem Banner die Seite scrollt */
  .cookie-banner {
    touch-action: pan-y;
    overscroll-behavior: contain;
  }
}

.cookie-banner h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.cookie-banner p {
  margin-bottom: 1rem;
  line-height: 1.5;
  opacity: 0.9;
}

.cookie-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.cookie-btn {
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.cookie-btn-accept {
  background: linear-gradient(135deg, #2d5a2d 0%, #1a3a1a 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.cookie-btn-accept:hover {
  background: linear-gradient(135deg, #3a6d3a 0%, #234723 100%);
}

.cookie-btn-reject {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
}

.cookie-btn-reject:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.cookie-btn-settings {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
}

.cookie-btn-settings:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.cookie-settings {
  margin-top: 1rem;
  display: none;
  text-align: left;
}

.cookie-settings.active {
  display: block;
  animation: fade-in 0.3s ease-out;
}

.cookie-setting-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start; 
  margin-bottom: 0.7rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 45px;
  height: 24px;
  flex-shrink: 0; 
  margin-left: 10px; 
  margin-top: 2px;
}

.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .4s;
  border-radius: 34px;
}

.cookie-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .cookie-toggle-slider {
  background-color: rgba(76, 175, 80, 0.8);
}

input:checked + .cookie-toggle-slider:before {
  transform: translateX(21px);
}

.cookie-info {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.5rem;
  max-width: calc(100% - 55px);
}

@media (max-width: 768px) {
  .cookie-setting-item {
    padding: 0.7rem;
  }
  
  .cookie-toggle {
    margin-top: 0;
  }
  
  .cookie-info {
    max-width: calc(100% - 65px);
  }
}

.hidden {
  display: none;
}

#open-cookie-settings {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

#open-cookie-settings:hover {
  opacity: 0.8;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Cookie-Einstellungs-Toggle */
.cookie-settings-toggler {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(10, 26, 10, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 990;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.2s ease;
  padding: 10px;
  opacity: 1;
}

.cookie-settings-toggler:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
}

.cookie-settings-toggler svg {
  width: 100%;
  height: 100%;
  stroke-width: 1.5;
}

@media (max-width: 768px) {
  .cookie-settings-toggler {
    bottom: 70px;
    right: 15px;
    width: 60px;
    height: 60px;
    padding: 9px;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
  }
  
  .cookie-settings-toggler.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* Trust Section */
.trust-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.trust-items {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.trust-icon {
    width: 32px;
    height: 32px;
    stroke: rgba(255, 255, 255, 0.5);
}

.trust-text {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
}
