/*
 * com_pricelist — neutral, modern defaults that follow the template's text colour and font, so the page fits
 * light and dark templates alike. Every tint is mixed from currentColor; nothing sets its own colour.
 * Override the variables in your template CSS, e.g.
 * .pricelist { --pricelist-accent: #0a5c8a; --pricelist-radius: 0; }
 *
 * Width, side gutter and top offset come from the component options (Appearance) and are
 * set inline on the section as --pricelist-max-width, --pricelist-gutter and --pricelist-offset-top.
 */
.pricelist {
  --pricelist-accent: currentColor;
  --pricelist-border-color: color-mix(in srgb, currentColor 13%, transparent);
  --pricelist-line: color-mix(in srgb, currentColor 8%, transparent);
  --pricelist-surface: color-mix(in srgb, currentColor 3%, transparent);
  --pricelist-head-bg: var(--pricelist-surface);
  --pricelist-stripe: transparent;
  --pricelist-hover: color-mix(in srgb, currentColor 5%, transparent);
  --pricelist-tint: color-mix(in srgb, var(--pricelist-accent) 9%, transparent);
  --pricelist-muted: color-mix(in srgb, currentColor 62%, transparent);
  --pricelist-radius: 0.75rem;
  --pricelist-radius-sm: 0.375rem;
  --pricelist-pad-y: 0.85rem;
  --pricelist-pad-x: 1.125rem;
  --pricelist-max-width: 1200px;
  --pricelist-gutter: 1rem;
  --pricelist-offset-top: 0px;

  /* Own container, because many templates render the component area full width. */
  box-sizing: border-box;
  container: pricelist / inline-size;
  width: 100%;
  max-width: var(--pricelist-max-width);
  margin: 2rem auto;
  padding-inline: var(--pricelist-gutter);

  /* Clears a header that is positioned over the content (absolute/fixed). */
  padding-top: var(--pricelist-offset-top);
}

.pricelist *,
.pricelist *::before,
.pricelist *::after {
  box-sizing: border-box;
}

.pricelist__heading {
  margin: 0 0 1.75rem;
  line-height: 1.15;
  text-wrap: balance;
}

/* Keyboard focus is always visible, whatever the template does with outlines. */
.pricelist a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: var(--pricelist-radius-sm);
}

/* ---------------------------------------------------------------- Tables */

.pricelist__table-wrap {
  overflow-x: auto;
  border: 1px solid var(--pricelist-border-color);
  border-radius: var(--pricelist-radius);
}

.pricelist__table {
  width: 100%;
  /* Templates often give tables a bottom margin, which would show as a gap inside the bordered wrap. */
  margin: 0;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.pricelist__table th,
.pricelist__table td {
  padding: var(--pricelist-pad-y) var(--pricelist-pad-x);
  text-align: start;
  vertical-align: middle;
  border-bottom: 1px solid var(--pricelist-line);
}

/*
 * Templates often give th/td a grey background or stripe rows (e.g. "table tr:nth-child(odd) td");
 * that shows through as grey patches, most visibly in the phone cards. The component paints its own.
 */
.pricelist .pricelist__table tr,
.pricelist .pricelist__table tr > * {
  background: transparent;
  box-shadow: none;
  color: inherit;
}

.pricelist .pricelist__table thead th {
  padding-block: 0.7rem;
  border-bottom-color: var(--pricelist-border-color);
  background: var(--pricelist-head-bg);
  color: var(--pricelist-muted);
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pricelist__table tbody tr:last-child > * {
  border-bottom: 0;
}

.pricelist__table tbody tr:nth-child(even) {
  background: var(--pricelist-stripe);
}

.pricelist__table tbody tr {
  transition: background-color 0.15s ease;
}

.pricelist__table tbody tr:hover {
  background: var(--pricelist-hover);
}

.pricelist__table tbody th {
  font-weight: 500;
}

/* A light divider between the name and the prices (in the cards it is reset with the other borders). */
.pricelist__table .pricelist__col-name {
  border-inline-end: 1px solid var(--pricelist-line);
}

.pricelist__table .pricelist__col-price,
.pricelist__table .pricelist__col-anchor {
  text-align: end;
  white-space: nowrap;
}

.pricelist__table td.pricelist__col-price {
  font-weight: 650;
}

.pricelist__table td.pricelist__col-anchor {
  color: var(--pricelist-muted);
}

.pricelist__anchor-date {
  display: block;
  font-size: 0.8em;
  font-weight: 400;
}

.pricelist__badge {
  display: inline-block;
  padding: 0.2em 0.65em;
  border: 1px solid color-mix(in srgb, var(--pricelist-accent) 22%, transparent);
  border-radius: 999px;
  background: var(--pricelist-tint);
  color: var(--pricelist-accent);
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

/*
 * Trader's product list: up to eight columns, so the headers may wrap and cells are a bit tighter.
 * Where the component area is narrower than the full table needs, products become cards (see the
 * container query at the end), whatever the viewport is.
 */
.pricelist__table--products {
  --pricelist-pad-x: 0.8rem;
}

.pricelist .pricelist__table--products thead th {
  white-space: normal;
  vertical-align: bottom;
  hyphens: auto;
}

.pricelist__brand {
  display: block;
  margin-top: 0.1rem;
  color: var(--pricelist-muted);
  font-size: 0.82em;
  font-weight: 400;
}

.pricelist__table .pricelist__col-code,
.pricelist__table .pricelist__col-barcode {
  white-space: nowrap;
}

.pricelist__table td.pricelist__col-code,
.pricelist__table td.pricelist__col-barcode {
  color: var(--pricelist-muted);
  font-size: 0.9em;
}

.pricelist__table .pricelist__col-unit-price {
  text-align: end;
  white-space: nowrap;
  color: var(--pricelist-muted);
}

.pricelist__available {
  color: var(--pricelist-muted);
  font-size: 0.875em;
}

.pricelist__badge--unavailable {
  border-style: dashed;
  background: transparent;
}

.pricelist__row--unavailable .pricelist__col-name,
.pricelist__row--unavailable .pricelist__col-price {
  opacity: 0.65;
}

.pricelist__empty {
  margin: 0;
  padding: 2rem 1.5rem;
  border: 1px dashed var(--pricelist-border-color);
  border-radius: var(--pricelist-radius);
  color: var(--pricelist-muted);
  text-align: center;
}

/* ------------------------------------------ "Preuzmi cjenik" box under the table */

.pricelist__get {
  margin: 2rem 0 0;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--pricelist-border-color);
  border-radius: var(--pricelist-radius);
  background: var(--pricelist-surface);
  font-size: 0.9375em;
}

.pricelist__get p {
  margin: 0;
}

.pricelist__get-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 2rem;
}

.pricelist__get-heading {
  margin: 0 0 0.25rem;
  font-size: 1.2em;
  font-weight: 600;
  line-height: 1.3;
}

.pricelist__get-meta {
  color: var(--pricelist-muted);
}

.pricelist__downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pricelist .pricelist__download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 2.75rem;
  padding: 0 1.15em;
  border: 1px solid color-mix(in srgb, var(--pricelist-accent) 35%, transparent);
  border-radius: var(--pricelist-radius-sm);
  background: transparent;
  color: var(--pricelist-accent);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

/* Download arrow, drawn in CSS so it follows the accent colour. */
.pricelist__download::before {
  content: "";
  flex: none;
  width: 0.95em;
  height: 0.95em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7 1h2v8.2l2.8-2.8 1.4 1.4L8 13 2.8 7.8l1.4-1.4L7 9.2zM2 14h12v2H2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7 1h2v8.2l2.8-2.8 1.4 1.4L8 13 2.8 7.8l1.4-1.4L7 9.2zM2 14h12v2H2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.pricelist .pricelist__download:hover,
.pricelist .pricelist__download:focus-visible {
  border-color: var(--pricelist-accent);
  background: var(--pricelist-tint);
  color: var(--pricelist-accent);
}

.pricelist__get-more {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem 2rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--pricelist-line);
}

.pricelist__endpoints {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  min-width: 0;
  color: var(--pricelist-muted);
  font-size: 0.9em;
}

.pricelist__endpoints span {
  flex-basis: 100%;
}

.pricelist .pricelist__endpoint {
  min-width: 0;
  text-decoration: none;
}

.pricelist__endpoint code {
  display: inline-block;
  padding: 0.2em 0.5em;
  border-radius: var(--pricelist-radius-sm);
  background: var(--pricelist-hover);
  color: inherit;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.pricelist .pricelist__endpoint:hover code {
  background: var(--pricelist-tint);
}

.pricelist .pricelist__archive-link a {
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.pricelist .pricelist__archive-link a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* ----------------------------------------------------------- Archive page */

/* The way back sits on its own line above the heading. */
.pricelist__back {
  margin: 0 0 0.75rem;
  font-size: 0.9em;
}

.pricelist .pricelist__back a {
  font-weight: 600;
  text-decoration: none;
}

.pricelist .pricelist__back a:hover,
.pricelist .pricelist__back a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.pricelist__intro {
  max-width: 65ch;
  margin: 0 0 1.75rem;
  color: var(--pricelist-muted);
}

.pricelist__table--archive .pricelist__col-storage {
  text-align: end;
}

/* The legal file names lead each row; the date columns stay compact beside them. */
.pricelist__table--archive td {
  white-space: nowrap;
  font-size: 0.9em;
}

/* Tag and name side by side; a long name wraps under itself, not under the tag. */
.pricelist .pricelist__file {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  font-weight: 500;
  text-decoration: none;
}

.pricelist__file + .pricelist__file {
  margin-top: 0.45rem;
}

.pricelist .pricelist__file:hover .pricelist__file-name,
.pricelist .pricelist__file:focus-visible .pricelist__file-name {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.pricelist__file-type {
  flex: none;
  min-width: 2.9em;
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  background: var(--pricelist-tint);
  font-size: 0.68em;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.4;
  text-align: center;
}

.pricelist__file-name {
  min-width: 0;
  overflow-wrap: break-word;
}

.pricelist__badge--current {
  background: var(--pricelist-tint);
}

@media (prefers-reduced-motion: reduce) {
  .pricelist *,
  .pricelist *::before {
    transition: none !important;
  }
}

/* ------------------------------------------------------- Narrow: cards */

/*
 * All three tables turn into cards when the component area is too narrow for them (container queries, so a
 * narrow column on a wide screen gets cards too). The shared card look: */
@container pricelist (max-width: 68rem) {
  .pricelist .pricelist__table-wrap--products {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .pricelist .pricelist__table--products thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .pricelist .pricelist__table--products,
  .pricelist .pricelist__table--products tbody {
    display: block;
  }

  /* Product: the name on top, the other fields in a small grid, label above value. */
  .pricelist .pricelist__table--products tbody tr {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.85rem 1.25rem;
    margin-bottom: 0.75rem;
    padding: 1rem 1.125rem;
    border: 1px solid var(--pricelist-border-color);
    border-radius: var(--pricelist-radius);
    background: none;
  }

  .pricelist .pricelist__table--products tbody tr:nth-child(even),
  .pricelist .pricelist__table--products tbody tr:hover {
    background: none;
  }

  .pricelist .pricelist__table--products tbody tr:last-child {
    margin-bottom: 0;
  }

  .pricelist .pricelist__table--products tbody th,
  .pricelist .pricelist__table--products tbody td {
    padding: 0;
    border: 0;
    text-align: start;
  }

  .pricelist .pricelist__table--products tbody th {
    display: block;
    grid-column: 1 / -1;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--pricelist-line);
    font-size: 1.05em;
    font-weight: 600;
  }

  .pricelist .pricelist__table--products tbody td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .pricelist .pricelist__table--products tbody td::before {
    content: attr(data-label);
    color: var(--pricelist-muted);
    font-size: 0.72em;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .pricelist .pricelist__table--products td .pricelist__anchor-date {
    flex-basis: auto;
    text-align: start;
  }

  .pricelist .pricelist__table--products .pricelist__col-special--empty,
  .pricelist .pricelist__table--products .pricelist__col--empty {
    display: none;
  }
}

/*
 * Archive narrower than its table needs (the long legal file names take most of the row): each file is a
 * card with the CSV and XML names on top and the dates in a small grid below, label above value.
 */
@container pricelist (max-width: 52rem) {
  .pricelist .pricelist__table-wrap--archive {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .pricelist .pricelist__table--archive thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .pricelist .pricelist__table--archive,
  .pricelist .pricelist__table--archive tbody {
    display: block;
  }

  .pricelist .pricelist__table--archive tbody tr {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: 0.85rem 1.25rem;
    margin-bottom: 0.75rem;
    padding: 1rem 1.125rem;
    border: 1px solid var(--pricelist-border-color);
    border-radius: var(--pricelist-radius);
    background: none;
  }

  .pricelist .pricelist__table--archive tbody tr:nth-child(even),
  .pricelist .pricelist__table--archive tbody tr:hover {
    background: none;
  }

  .pricelist .pricelist__table--archive tbody tr:last-child {
    margin-bottom: 0;
  }

  .pricelist .pricelist__table--archive tbody th,
  .pricelist .pricelist__table--archive tbody td {
    padding: 0;
    border: 0;
    text-align: start;
  }

  .pricelist .pricelist__table--archive tbody th {
    display: block;
    grid-column: 1 / -1;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--pricelist-line);
    font-weight: 400;
  }

  .pricelist .pricelist__table--archive tbody td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    min-width: 0;
    white-space: normal;
  }

  .pricelist .pricelist__table--archive tbody td::before {
    content: attr(data-label);
    color: var(--pricelist-muted);
    font-size: 0.72em;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .pricelist .pricelist__table--archive .pricelist__col--empty {
    display: none;
  }
}

/*
 * Service list and the page around it on a narrow area (a phone, or a narrow column): each service is a
 * card with its name on top and the prices below, label on the left, value on the right.
 */
@container pricelist (max-width: 36rem) {
  .pricelist .pricelist__table-wrap--services {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .pricelist .pricelist__table--services thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .pricelist .pricelist__table--services,
  .pricelist .pricelist__table--services tbody,
  .pricelist .pricelist__table--services tr,
  .pricelist .pricelist__table--services th {
    display: block;
  }

  .pricelist .pricelist__table--services tbody tr {
    margin-bottom: 0.75rem;
    padding: 0.35rem 0;
    border: 1px solid var(--pricelist-border-color);
    border-radius: var(--pricelist-radius);
    background: none;
  }

  .pricelist .pricelist__table--services tbody tr:nth-child(even),
  .pricelist .pricelist__table--services tbody tr:hover {
    background: none;
  }

  .pricelist .pricelist__table--services tbody tr:last-child {
    margin-bottom: 0;
  }

  .pricelist .pricelist__table--services tbody th,
  .pricelist .pricelist__table--services tbody td {
    padding: 0.45rem 1.125rem;
    border: 0;
  }

  /* The name as the card title, with a light line between it and the prices. */
  .pricelist .pricelist__table--services tbody th {
    margin: 0 1.125rem 0.35rem;
    padding: 0.75rem 0 0.65rem;
    border-bottom: 1px solid var(--pricelist-line);
    font-size: 1.05em;
    font-weight: 600;
  }

  .pricelist .pricelist__table--services tbody td {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.25rem 1rem;
  }

  .pricelist .pricelist__table--services tbody td::before {
    content: attr(data-label);
    color: var(--pricelist-muted);
    font-size: 0.9em;
    font-weight: 400;
  }

  .pricelist .pricelist__table--services td.pricelist__col-price {
    font-size: 1.1em;
  }

  .pricelist .pricelist__table--services td .pricelist__anchor-date {
    flex-basis: 100%;
    text-align: end;
  }

  .pricelist .pricelist__table--services tbody td:last-child {
    padding-bottom: 0.85rem;
  }

  .pricelist .pricelist__table--services .pricelist__col-special--empty {
    display: none;
  }

  .pricelist__get {
    padding: 1.125rem;
  }

  .pricelist__downloads {
    flex: 1 1 100%;
  }

  .pricelist .pricelist__download {
    flex: 1 1 0;
  }

  .pricelist__get-more {
    align-items: flex-start;
    flex-direction: column;
  }
}
