/* ===== MARKETPLACE PAGE ===== */
.marketplace-page {
  padding: 140px 20px 60px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ---- Suchleiste ---- */
.search-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  gap: 10px;
}

.search-input-wrapper {
  display: flex;
  width: 100%;
  gap: 10px;
}

.search-bar input {
  flex: 1;
  max-width: 500px;
  padding: 12px 20px;
  border-radius: 30px;
  background: var(--bg-secondary);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: 0.3s;
}

.search-bar input:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.search-btn {
  background: var(--accent-violet);
  border: none;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s;
  color: #fff;
}

.search-btn:hover {
  background: var(--accent-pink);
  transform: scale(1.05);
}

/* ---- Layout: marketplace-sidebar + Grid ---- */
.marketplace-layout {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

/* ---- marketplace-sidebar ---- */
.marketplace-sidebar {
  flex: 0 0 260px;
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(139, 92, 246, 0.15);
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.marketplace-sidebar h3 {
  font-size: 1rem;
  color: var(--accent-violet);
  margin: 20px 0 10px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  padding-bottom: 6px;
}

.marketplace-sidebar h3:first-of-type {
  margin-top: 0;
}

.marketplace-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.marketplace-sidebar ul li {
  margin: 6px 0;
}

.marketplace-sidebar ul li label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
}

.marketplace-sidebar ul li label input[type="checkbox"] {
  accent-color: var(--accent-violet);
  width: 16px;
  height: 16px;
}

/* Range-Slider */
.range-slider {
  margin-bottom: 20px;
}

.range-slider label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 4px 0;
}

.range-slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent-violet);
  background: transparent;
}

.category-children {
  margin-left: 20px !important;
}

.filter-reset {
  width: 100%;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--accent-violet);
  color: var(--text-primary);
  border-radius: 10px;
  cursor: pointer;
  transition: 0.3s;
  font-weight: 600;
}

.filter-reset:hover {
  background: var(--accent-violet);
  color: #fff;
}

/* ---- Produkt-Grid ---- */
.product-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
}

/* ---- Produktkarte ---- */
.product-card {
  background: var(--bg-secondary);
  border-radius: 18px;
  border: 1px solid rgba(139, 92, 246, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Bild-Slider (vereinfacht) */
.product-image-slider {
  position: relative;
  background: var(--bg-card);
  overflow: hidden;
  height: 200px;
}

.product-image-slider img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s;
}

.slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 18px;
  z-index: 2;
}

.slider-nav.prev {
  left: 6px;
}

.slider-nav.next {
  right: 6px;
}

/* Meta-Daten oben */
.product-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 10px;
    padding: 10px 16px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.product-meta > span:nth-child(2) {
    text-align: right;
}

.product-meta .creator {
    grid-column: 1 / -1;
    justify-self: center;
    min-width: 0;
    max-width: 100%;
}

.product-meta .language {
  color: var(--accent-pink);
  font-weight: 600;
}

.product-meta .creator {
  color: var(--accent-violet);
}

/* Titel */
.product-title {
  font-size: 1rem;
  font-weight: 600;
  padding: 8px 16px 0;
  color: #fff;
}

/* Beschreibung */
.product-description {
  padding: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Datum */
.product-date {
  padding: 4px 16px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Preis & Buttons */
.product-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.product-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-violet);
}

.product-price.free {
  color: #4caf50;
}

.action-icons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.action-icons img {
  cursor: pointer;
  opacity: 0.7;
  transition: 0.2s;
}

.action-icons img:first-child {
  width: 22px;
  height: 22px;
}

.action-icons img:last-child {
  width: 28px;
  height: 28px;
}

.action-icons img:hover {
  opacity: 1;
  transform: scale(1.1);
}

.cart-icon-wrapper {
  position: absolute;
  cursor: pointer;
  display: flex;
  align-items: center;
  right: 300px;
}

.cart-icon {
  width: 32px;
  height: 32px;
  filter: invert(0.5);
  transition: 0.2s;
}

.cart-icon:hover {
  filter: invert(0.2);
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--accent-pink);
  color: #fff;
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  line-height: 1.2;
}

.cart-dropdown {
  position: fixed;
  right: 20px;
  top: 70px;
  background: var(--bg-secondary);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  padding: 16px;
  width: 400px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 2000;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.7);
  display: none;
}

.cart-dropdown.visible {
  display: block;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
  margin-bottom: 12px;
  font-weight: 600;
}

.cart-header button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.25s ease;
}

.cart-header button:hover {
    color: #ff4d4d;
    transform: rotate(90deg);
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

.cart-item .item-title {
  flex: 1;
}

.cart-item .item-price {
  margin: 0 12px;
  color: var(--accent-violet);
}

.cart-item .item-remove {
  cursor: pointer;
  color: var(--accent-pink);
  font-weight: bold;
  background: none;
  border: none;
  font-size: 1rem;
}

.cart-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 8px;
}

.cart-footer button {
  background: var(--accent-violet);
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}

.cart-footer button:hover {
  background: var(--accent-pink);
}

/* ---- Feste Höhe für Beschreibung ---- */
.product-description-wrapper {
  height: 80px;
  /* feste Höhe für 2 Sätze */
  overflow: hidden;
  padding: 4px 16px 0;
}

.product-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  /* alternativ falls height nicht reicht */
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

#cart-total {
  color: var(--accent-violet);
}

.cart-footer span {
  font-size: 1.3rem;
}

/* ============================================================
   CUSTOM CHECKBOXEN
   ============================================================ */

.custom-checkbox-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.custom-checkbox-list li {
  margin: 8px 0;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  position: relative;
  padding-left: 30px;
  user-select: none;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.custom-checkbox .checkmark {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: var(--bg-card);
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-radius: 4px;
  transition: all 0.2s;
}

.custom-checkbox input:checked+.checkmark {
  background: var(--accent-violet);
  border-color: var(--accent-violet);
}

.custom-checkbox input:checked+.checkmark::after {
  content: "✓";
  display: block;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 16px;
}

.custom-checkbox:hover .checkmark {
  border-color: var(--accent-violet);
}

.custom-checkbox input:focus+.checkmark {
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3);
}

/* ============================================================
   CUSTOM RANGE SLIDER
   ============================================================ */

.range-slider {
  margin-bottom: 24px;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.range-track {
  position: relative;
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 4px;
  margin: 10px 0;
}

.range-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent-violet);
  border-radius: 4px;
  pointer-events: none;
  opacity: 0.6;
}

/* Custom Range Inputs */
.custom-range {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  margin: 0;
  pointer-events: none;
}

.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-violet);
  cursor: pointer;
  pointer-events: auto;
  border: 2px solid var(--bg-secondary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
  transition: box-shadow 0.2s;
}

.custom-range::-webkit-slider-thumb:hover {
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}

.custom-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-violet);
  cursor: pointer;
  pointer-events: auto;
  border: 2px solid var(--bg-secondary);
}

.custom-range::-ms-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-violet);
  cursor: pointer;
  pointer-events: auto;
  border: 2px solid var(--bg-secondary);
}

/* Die beiden Slider überlappen – der zweite (max) liegt oben */
#price-min.custom-range {
  z-index: 1;
}

#price-max.custom-range {
  z-index: 2;
}

#size-min.custom-range {
  z-index: 1;
}

#size-max.custom-range {
  z-index: 2;
}

/* Optional: Glow-Effekt beim Fokus */
.custom-range:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.3), 0 0 20px rgba(139, 92, 246, 0.4);
}

/* ===== SORTIER-BUTTONS ===== */
.sort-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  width: 100%;
  justify-content: end;
}

.sort-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 30px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
}

.sort-btn:hover {
  border-color: var(--accent-violet);
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.1);
}

.sort-btn .sort-icon {
  font-size: 1rem;
  min-width: 16px;
  text-align: center;
  transition: 0.2s;
}

.sort-btn .sort-label {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sort-btn .sort-arrow {
  font-size: 1.5rem;
  color: var(--text-muted);
  transition: 0.2s;
}

/* Aktiver Sortierzustand */
.sort-btn.active-asc {
  border-color: var(--accent-violet);
  color: var(--accent-violet);
  background: rgba(139, 92, 246, 0.15);
}

.sort-btn.active-asc .sort-icon {
  color: var(--accent-violet);
}

.sort-btn.active-desc {
  border-color: var(--accent-pink);
  color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.15);
}

.sort-btn.active-desc .sort-icon {
  color: var(--accent-pink);
}

/* ===== DROPDOWN FÜR SPRACHE ===== */
.dropdown-wrapper {
  position: relative;
}

.dropdown-wrapper .dropdown-toggle {
  cursor: pointer;
  padding: 2px 15px !important;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-secondary);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 160px;
  z-index: 100;
  display: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.dropdown-menu.open {
  display: block;
}

.dropdown-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.dropdown-checkbox .checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-radius: 4px;
  position: relative;
  flex-shrink: 0;
}

.dropdown-checkbox input:checked+.checkmark {
  background: var(--accent-violet);
  border-color: var(--accent-violet);
}

.dropdown-checkbox .checkmark::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  display: none;
}

.dropdown-checkbox input:checked+.checkmark::after {
  display: block;
}

.dropdown-checkbox input {
  display: none;
}

section {
  height: unset !important;
}

/* ===== STARS ===== */
.stars {
  display: inline-flex;
  gap: 2px;
  letter-spacing: 2px;
}

.star {
  font-size: 14px;
}

.star.full {
  color: #FFD700;
  opacity: 1;
}

.star.half {
  color: #FFD700;
  opacity: 0.3;
  /* 0.3 ist besser für halbe Sterne */
}

.star.empty {
  color: #555;
}

.rating-info {
  padding-right: 16px;
  margin-left: 6px;
  color: #888;
  font-size: 12px;
}

.product-date-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

/* ===== PRODUCT STARS – HOVER ===== */
.product-stars {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}

.stars-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 20px;
  min-width: 80px;
  /* verhindert Springen, wenn Sterne verschwinden */
}

.stars {
  display: inline-flex;
  gap: 2px;
  letter-spacing: 1px;
  transition: opacity 0.25s ease, transform 0.25s ease;
  opacity: 1;
  transform: scale(1);
  justify-content: space-between;
  width: 100%;
}

.rating-number {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  font-weight: 600;
  color: #FFD700;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
  width: 100%;
}

/* Hover: Sterne ausblenden, Zahl einblenden */
.stars-container:hover .stars {
  opacity: 0;
  transform: scale(0.9);
}

.stars-container:hover .rating-number {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* Kaufzahl bleibt immer sichtbar */
.rating-info {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #888;
  font-size: 12px;
}

.purchase-icon {
  font-size: 16px;
}

.star {
  font-size: 14px;
}

.star.full {
  color: #FFD700;
  opacity: 1;
}

.star.half {
  color: #FFD700;
  opacity: 0.3;
}

.star.empty {
  color: #555;
}

.product-date-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

/* ===== AI-Badge auf Produktbildern ===== */

.ai-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent-pink);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 30px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  background: rgba(236, 72, 153, 0.9);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .search-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-input-wrapper {
    max-width: 100%;
  }

  .sort-buttons {
    justify-content: center;
  }

  .sort-btn {
    font-size: 0.75rem;
  }

  .dropdown-menu {
    left: auto;
    right: 0;
  }
}

@media (max-width: 480px) {
  .sort-buttons {
    flex-wrap: wrap;
    gap: 4px;
  }

  .sort-btn {
    font-size: 0.7rem;
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .marketplace-layout {
    flex-direction: column;
  }

  .marketplace-sidebar {
    flex: 1;
    position: static;
    max-height: none;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 600px) {
  .search-bar input {
    max-width: 100%;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }
}