/* ===================================
   PRICE CALCULATOR - PREMIUM STICKY SIDEBAR
   Glassmorphism + Animations + Responsive
   =================================== */

/* ----- LAYOUT: DESKTOP 2-COLUMN GRID ----- */
.addon-calculator-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  position: relative;
}

@media (min-width: 1024px) {
  .addon-calculator-wrapper {
    grid-template-columns: 1fr 400px;
    gap: var(--space-7);
  }
}

/* ----- CALCULATOR CONTAINER ----- */
#addon-calculator {
  /* Initial: Hidden */
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#addon-calculator.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ----- DESKTOP: STICKY SIDEBAR WITH GLASSMORPHISM ----- */
@media (min-width: 1024px) {
  #addon-calculator {
    position: sticky;
    top: 100px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow: visible;
    z-index: 1;

    /* Glassmorphism */
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);

    /* Border mit Gradient */
    border: 1px solid rgba(33, 150, 243, 0.15);
    border-radius: 20px;

    /* Shadows & Glow */
    box-shadow:
      0 20px 60px rgba(0, 0, 0, 0.4),
      0 0 0 1px rgba(255, 255, 255, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);

    /* Subtle gradient overlay */
    position: relative;
  }

  #addon-calculator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
      transparent 0%,
      rgba(33, 150, 243, 0.5) 50%,
      transparent 100%
    );
  }

  /* Fade in from right */
  #addon-calculator {
    animation: slideInFromRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ----- MOBILE: FIXED BOTTOM BAR ----- */
@media (max-width: 1023px) {
  /* Platz für den fixen Calculator am unteren Rand schaffen */
  .addon-content {
    padding-bottom: 150px;
  }

  #addon-calculator {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;

    background: rgba(10, 25, 47, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    border-top: 2px solid rgba(33, 150, 243, 0.3);
    box-shadow:
      0 -10px 40px rgba(0, 0, 0, 0.5),
      0 0 0 1px rgba(255, 255, 255, 0.05);

    max-height: 80vh;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Collapsed State */
  #addon-calculator:not(.is-expanded) .calculator-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
  }

  /* Expanded State */
  #addon-calculator.is-expanded .calculator-content {
    max-height: 70vh;
    opacity: 1;
    overflow-y: auto;
  }
}

/* ----- MOBILE TOGGLE BUTTON ----- */
.calculator-mobile-toggle {
  display: none;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  color: var(--color-text-primary);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);

  transition: all var(--transition-fast);
}

@media (max-width: 1023px) {
  .calculator-mobile-toggle {
    display: flex;
  }
}

@media (min-width: 1024px) {
  .calculator-mobile-toggle {
    display: none !important;
  }
}

.calculator-mobile-toggle:hover {
  background: rgba(33, 150, 243, 0.1);
}

.calculator-mobile-count {
  font-size: var(--text-lg);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.calculator-mobile-toggle i {
  transition: transform var(--transition-base);
}

#addon-calculator.is-expanded .calculator-mobile-toggle i {
  transform: rotate(180deg);
}

/* ----- CALCULATOR CONTENT ----- */
.calculator-content {
  padding: var(--space-4);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

@media (max-width: 1023px) {
  .calculator-content {
    padding: var(--space-4);
  }
}

/* ----- HEADER ----- */
.calculator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(33, 150, 243, 0.15);
  position: relative;
}

.calculator-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--gradient-primary);
  box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
}

.calculator-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
  letter-spacing: -0.02em;
}

.calculator-close {
  display: none; /* Only for mobile */
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);

  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1023px) {
  .calculator-close {
    display: flex;
  }
}

.calculator-close:hover {
  background: rgba(255, 59, 48, 0.1);
  border-color: rgba(255, 59, 48, 0.3);
  color: #ff3b30;
  transform: scale(1.1);
}

/* ----- SELECTED ITEMS LIST ----- */
.calculator-selected-items {
  margin-bottom: var(--space-3);
  min-height: 80px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: var(--space-2);
}

@media (max-width: 1023px) {
  .calculator-selected-items {
    max-height: 250px;
  }
}

/* Custom Scrollbar */
.calculator-selected-items::-webkit-scrollbar {
  width: 6px;
}

.calculator-selected-items::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.calculator-selected-items::-webkit-scrollbar-thumb {
  background: rgba(33, 150, 243, 0.3);
  border-radius: 3px;
}

.calculator-selected-items::-webkit-scrollbar-thumb:hover {
  background: rgba(33, 150, 243, 0.5);
}

/* ----- SELECTED ITEM (BASIS-PAKET + ADD-ONS) ----- */
.calculator-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  overflow: visible;

  background: rgba(33, 150, 243, 0.05);
  border: 1px solid rgba(33, 150, 243, 0.1);
  border-radius: 12px;

  transition: all var(--transition-base);

  /* Animation */
  animation: slideInItem 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

@keyframes slideInItem {
  from {
    opacity: 0;
    transform: translateX(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.calculator-item:hover {
  background: rgba(33, 150, 243, 0.08);
  border-color: rgba(33, 150, 243, 0.2);
  transform: translateX(2px);
}

/* Basis-Paket (nicht entfernbar) */
.calculator-item.is-base {
  background: rgba(25, 118, 210, 0.1);
  border-color: rgba(25, 118, 210, 0.2);
  position: relative;
  overflow: hidden;
}

.calculator-item.is-base::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient-primary);
}

.calculator-item.is-base .calculator-item-name {
  font-weight: 600;
}

/* Remove Animation */
.calculator-item.removing {
  animation: slideOutItem 0.3s ease forwards;
}

@keyframes slideOutItem {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 100px;
    margin-bottom: var(--space-2);
  }
  to {
    opacity: 0;
    transform: translateX(20px) scale(0.9);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
}

/* Item Content */
.calculator-item-content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
}

.calculator-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(33, 150, 243, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 14px;
  flex-shrink: 0;
}

.calculator-item.is-base .calculator-item-icon {
  background: var(--gradient-primary);
  color: white;
}

.calculator-item-name {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  color: var(--color-text-primary);
  font-weight: 500;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.calculator-item-price {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 0.5rem;
  padding-top: 2px;
  text-align: right;
}

/* Remove Button (Top-right corner, partially outside) */
.calculator-item-remove {
  position: absolute;
  right: -8px;
  top: -8px;
  transform: scale(0.8);

  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 59, 48, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;

  opacity: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-fast);
}

.calculator-item:hover .calculator-item-remove {
  opacity: 1;
  transform: scale(1);
}

.calculator-item-remove:hover {
  background: rgba(255, 59, 48, 1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4);
}

/* Basis-Paket hat keinen Remove-Button */
.calculator-item.is-base .calculator-item-remove {
  display: none;
}

/* ----- TOTAL PRICE ----- */
.calculator-total {
  padding: var(--space-3);
  margin-bottom: var(--space-3);

  background: rgba(33, 150, 243, 0.05);
  border: 1px solid rgba(33, 150, 243, 0.2);
  border-radius: 16px;

  position: relative;
  overflow: hidden;
}

.calculator-total::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(135deg,
    rgba(33, 150, 243, 0.1) 0%,
    transparent 100%
  );
  pointer-events: none;
}

.calculator-total-label {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-2);
  font-weight: 600;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
}

.calculator-total-price {
  font-size: var(--text-2xl);
  font-weight: 800;

  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;

  letter-spacing: -0.02em;
  white-space: nowrap;

  transition: transform var(--transition-base);
}

.calculator-total-price.pulse {
  animation: pricePulse 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pricePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.calculator-total-suffix {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-left: var(--space-1);
}

/* ----- CTA BUTTON ----- */
.calculator-cta {
  width: 100%;
  padding: var(--space-3) var(--space-4);

  background: var(--gradient-primary);
  border: none;
  border-radius: 12px;

  color: white;
  font-size: var(--text-base);
  font-weight: 600;

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  box-shadow:
    0 4px 20px rgba(33, 150, 243, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1);

  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.calculator-cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  transition: left 0.6s ease;
}

.calculator-cta:hover::before {
  left: 100%;
}

.calculator-cta:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 30px rgba(33, 150, 243, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.2);
}

.calculator-cta:active {
  transform: translateY(0);
}

.calculator-cta i {
  transition: transform var(--transition-base);
}

.calculator-cta:hover i {
  transform: translateX(4px);
}

/* ----- EMPTY STATE ----- */
.calculator-empty {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--color-text-secondary);
}

.calculator-empty-icon {
  font-size: 48px;
  color: rgba(33, 150, 243, 0.2);
  margin-bottom: var(--space-3);
}

.calculator-empty-text {
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* ----- ADD-ON CARD BUTTONS ----- */
.addon-add-button {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);

  background: rgba(33, 150, 243, 0.1);
  border: 1px solid rgba(33, 150, 243, 0.2);
  border-radius: 8px;

  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: 600;

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  transition: all var(--transition-fast);
}

.addon-add-button:hover {
  background: rgba(33, 150, 243, 0.15);
  border-color: rgba(33, 150, 243, 0.3);
  transform: translateY(-1px);
}

.addon-add-button i {
  transition: transform var(--transition-fast);
}

.addon-add-button:hover i {
  transform: scale(1.2);
}

.addon-add-button:active {
  transform: translateY(0);
}

/* Added State */
.addon-item-card.is-added .addon-add-button {
  background: rgba(76, 175, 80, 0.1);
  border-color: rgba(76, 175, 80, 0.3);
  color: #4caf50;
  pointer-events: none;
}

.addon-item-card.is-added .addon-add-button i {
  transform: rotate(45deg);
}

/* ----- TOAST NOTIFICATION ----- */
.calculator-toast {
  position: fixed;
  top: 100px;
  right: var(--space-4);
  z-index: 9999;

  padding: var(--space-3) var(--space-4);

  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(33, 150, 243, 0.3);
  border-radius: 12px;

  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-weight: 500;

  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05);

  display: flex;
  align-items: center;
  gap: var(--space-2);

  opacity: 0;
  transform: translateX(100px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.calculator-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.calculator-toast.success {
  border-color: rgba(76, 175, 80, 0.3);
}

.calculator-toast.success i {
  color: #4caf50;
}

.calculator-toast.error {
  border-color: rgba(255, 59, 48, 0.3);
}

.calculator-toast.error i {
  color: #ff3b30;
}

@media (max-width: 767px) {
  .calculator-toast {
    top: auto;
    bottom: 100px;
    right: var(--space-3);
    left: var(--space-3);
  }
}

/* ----- ACCESSIBILITY ----- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Styles */
.calculator-cta:focus-visible,
.addon-add-button:focus-visible,
.calculator-item-remove:focus-visible,
.calculator-close:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===================================
   TRUST-BLOCK MIT 2-SPALTEN-LAYOUT
   =================================== */

/* Trust-Block mit 2-Spalten-Layout */
.trust-card-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: var(--space-5);
  align-items: center;
  background: rgba(17, 34, 64, 0.6);
  border: 1px solid rgba(33, 150, 243, 0.15);
  border-radius: 16px;
  padding: var(--space-5);
  overflow: hidden;
}

.trust-image-wrapper {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4/3;
  margin: calc(var(--space-1) * -1);
}

.trust-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;

  /* Farbtonkorrektur für bessere Integration */
  filter: brightness(0.85) contrast(1.1) saturate(0.9);
  position: relative;
}

/* Blauer Overlay für bessere Integration */
.trust-image-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(15, 23, 42, 0.3) 0%,
    rgba(33, 150, 243, 0.15) 100%);
  mix-blend-mode: multiply;
  pointer-events: none;
  border-radius: 12px;
}

.trust-content {
  padding-right: var(--space-2);
}

@media (max-width: 1023px) {
  .trust-card-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .trust-image-wrapper {
    aspect-ratio: 16/9;
  }
}

@media (max-width: 767px) {
  .trust-card-grid {
    padding: var(--space-4);
  }
}

/* ===================================
   DISCLAIMER-KACHEL IN ADD-ONS
   =================================== */

/* Disclaimer Card (Full-Width in Add-ons) */
.addon-disclaimer-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-4);
  align-items: center;

  /* Überspannt beide Spalten im addon-calculator-wrapper Grid */
  grid-column: 1 / -1;

  margin-top: var(--space-6);
  padding: var(--space-5);

  background: linear-gradient(135deg,
    rgba(33, 150, 243, 0.08) 0%,
    rgba(33, 150, 243, 0.04) 100%);
  border: 1px solid rgba(33, 150, 243, 0.2);
  border-radius: 16px;

  position: relative;
  overflow: hidden;
}

.addon-disclaimer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  box-shadow: 0 0 15px rgba(33, 150, 243, 0.4);
}

.disclaimer-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg,
    rgba(33, 150, 243, 0.2),
    rgba(33, 150, 243, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 24px;
  flex-shrink: 0;
}

.disclaimer-content {
  flex: 1;
  min-width: 0;
}

.disclaimer-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 var(--space-2);
  letter-spacing: -0.01em;
}

.disclaimer-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0;
}

.disclaimer-cta {
  flex-shrink: 0;
}

@media (max-width: 1023px) {
  .addon-disclaimer-card {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "icon content"
      "cta cta";
    gap: var(--space-3);
  }

  .disclaimer-icon {
    grid-area: icon;
  }

  .disclaimer-cta {
    grid-area: cta;
    justify-self: center;
    margin-top: var(--space-2);
  }
}

@media (max-width: 767px) {
  .addon-disclaimer-card {
    padding: var(--space-4);
  }

  .disclaimer-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .disclaimer-title {
    font-size: var(--text-base);
  }

  .disclaimer-cta .btn {
    width: 100%;
  }
}

/* ===================================
   ABOUT PAGE - "WAS UNS ANTREIBT" SECTION
   =================================== */

/* About Drive Grid mit 2-Spalten-Layout */
.about-drive-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  grid-template-areas: "image content";
  gap: var(--space-6);
  align-items: center;
  background: rgba(17, 34, 64, 0.6);
  border: 1px solid rgba(33, 150, 243, 0.15);
  border-radius: 16px;
  padding: var(--space-5);
  overflow: hidden;
}

.about-drive-image-wrapper {
  grid-area: image;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4/3;
  margin: calc(var(--space-1) * -1);
}

.about-drive-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;

  /* Farbtonkorrektur für bessere Integration */
  filter: brightness(0.85) contrast(1.1) saturate(0.9);
  position: relative;
}

/* Blauer Overlay für bessere Integration */
.about-drive-image-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(15, 23, 42, 0.3) 0%,
    rgba(33, 150, 243, 0.15) 100%);
  mix-blend-mode: multiply;
  pointer-events: none;
  border-radius: 12px;
}

.about-drive-content {
  grid-area: content;
  padding-right: var(--space-2);
}

@media (max-width: 1023px) {
  .about-drive-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .about-drive-image-wrapper {
    aspect-ratio: 16/9;
  }
}

@media (max-width: 767px) {
  .about-drive-grid {
    padding: var(--space-4);
  }
}
