/* Bilsalg — katalog med kategorier og opslag */

.page-bilsalg .bilsalg-page {
  position: relative;
  z-index: 1;
  padding: 6rem clamp(1.25rem, 4vw, 3rem) 4rem;
  min-height: calc(100dvh - 4.5rem);
}

.bilsalg-page__inner {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
}

.bilsalg-page__header {
  text-align: center;
  margin-bottom: 2.5rem;
  animation: bilsalg-in 0.65s ease both;
}

@keyframes bilsalg-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bilsalg-page__header {
    animation: none;
  }
}

.bilsalg-page__eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
}

.bilsalg-page__title {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 4.5vw, 2.625rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

.bilsalg-page__intro {
  margin: 0 auto;
  max-width: 38rem;
  color: rgba(241, 245, 249, 0.72);
  font-size: 1rem;
  line-height: 1.65;
}

/* Toolbar */
.bilsalg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0.875rem 1.125rem;
  border: 1px solid rgba(59, 158, 255, 0.22);
  border-radius: 16px;
  background: rgba(22, 27, 38, 0.88);
}

.bilsalg-toolbar[hidden] {
  display: none;
}

.bilsalg-toolbar__status {
  margin-right: auto;
  font-size: 0.875rem;
  color: rgba(241, 245, 249, 0.65);
}

/* Category filter */
.bilsalg-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.bilsalg-categories__btn {
  padding: 0.5rem 1.125rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(22, 27, 38, 0.88);
  color: rgba(241, 245, 249, 0.85);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.bilsalg-categories__btn:hover,
.bilsalg-categories__btn.is-active {
  color: var(--cyan);
  background: rgba(59, 158, 255, 0.08);
  border-color: rgba(59, 158, 255, 0.35);
}

/* Listing grid */
.bilsalg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.bilsalg-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(22, 27, 38, 0.88);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  transition: border-color 0.2s, transform 0.2s;
  overflow: hidden;
}

.bilsalg-card > :not(.bilsalg-card__image) {
  padding-left: 1.375rem;
  padding-right: 1.375rem;
}

.bilsalg-card > :last-child {
  padding-bottom: 1.25rem;
}

.bilsalg-card__category {
  margin: 0;
  padding-top: 1.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(241, 245, 249, 0.45);
}

.bilsalg-card__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: rgba(13, 15, 20, 0.65);
}

.bilsalg-card__image--placeholder {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(13, 15, 20, 0.8)),
    rgba(13, 15, 20, 0.65);
}

.bilsalg-card:hover {
  border-color: rgba(59, 158, 255, 0.25);
  transform: translateY(-2px);
}

.bilsalg-card__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.bilsalg-card__price {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: -0.01em;
}

.bilsalg-card__desc {
  margin: 0;
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: rgba(241, 245, 249, 0.72);
}

.bilsalg-card__badge {
  align-self: flex-start;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.bilsalg-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: rgba(241, 245, 249, 0.55);
  font-size: 1rem;
}

/* Editor */
.bilsalg-editor__hint {
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(59, 158, 255, 0.06);
  border: 1px solid rgba(59, 158, 255, 0.18);
  color: rgba(241, 245, 249, 0.75);
  font-size: 0.875rem;
  line-height: 1.55;
}

.bilsalg-editor__hint code {
  font-size: 0.8125rem;
  color: var(--cyan);
}

.bilsalg-editor__sections {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.bilsalg-editor__section {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1.125rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(22, 27, 38, 0.88);
}

.bilsalg-editor__section-head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.bilsalg-editor__listings {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding-left: 0.75rem;
  border-left: 2px solid rgba(59, 158, 255, 0.2);
}

.bilsalg-editor__listing {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(13, 15, 20, 0.78);
}

.bilsalg-editor__listing-head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.bilsalg-editor__category-field {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 8.5rem;
}

.bilsalg-editor__category-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(241, 245, 249, 0.45);
}

.bilsalg-editor__select {
  min-width: 8.5rem;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(13, 15, 20, 0.65);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--cyan) 50%),
    linear-gradient(135deg, var(--cyan) 50%, transparent 50%);
  background-position:
    calc(100% - 1.1rem) calc(50% + 0.15rem),
    calc(100% - 0.75rem) calc(50% + 0.15rem);
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
}

.bilsalg-editor__select:focus {
  outline: none;
  border-color: var(--cyan);
}

.bilsalg-editor__input,
.bilsalg-editor__textarea {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(13, 15, 20, 0.65);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.bilsalg-editor__textarea {
  border-radius: 12px;
  min-height: 4rem;
  resize: vertical;
  line-height: 1.5;
}

.bilsalg-editor__input:focus,
.bilsalg-editor__textarea:focus {
  outline: none;
  border-color: var(--cyan);
}

.bilsalg-editor__input--id {
  flex: 0 0 9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
}

.bilsalg-editor__input--title {
  flex: 1;
  min-width: 8rem;
  font-weight: 600;
}

.bilsalg-editor__input--price {
  flex: 0 0 7rem;
  font-variant-numeric: tabular-nums;
}

.bilsalg-editor__input--sort {
  flex: 0 0 4.5rem;
}

.bilsalg-editor__checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: rgba(241, 245, 249, 0.75);
  white-space: nowrap;
  cursor: pointer;
}

.bilsalg-editor__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(22, 27, 38, 0.8);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.bilsalg-editor__btn:hover {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(59, 158, 255, 0.35);
}

.bilsalg-editor__btn--danger {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.125rem;
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

.bilsalg-editor__btn--danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.55);
}

.bilsalg-editor__btn--add,
.bilsalg-editor__add-category {
  align-self: flex-start;
  border-style: dashed;
  border-color: rgba(59, 158, 255, 0.35);
  background: transparent;
  color: var(--cyan);
}

.bilsalg-editor__btn--add:hover,
.bilsalg-editor__add-category:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: var(--cyan);
}

.bilsalg-editor__image-host {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bilsalg-editor__image-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 7rem;
  padding: 1rem;
  border: 1px dashed rgba(59, 158, 255, 0.35);
  border-radius: 12px;
  background: rgba(13, 15, 20, 0.45);
  color: rgba(241, 245, 249, 0.72);
  font-size: 0.8125rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.bilsalg-editor__image-zone:hover,
.bilsalg-editor__image-zone.is-active,
.bilsalg-editor__image-zone:focus-visible {
  outline: none;
  border-color: var(--cyan);
  background: rgba(59, 158, 255, 0.06);
}

.bilsalg-editor__image-zone.is-uploading {
  opacity: 0.65;
  pointer-events: none;
}

.bilsalg-editor__image-zone p {
  margin: 0;
}

.bilsalg-editor__image-zone small {
  color: rgba(241, 245, 249, 0.45);
}

.bilsalg-editor__image-zone kbd {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
}

.bilsalg-editor__browse {
  border: none;
  background: none;
  padding: 0;
  color: var(--cyan);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bilsalg-editor__image-preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(13, 15, 20, 0.65);
}

.bilsalg-editor__image-preview img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.bilsalg-editor__btn--remove-image {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

@media (max-width: 640px) {
  .page-bilsalg .bilsalg-page {
    padding-top: 5.25rem;
  }

  .bilsalg-grid {
    grid-template-columns: 1fr;
  }
}
