/* components.css - reusable building blocks used across the shop and admin.
 * All colors via var(--...) defined in base.css. No hex literals here. */

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-target-min);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              transform var(--transition-fast);
  white-space: nowrap;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* The tapped button while its POST is on the way (#473): busy, not unavailable, so a spinner instead of the dimming. */
.btn[aria-busy="true"] { opacity: 1; cursor: progress; }
.btn[aria-busy="true"]::after {
  content: "";
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.btn:not(:disabled):active {
  transform: translateY(1px);
}

/* Variants */
.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-accent-fg);
}

.btn--primary:not(:disabled):hover {
  background-color: var(--color-accent-hover);
  color: var(--color-accent-fg);
}

.btn--secondary {
  background-color: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn--secondary:not(:disabled):hover {
  background-color: var(--color-surface);
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.btn--ghost {
  background-color: transparent;
  color: var(--color-accent);
}

.btn--ghost:not(:disabled):hover {
  background-color: var(--color-accent-soft);
  color: var(--color-accent-hover);
}

.btn--danger {
  background-color: var(--color-danger);
  color: var(--color-bg);
}

.btn--danger:not(:disabled):hover {
  background-color: var(--color-danger-text); /* a darker red; --color-text turned a Delete button near-black (#473) */
}

/* Sizes */
.btn--sm {
  min-height: 36px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
}

/* 36px is a pointer size; a finger gets the minimum - the phone header's Sell and Publish are this button (#473). */
@media (max-width: 599px) {
  .btn--sm { min-height: var(--touch-target-min); }
}

.btn--lg {
  min-height: 52px;
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-lg);
}

.btn--block {
  width: 100%;
  white-space: normal; /* full width has nowhere to overflow to: "Send kode til gendannelses-e-mail" wraps instead (#473) */
}

/* Icon button (no label) */
.btn--icon {
  padding: var(--space-2);
  min-width: var(--touch-target-min);
  aspect-ratio: 1;
}

/* ---- Form fields ---- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-block-end: var(--space-4);
}

.field__label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.field__label-note {
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
}

.field__label--required::after {
  content: " *";
  color: var(--color-danger);
}

.field__hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.field__error {
  font-size: var(--font-size-sm);
  color: var(--color-danger);
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: var(--touch-target-min);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background-color: var(--color-bg);
  color: var(--color-text);
  font-size: var(--font-size-md);
  line-height: var(--line-height-base);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

/* Combobox (#436): an input with a suggestion list under it. The anchor gives the list its edge; ui.js fills the list and
   sets aria-selected. Used by the town cell over the postal register; generic on purpose. */
.combo-anchor { position: relative; }

.combo {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: var(--space-1) 0 0;
  padding: var(--space-1);
  list-style: none;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 16rem;
  overflow-y: auto;
  z-index: 50;
}

.combo__option {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.combo__option:hover,
.combo__option[aria-selected="true"] {
  background-color: var(--color-accent-soft);
}

.combo__code {
  min-width: 3.5em;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.combo__more {
  padding: var(--space-1) var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--color-text-muted);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"],
.select[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

/* Search input variant with leading icon */
.input--search {
  padding-left: var(--space-10);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>");
  background-repeat: no-repeat;
  background-position: var(--space-3) center;
}

/* Checkbox & radio */
.choice {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch-target-min);
  cursor: pointer;
  font-size: var(--font-size-md);
}

.choice input[type="checkbox"],
.choice input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-accent);
}

/* Long checkbox groups (#402): two columns and a scroll cap keep a ten-country facet inside a phone panel; one column under 30rem. */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-1) var(--space-4);
  max-height: 13rem;
  overflow-y: auto;
}

.choice-grid .choice {
  min-height: 2rem;
  font-size: var(--font-size-sm);
}

@media (max-width: 30rem) {
  .choice-grid { grid-template-columns: 1fr; }
}

/* Select-all / clear as quiet text links: conveniences must not compete with Apply. */
.choice-tools {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.choice-tools button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
}

.choice-tools button:hover { text-decoration: underline; }

/* Avatar + name are one link to the profile; inherits colour, no underline, so it reads as the heading it replaced. */
.thread-header__who {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-md);
}

.thread-header__who:hover .thread-header__title,
.thread-header__who:focus-visible .thread-header__title {
  text-decoration: underline;
}

/* ---- Cards ---- */

.card {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card__header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.card__title {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

.card__body {
  padding: var(--space-4);
}

/* ---- Listing card (marketplace-specific) ---- */

.listing-card {
  /* position: relative anchors the kebab; overflow stays visible so its menu can pass the card edge, corners clip on __media. */
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              transform var(--transition-fast);
}

.listing-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
  text-decoration: none;
}

.listing-card__media {
  position: relative;
  /* Ratio and fit: --media-ratio / --media-fit in base.css (#418, #419). */
  aspect-ratio: var(--media-ratio);
  background-color: var(--color-surface-2);
  background-size: var(--media-fit);
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  /* The card does not clip (kebab menu), so the media rounds its own top corners; -1px for the card border. */
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
}

/* A real img since TASKS #422, so crawlers and image search see the photo and its alt text; the background rules
   above stay for the tile with no photo. */
.listing-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: var(--media-fit);
  /* A photo that fails to load would paint its alt text - the whole title - across the tile under the badge; the title
     is in the card body already, so the alt stays for readers and crawlers but not for the eye (#456). */
  color: transparent;
}

.listing-card__media-badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  /* Above the sold/hidden scrim below, which is an ::after on the media box and so paints last. */
  z-index: 1;
}

.listing-card__body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

.listing-card__title {
  overflow-wrap: anywhere;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.listing-card__price {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-top: var(--space-1);
}

.listing-card__meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
}

.listing-card--sold .listing-card__media::after,
.listing-card--hidden .listing-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.35);
}

/* With a kebab the card is a <div>; <a class="listing-card__main"> wraps media + body and the kebab sits over the media. */
.listing-card__main {
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.listing-card__main:hover {
  color: inherit;
  text-decoration: none;
}

/* ---- Kebab menu: three-dot actions on owner cards, anchored to .listing-card, may pass the card edge ---- */

.kebab {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 2;
}

.kebab__trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--color-text);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

/* var(--color-bg), not a literal (#364): opaque white is byte-identical to the token today and stays correct if a
   shop ever tints its background the way relooma tints --color-surface. */
.kebab__trigger:hover { background-color: var(--color-bg); }

.kebab__trigger .icon { width: 18px; height: 18px; }

.kebab__menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  min-width: 180px;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.kebab__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background-color: transparent;
  border: none;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.kebab__item:hover {
  background-color: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}

.kebab__item--danger { color: var(--color-danger); }
.kebab__item--danger:hover { color: var(--color-danger); }

.kebab__item .icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ---- Toasts: auto-dismissing pill, bottom centre; showToast(msg, kind) in ui.js or data-toast-onload from the server ---- */

.toast {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast--success {
  /* The dark companion, not the bright status colour: white on --color-success was 3.8:1 (#424). */
  background-color: var(--color-success-text);
  color: var(--color-bg);
}

.toast--error {
  background-color: var(--color-danger);
  color: var(--color-bg);
}

.toast--info {
  background-color: var(--color-text);
  color: var(--color-bg);
}

.toast .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---- Grid of listings ---- */

.listings-grid {
  display: grid;
  /* One card per row on phone - deliberate, not auto-fill; multi-column
     starts at the 600px breakpoint below. */
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 600px) {
  .listings-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
  }
}

@media (min-width: 960px) {
  .listings-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ---- Badges & pills ---- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: var(--color-surface-2);
  color: var(--color-text);
}

.badge--accent  { background-color: var(--color-accent-soft);  color: var(--color-accent-hover); }
.badge--success { background-color: var(--color-success-soft); color: var(--color-success-text); }
.badge--warning { background-color: var(--color-warning-soft); color: var(--color-warning-text); }
.badge--danger  { background-color: var(--color-danger-soft);  color: var(--color-danger-text); }

.badge--sold {
  background-color: var(--color-text);
  color: var(--color-bg);
}

/* Reserved is warning, not danger: "someone is ahead of you" is a caution; sold (solid black) is a refusal. */
.badge--reserved {
  background-color: var(--color-warning-soft);
  color: var(--color-warning-text);
}

/* The reserved note under the price: the badge's warning colour at body weight - a note, not a second badge. */
.listing__reserved {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--color-warning-soft);
  color: var(--color-warning-text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-base);
}

/* Filter pill (removable tag) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background-color: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  border: 1px solid var(--color-border);
}

.pill--active {
  background-color: var(--color-accent-soft);
  color: var(--color-accent-hover);
  border-color: var(--color-accent-soft);
}

.pill__close {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  color: inherit;
  background: transparent;
}

/* An invisible tap target at --touch-target-min, centred on the icon: the visible pill stays a small chip (WCAG 2.5.8 was
   only cleared here through the spacing exception, #366), the card's 32px kebab a small disc (#210, #473). */
.pill__close::before,
.kebab__trigger::before {
  content: "";
  position: absolute;
  inset: 50%;
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  transform: translate(-50%, -50%);
}

.pill__close:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

/* ---- Tabs ---- */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  margin-block-end: var(--space-4);
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast),
              border-color var(--transition-fast);
}

.tab:hover {
  color: var(--color-text);
}

.tab.is-active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.tab__count {
  background-color: var(--color-surface-2);
  color: var(--color-text);
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  min-width: 24px;
  text-align: center;
}

.tab.is-active .tab__count {
  background-color: var(--color-accent-soft);
  color: var(--color-accent-hover);
}

/* ---- Avatar: the member's photo when they uploaded one (#469), else their initials ---- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--color-accent-soft);
  color: var(--color-accent-hover);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  flex-shrink: 0;
  overflow: hidden;
}

/* The width/height attributes on the img only reserve space; the circle's own size wins. */
.avatar__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--lg {
  width: 64px;
  height: 64px;
  font-size: var(--font-size-xl);
}

.avatar--sm {
  width: 32px;
  height: 32px;
  font-size: var(--font-size-xs);
}

/* ---- Modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--color-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  z-index: 100;
}

@media (min-width: 600px) {
  .modal-overlay {
    align-items: center;
    padding: var(--space-4);
  }
}

.modal {
  background-color: var(--color-bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 600px) {
  .modal {
    border-radius: var(--radius-lg);
  }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.modal__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.modal__intro {
  color: var(--color-text-muted);
  margin-block-end: var(--space-3);
}

.modal__body {
  padding: var(--space-4);
}

.modal__footer {
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-2);
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
}

@media (min-width: 600px) {
  .modal__footer {
    flex-direction: row;
    justify-content: flex-end;
  }
}

/* ---- Toast / inline alerts ---- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
}

.alert--info {
  background-color: var(--color-info-soft);
  color: var(--color-info-text);
  border-color: var(--color-info);
}
.alert--warning {
  background-color: var(--color-warning-soft);
  color: var(--color-warning-text);
  border-color: var(--color-warning);
}
.alert--danger {
  background-color: var(--color-danger-soft);
  color: var(--color-danger-text); /* as its two siblings; the bright red on the tint was 3.95:1 (#424) */
  border-color: var(--color-danger);
}

/* ---- Dropdown menu ---- */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown__menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-1);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 12rem;
  padding: var(--space-1);
  z-index: 50;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  text-decoration: none;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
}

.dropdown__item:hover {
  background-color: var(--color-surface);
}

.dropdown__item--danger {
  color: var(--color-danger);
}

/* Language switcher (multi-language shops): a .dropdown in the navbar + a plain
   link row in the phone menu. Reuses the .dropdown machinery. */
.dropdown__menu--right {
  right: 0;
  left: auto;
}
.dropdown__item.is-active {
  font-weight: var(--font-weight-semibold);
}
/* Language and currency switchers pair up; hidden under 600px and offered in the drawer instead, like .navbar__signin at 960. */
.navbar__lang,
.navbar__cur,
.navbar__market {
  display: none;
}

@media (min-width: 600px) {
  .navbar__lang,
  .navbar__cur,
  .navbar__market {
    display: block;
  }
}

/* Icon-only market button under 1040px and language button under 1200px (names stay in aria-label/title). Measured: the fullest
   signed-in row is 947px at a 960px viewport only with these paddings and no button margins; the words return where they fit. */
.navbar__market > span,
.navbar__market .btn > span,
.navbar__lang .btn > span {
  display: none;
}

@media (min-width: 1040px) {
  .navbar__market > span,
  .navbar__market .btn > span { display: inline; }
}

@media (min-width: 1200px) {
  .navbar__lang .btn > span { display: inline; }
}

/* The symbol beside a currency code is muted: the code identifies (kr is two currencies), the symbol only helps recognise. */
.dropdown__hint {
  margin-left: var(--space-2);
  color: var(--color-text-muted);
}
.mobile-nav__langs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.mobile-nav__lang {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}
.mobile-nav__lang.is-active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}
/* The market chip is a <button> among <a> chips (it opens a popup), so the button chrome is stripped to match. */
button.mobile-nav__lang {
  font: inherit;
  background: none;
  cursor: pointer;
}

.dropdown__separator {
  height: 1px;
  background-color: var(--color-border);
  margin-block: var(--space-1);
}

/* ---- Empty state ---- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-4);
  gap: var(--space-3);
  color: var(--color-text-muted);
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  color: var(--color-text-subtle);
}

.empty-state__title {
  font-size: var(--font-size-lg);
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.empty-state__body {
  max-width: 28rem;
}

/* ---- Icon utility ---- */

.icon {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.icon--lg { width: 1.5em; height: 1.5em; }
.icon--sm { width: 1em;   height: 1em; }

/* ---- Top navigation bar (shop and admin) ---- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  height: 100%;
  /* The chrome tracks the widest page (--container-wide) so the logo lines up with the browse grid (#403). */
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.navbar__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
  color: var(--color-text);
  text-decoration: none;
}

.navbar__brand:hover {
  color: var(--color-text);
  text-decoration: none;
}

.navbar__brand-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background-color: var(--color-accent);
  color: var(--color-accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.navbar__nav {
  display: none;
  align-items: center;
  gap: 0;
  flex: 1;
  margin-left: var(--space-3);
}

/* Inline nav from 960px; below that the drawer carries the same links. Same breakpoint as .navbar__signin, .navbar__menu-toggle
   and .mobile-nav (shop.css) - move all four together. */
@media (min-width: 960px) {
  .navbar__nav { display: flex; }
}

/* nowrap: "Mine annoncer" must not break onto two lines. --space-2 padding: the signed-in admin row is measured to the pixel at 960px. */
.navbar__nav a {
  padding: var(--space-2);
  white-space: nowrap;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.navbar__nav a:hover {
  color: var(--color-text);
  background-color: var(--color-surface);
}

.navbar__nav a.is-active {
  color: var(--color-accent);
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Nothing in the actions row may shrink: .navbar__market's only child is an svg, so a short row squeezed it to 26px. Too wide = trim elsewhere. */
.navbar__actions > * {
  flex-shrink: 0;
}

/* Sign in / Sign out button: visible from desktop up; on phone and tablet it
   lives in the menu, at the same breakpoint as the inline nav above. */
.navbar__signin { display: none; }

@media (min-width: 960px) {
  .navbar__signin { display: inline-flex; }
}

.navbar__menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  border-radius: var(--radius-md);
  color: var(--color-text);
  position: relative;
}

/* Unread dot on the burger (#204): the badge lives inside the drawer and the new-message mail is suppressed for active users. */
.navbar__menu-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-danger);
}

/* Hamburger on phone and tablet; desktop shows the inline nav instead. */
@media (min-width: 960px) {
  .navbar__menu-toggle { display: none; }
}

/* ---- Footer ---- */

.footer {
  padding: var(--space-6) var(--space-4);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.footer__inner {
  max-width: var(--container-wide);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer__links a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer__links a:hover {
  color: var(--color-text);
  text-decoration: underline;
}

/* The shop's own social profiles (#447). Brand glyphs are FILLED shapes, not the stroked outlines every other icon
   here is, so .icon--brand overrides both. A 44px target because these sit at the bottom of a phone screen. */
.footer__social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.footer__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer__social-link:hover { color: var(--color-text); }
.footer__social .icon { width: 1.5em; height: 1.5em; }

.icon--brand {
  fill: currentColor;
  stroke: none;
}


@media (min-width: 600px) {
  .footer__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
/* ---- Navbar unread badge ---- */

.navlink {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* Accent, not danger red: an unread message is good news on a marketplace; red means destructive here. */
.navlink__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  background-color: var(--color-accent);
  color: var(--color-accent-fg);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  /* So 1 and 11 do not make the badge jump about between pages. */
  font-variant-numeric: tabular-nums;
}

/* ---- Small variants that replaced style attributes ---- */

a.listing-card__title { color: var(--color-text); text-decoration: none; }
.listing-card__reason { white-space: normal; }
.listing-card__actions { display: flex; gap: var(--space-2); margin-block-start: var(--space-3); }
.listing-card__actions > * { flex: 1; }
.textarea--short { min-height: 80px; }
.form--narrow { max-width: 45rem; }
.input--wide { min-width: 14rem; }
.input--reason { display: block; width: 14rem; margin-block-end: var(--space-1); }
.input--mono { font-family: var(--font-mono); }
.textarea--code { min-height: 200px; font-family: var(--font-mono); }
.quote {
  margin: var(--space-1) 0 0;
  padding: var(--space-2) var(--space-3);
  border-inline-start: 3px solid var(--color-border);
  font-style: italic;
}
.quote--new { border-inline-start-color: var(--color-accent); font-style: normal; }

/* A short aside the eye should find first: the legal contact block, the size guide's how-to-measure box (#427). */
.callout {
  background-color: var(--color-surface);
  border-left: 3px solid var(--color-accent);
  padding: var(--space-3) var(--space-4);
  margin-block: var(--space-3);
}
