/* ===================================
   COMPACT ADDON CARDS WITH TOOLTIPS
   =================================== */

/* ----- COMPACT GRID LAYOUT ----- */
.addon-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  align-items: stretch;
  grid-auto-rows: 1fr;
  isolation: isolate;
}

@media (max-width: 767px) {
  .addon-items-grid {
    grid-template-columns: 1fr;
  }
}

/* ----- COMPACT ADDON CARD ----- */
.addon-item-card {
  position: relative;
  padding: 1rem;

  background: rgba(17, 34, 64, 0.6);
  border: 1px solid rgba(33, 150, 243, 0.15);
  border-radius: 10px;

  transition: all var(--transition-base);
  cursor: default;
  overflow: visible;
  z-index: 10;

  /* Grid Layout: Header oben, Preis & Button nebeneinander */
  display: grid;
  grid-template-areas:
    "header header"
    "price button";
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 0.75rem 0.5rem;
}

.addon-item-card:hover {
  background: rgba(17, 34, 64, 0.8);
  border-color: rgba(33, 150, 243, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

/* Erhöhe z-index wenn Info-Icon gehovert wird (für Tooltip-Sichtbarkeit) */
.addon-item-card:has(.addon-info-icon:hover) {
  z-index: 1000;
}

/* ----- CARD HEADER (Name + Info Icon) ----- */
.addon-card-header {
  grid-area: header;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  position: relative;
}

.addon-item-card h4 {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
  line-height: 1.35;
  padding-right: 0.5rem;
}

/* ----- INFO ICON (Wie USP-Icons mit Overflow) ----- */
.addon-info-icon {
  position: absolute;
  right: -12px;
  top: -12px;
  z-index: 2;

  width: 32px;
  height: 32px;
  border-radius: 50%;

  background: linear-gradient(135deg, rgba(33, 150, 243, 0.9), rgba(33, 150, 243, 0.7));
  border: 2px solid rgba(33, 150, 243, 0.4);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);

  display: flex;
  align-items: center;
  justify-content: center;

  color: white;
  font-size: 14px;
  font-weight: 600;

  cursor: help;
  flex-shrink: 0;

  transition: all var(--transition-fast);
}

.addon-info-icon:hover {
  background: linear-gradient(135deg, rgba(33, 150, 243, 1), rgba(33, 150, 243, 0.8));
  border-color: rgba(33, 150, 243, 0.6);
  transform: scale(1.15);
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

/* ----- TOOLTIP (Opens UPWARD to the LEFT) ----- */
.addon-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  right: -12px;
  left: auto;
  transform: translateY(4px);

  width: 280px;
  max-width: 90vw;
  padding: var(--space-3);

  background: rgba(10, 25, 47, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(33, 150, 243, 0.3);
  border-radius: 10px;

  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05);

  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  text-align: left;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
}

/* Tooltip Arrow (Points DOWN) */
.addon-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 18px;
  left: auto;

  border: 6px solid transparent;
  border-top-color: rgba(10, 25, 47, 0.98);
}

/* Show Tooltip on Hover */
.addon-info-icon:hover .addon-tooltip,
.addon-tooltip:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(-4px);
  pointer-events: auto;
}

/* Mobile: Tooltip verstecken, stattdessen Modal */
@media (max-width: 767px) {
  .addon-tooltip {
    display: none !important;
  }
}

/* ----- ADDON INFO MODAL (NUR MOBIL) ----- */
.addon-info-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.addon-info-modal.is-open {
  display: flex;
}

.addon-info-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.addon-info-modal-content {
  position: relative;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(33, 150, 243, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.addon-info-modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.addon-info-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.addon-info-modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
  padding-right: var(--space-6);
}

.addon-info-modal-text {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* Desktop: Modal verstecken */
@media (min-width: 768px) {
  .addon-info-modal {
    display: none !important;
  }
}

/* ----- PRICE (Links in der Actions-Row) ----- */
.addon-price {
  grid-area: price;
  display: flex;
  align-items: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  margin: 0;
}

/* ----- ADD BUTTON (Icon-only, kompakt) ----- */
.addon-add-button {
  grid-area: button;
  padding: 0;
  margin: 0;
  width: 2rem;
  height: 2rem;
  justify-self: end;

  background: rgba(33, 150, 243, 0.1);
  border: 1px solid rgba(33, 150, 243, 0.2);
  border-radius: 5px;

  color: var(--color-primary);
  font-size: 0.875rem;

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: all var(--transition-fast);
}

.addon-add-button i {
  font-size: 0.875rem;
}

.addon-add-button:hover {
  background: rgba(33, 150, 243, 0.2);
  border-color: rgba(33, 150, 243, 0.4);
  transform: translateY(-1px);
}

.addon-add-button i {
  transition: transform var(--transition-fast);
}

.addon-add-button:hover i {
  transform: scale(1.15);
}

.addon-add-button:active {
  transform: translateY(0);
}

/* ----- SELECTED STATE (Toggle-fähig) ----- */
.addon-item-card.is-selected {
  background: rgba(33, 150, 243, 0.08);
  border-color: rgba(33, 150, 243, 0.4);
}

.addon-item-card.is-selected .addon-add-button {
  background: rgba(76, 175, 80, 0.15);
  border-color: rgba(76, 175, 80, 0.3);
  color: #4caf50;
}

.addon-item-card.is-selected .addon-add-button:hover {
  background: rgba(244, 67, 54, 0.15);
  border-color: rgba(244, 67, 54, 0.3);
  color: #f44336;
}

/* ----- COMPACT CARD ANIMATION ----- */
.addon-item-card {
  animation: fadeInCard 0.4s ease-out backwards;
}

@keyframes fadeInCard {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger animation for cards */
.addon-item-card:nth-child(1) { animation-delay: 0.05s; }
.addon-item-card:nth-child(2) { animation-delay: 0.1s; }
.addon-item-card:nth-child(3) { animation-delay: 0.15s; }
.addon-item-card:nth-child(4) { animation-delay: 0.2s; }
.addon-item-card:nth-child(5) { animation-delay: 0.25s; }
.addon-item-card:nth-child(6) { animation-delay: 0.3s; }
.addon-item-card:nth-child(7) { animation-delay: 0.35s; }
.addon-item-card:nth-child(8) { animation-delay: 0.4s; }
