/*
 * sovo-lista.css - apartment list widget + tab bar for SOVO WP sites.
 *
 * DESIGN NOTE (impeccable pass, product register, Restrained colour strategy)
 * - Task: a visitor on a marketing page filters ~30-290 apartments and opens one. The tool should
 *   disappear into the task: one neutral surface, brand colour only on selection, links and focus.
 * - No PRODUCT.md/DESIGN.md exists in this workspace; decisions follow the wajdy list/tab look
 *   (the reference the Next.js ApartmentsList was ported from), tightened where it failed a check.
 * - Type: inherits the host page font (font: inherit); 11px caps labels, 13px chips, 14px data,
 *   scale ratio ~1.15. Numbers use tabular-nums so columns and the PROMO badge do not jitter.
 * - Neutrals: Tailwind gray scale as used on wajdy (#111827 ink, #6b7280 muted, #e5e7eb lines).
 *   Muted text is #6b7280 (4.8:1 on white). The reference's gray-400 em dash (2.5:1) is replaced.
 * - Status colour is semantic and fixed across sites (green / yellow / red). Badge text uses the
 *   -800/-700 steps (>= 7:1 on the tint) instead of the reference -600 (3.2:1).
 * - Status stripe: kept from the reference as a 3px inset marker on the first cell / card edge
 *   because it encodes data (status), not decoration. It is an inset box-shadow, not a border.
 * - Sale price: #e11d48 on white = 4.7:1, kept. "Oszczedzasz" line uses #be123c (6.0:1).
 * - Tab bar: segmented control (white pill on gray-100 track), as on wajdy. Min height 44px.
 * - Motion: 150ms colour/border transitions only, no layout animation.
 * - Focus: 2px --sl-brand outline with 2px offset on every control (:focus-visible).
 *
 * BRAND CONTRAST (white on --sl-brand; the solid chip fill, tab text and links all need >= 4.5:1).
 * Brand is set inline via --sl-brand / --sl-brand-dark. Where the site colour fails, use the
 * "chip shade" below instead (same hue, darkened) and keep the original only for the site itself:
 *
 *   site              site colour  ratio   --sl-brand (use)  ratio   --sl-brand-dark
 *   wajdy             #a94944      5.64    #a94944           5.64    #8f3d39
 *   kossak            #8b4000      7.42    #8b4000           7.42    #763600
 *   dabrowskiego      #a47c6a      3.70    #906d5d           4.63    #7a5d4f
 *   os_gwiazdowo      #78170e      10.89   #78170e           10.89   #66140c
 *   sovotel (2 pages) #40737a      5.31    #40737a           5.31    #366268
 *   kamienicecalisia  #95804d      3.84    #867345           4.61    #72623b
 *   paderewskiego     #bd9d5d      2.58    #887143           4.68    #746039
 *   ogrodowa          #a47c4d      3.77    #926e45           4.63    #7c5e3b
 *   rabowice          #063b1b      12.73   #063b1b           12.73   #053217
 *
 * Scope: every selector starts with .sl / .sl-tabs or targets [data-sovo-lista*] / [data-sl-*].
 * A scoped reset protects the widget from Tailwind preflight / CDN builds and keeps it from
 * restyling the page (specificity 0,2,0 beats element selectors of the host theme).
 */

[data-sovo-lista-tabs][hidden], [data-sl-panel][hidden], .sl[hidden] { display: none !important; }

.sl, .sl-tabs {
  --sl-brand: #a94944;
  --sl-brand-dark: #8f3d39;
  --sl-ink: #111827;
  --sl-muted: #6b7280;
  --sl-line: #e5e7eb;
  --sl-line-soft: #f3f4f6;
  --sl-soft: #f9fafb;
  --sl-sale: #e11d48;
  --sl-ease: 150ms ease-out;
}

/* ---------- reset (scoped) ---------- */
.sl, .sl *, .sl *::before, .sl *::after,
.sl-tabs, .sl-tabs *, .sl-tabs *::before, .sl-tabs *::after { box-sizing: border-box; }
.sl :where(p, del, div, span) { margin: 0; padding: 0; }
.sl :where(button, select, input), .sl-tabs :where(button) {
  font: inherit; margin: 0; letter-spacing: normal; text-transform: none; text-shadow: none;
  -webkit-appearance: none; appearance: none; border-radius: 0; text-decoration: none; text-align: left;
}
.sl :where(button), .sl-tabs :where(button) { cursor: pointer; background: none; border: 0; padding: 0; color: inherit; line-height: 1.25; }
.sl :where(table) { border-collapse: collapse; border-spacing: 0; width: 100%; margin: 0; background: none; table-layout: fixed; }
.sl :where(th, td) { padding: 0; border: 0; background: none; text-align: left; vertical-align: middle; font: inherit; }
.sl :where(tr) { background: none; border: 0; }
.sl { display: block; color: var(--sl-ink); font-size: 14px; line-height: 1.4; text-align: left; font-variant-numeric: tabular-nums; }
.sl :where(del) { text-decoration: line-through; }

.sl button:focus-visible, .sl select:focus-visible, .sl input:focus-visible,
.sl-tabs button:focus-visible { outline: 2px solid var(--sl-brand); outline-offset: 2px; }
.sl-tabs button:focus:not(:focus-visible), .sl button:focus:not(:focus-visible) { outline: 0; }

/* ---------- tab bar ---------- */
.sl-tabs {
  display: flex; justify-content: center; margin: 0 0 2rem; scroll-margin-top: 96px;
}
.sl-tabs > button {
  min-height: 44px; padding: 0.625rem 1rem; border-radius: 0.75rem; font-size: 14px; font-weight: 600;
  color: #4b5563; background: transparent; text-align: center; white-space: nowrap;
  transition: background-color var(--sl-ease), color var(--sl-ease), box-shadow var(--sl-ease);
}
.sl-tabs > button:hover { color: var(--sl-ink); }
.sl-tabs > button[aria-selected="true"] { background: #fff; color: var(--sl-brand); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
@media (min-width: 768px) { .sl-tabs > button { padding: 0.625rem 1.5rem; } }
/* the track: wraps both buttons without a wrapper element in markup */
.sl-tabs { width: fit-content; margin-left: auto; margin-right: auto; background: var(--sl-line-soft); border-radius: 1rem; padding: 4px; gap: 4px; }

/* ---------- filters ---------- */
.sl-filters { background: #fff; border: 1px solid var(--sl-line); border-radius: 1rem; padding: 1rem; margin-bottom: 1.25rem; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.sl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.875rem 0.75rem; align-items: start; }
.sl-fg-a, .sl-fg-s { grid-column: span 2; }
.sl-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sl-muted); margin-bottom: 0.5rem; }
.sl-label-val { color: var(--sl-ink); text-transform: none; letter-spacing: 0; font-size: 12px; white-space: nowrap; }
.sl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sl-chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
  padding: 5px 12px; border-radius: 9px; font-size: 12px; font-weight: 600; line-height: 1.2;
  background: #fff; color: #4b5563; border: 1px solid var(--sl-line);
  transition: background-color var(--sl-ease), border-color var(--sl-ease), color var(--sl-ease);
}
.sl-chip::after { content: ""; position: absolute; inset: -6px; } /* 44px hit area, look unchanged */
.sl-chip:hover { border-color: var(--sl-brand); color: var(--sl-brand); }
.sl-chip[aria-pressed="true"] { background: var(--sl-brand); border-color: var(--sl-brand); color: #fff; }
.sl-chip[aria-pressed="true"]:hover { background: var(--sl-brand-dark); border-color: var(--sl-brand-dark); color: #fff; }
.sl-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }

/* dual range */
.sl-range { position: relative; height: 36px; margin: 8px 10px 0; }
.sl-range-track, .sl-range-fill { position: absolute; top: 8px; height: 4px; border-radius: 2px; }
.sl-range-track { left: 0; right: 0; background: var(--sl-line); }
.sl-range-fill { background: var(--sl-brand); }
.sl-range input[type="range"] {
  position: absolute; top: 0; left: -10px; width: calc(100% + 20px); height: 20px; margin: 0; padding: 0;
  background: transparent; pointer-events: none; border: 0;
}
.sl-range input[type="range"]::-webkit-slider-runnable-track { background: transparent; border: 0; height: 20px; }
.sl-range input[type="range"]::-moz-range-track { background: transparent; border: 0; }
.sl-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--sl-brand); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer; pointer-events: auto; position: relative; z-index: 2;
}
.sl-range input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--sl-brand); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); cursor: pointer; pointer-events: auto;
}
.sl-range input[type="range"]:focus-visible { outline: 0; }
.sl-range input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--sl-brand); outline-offset: 2px; }
.sl-range input[type="range"]:focus-visible::-moz-range-thumb { outline: 2px solid var(--sl-brand); outline-offset: 2px; }

/* mobile sort */
.sl-msort { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--sl-line-soft); }
.sl-select {
  width: 100%; padding: 0.625rem 2.25rem 0.625rem 0.875rem; font-size: 14px; font-weight: 500; color: var(--sl-ink);
  background-color: #fff; border: 1px solid var(--sl-line); border-radius: 0.5rem; min-height: 44px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1rem; cursor: pointer;
}
.sl-select:focus-visible { border-color: var(--sl-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sl-brand) 18%, transparent); outline: 0; }

/* ---------- empty / messages / count / more ---------- */
.sl-msg { padding: 2.5rem 1rem; text-align: center; color: var(--sl-muted); font-size: 14px; }
.sl-empty { text-align: center; padding: 3rem 1rem; background: #fff; border: 1px solid var(--sl-line); border-radius: 1rem; margin-bottom: 1.25rem; color: var(--sl-muted); }
.sl .sl-empty[hidden], .sl .sl-table-wrap[hidden], .sl .sl-cards[hidden], .sl .sl-more[hidden] { display: none; }
.sl-link { margin-top: 0.75rem; color: var(--sl-brand); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.sl-link:hover { color: var(--sl-brand-dark); }
.sl-count { text-align: center; font-size: 12px; color: var(--sl-muted); margin: 0.875rem 0 0; }
.sl-count:focus { outline: 0; }
.sl-more {
  display: block; margin: 0.875rem auto 0; min-height: 44px; padding: 0.625rem 1.5rem; border-radius: 0.75rem;
  border: 1px solid var(--sl-brand); color: var(--sl-brand); background: #fff; font-weight: 600; font-size: 14px; text-align: center;
  transition: background-color var(--sl-ease), color var(--sl-ease);
}
.sl-more:hover { background: var(--sl-brand); color: #fff; }

/* ---------- table (>= 768px) ---------- */
.sl-table-wrap { display: none; background: #fff; border: 1px solid var(--sl-line); border-radius: 1rem; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.sl-cards { display: block; }
.sl-table { table-layout: fixed; }
.sl-table thead { background: var(--sl-soft); border-bottom: 1px solid var(--sl-line); }
.sl-table thead tr { border-bottom: 1px solid var(--sl-line); }
.sl-c-n { width: 10%; } .sl-c-f { width: 9%; } .sl-c-r { width: 9%; } .sl-c-p { width: 11%; }
.sl-c-c { width: 21%; } .sl-c-cm { width: 14%; } .sl-c-s { width: 26%; }
.sl-th { padding: 0; }
.sl .sl-sort {
  display: block; width: 100%; padding: 1rem 1.25rem; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--sl-muted); user-select: none; white-space: nowrap;
  transition: color var(--sl-ease);
}
.sl .sl-sort:hover, .sl .sl-sorted .sl-sort { color: var(--sl-brand); }
.sl-ico { display: inline-block; width: 10px; height: 12px; margin-left: 4px; position: relative; vertical-align: middle; opacity: 0.5; }
.sl-ico::before, .sl-ico::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; }
.sl-ico::before { top: 0; border-bottom: 4px solid currentColor; }
.sl-ico::after { bottom: 0; border-top: 4px solid currentColor; }
.sl-sorted .sl-ico { opacity: 1; }
.sl-sorted .sl-ico::after { opacity: 0.25; }
.sl-sorted.sl-desc .sl-ico::after { opacity: 1; }
.sl-sorted.sl-desc .sl-ico::before { opacity: 0.25; }

.sl-row { border-bottom: 1px solid var(--sl-line-soft); transition: background-color var(--sl-ease); }
.sl .sl-td { padding: 1rem 1.25rem; font-size: 14px; }
.sl .sl-row > td:first-child { box-shadow: inset 3px 0 0 var(--sl-stripe, transparent); }
.sl-s-available { --sl-stripe: #22c55e; }
.sl-s-reserved { --sl-stripe: #eab308; }
.sl-s-sold { --sl-stripe: #dc2626; }
.sl-row.sl-s-reserved { background: rgba(249, 250, 251, 0.5); }
.sl-row.sl-s-sold { background: #fef2f2; color: #7f1d1d; }
.sl-row.sl-click { cursor: pointer; }
.sl-row.sl-click:hover { background: var(--sl-soft); }
.sl-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sl-num { font-weight: 700; min-width: 3rem; }
.sl-num-big { font-size: 20px; line-height: 1.2; min-width: 0; color: var(--sl-brand); }
.sl-card.sl-s-sold .sl-num-big { color: #b91c1c; }
.sl-promo-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: #fff; background: var(--sl-sale); padding: 2px 6px; border-radius: 4px; line-height: 1.3; }

.sl-price { display: flex; flex-direction: column; justify-content: center; min-height: 52px; white-space: nowrap; }
.sl-dash { color: var(--sl-muted); }
.sl-old { font-size: 12px; color: var(--sl-muted); }
.sl-cur { font-size: 14px; font-weight: 700; }
.sl-p-cm .sl-cur { font-weight: 600; }
.sl-cur.sl-promo { color: var(--sl-sale); }
.sl-save { font-size: 11px; color: #be123c; }

.sl-badge { display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.2; }
.sl-b-available { background: #f0fdf4; color: #166534; }
.sl-b-reserved { background: #fefce8; color: #854d0e; }
.sl-b-sold { background: #fef2f2; color: #b91c1c; }
.sl-st { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sl-go { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; color: var(--sl-brand); font-weight: 600; font-size: 14px; white-space: nowrap; }
.sl-go::after { content: ""; width: 7px; height: 7px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); }
.sl-go:hover { color: var(--sl-brand-dark); }

/* ---------- cards (< 768px) ---------- */
.sl-card { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--sl-line); border-radius: 1rem; padding: 1rem; margin-bottom: 0.75rem; box-shadow: inset 3px 0 0 var(--sl-stripe, transparent); transition: border-color var(--sl-ease); }
.sl-card.sl-s-reserved { background: rgba(249, 250, 251, 0.5); }
.sl-card.sl-s-sold { background: #fef2f2; border-color: #fecaca; }
.sl-card.sl-click { cursor: pointer; }
.sl-card.sl-click:hover { border-color: var(--sl-brand); }
.sl-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 0.75rem; }
.sl-card-l { min-width: 0; }
.sl-meta { font-size: 12px; color: var(--sl-muted); margin-top: 4px; }
.sl-card-r { text-align: right; flex: none; }
.sl-card-r .sl-price { min-height: 0; align-items: flex-end; }
.sl-card-r .sl-p-small { margin-top: 4px; }
.sl-card-r .sl-p-small .sl-cur { font-size: 12px; font-weight: 600; }
.sl-card-r .sl-old { font-size: 11px; }
.sl-card-b { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sl-card .sl-go { font-size: 12px; position: relative; min-height: 32px; }
.sl-card .sl-go::before { content: ""; position: absolute; inset: -8px; }

/* ---------- breakpoints ---------- */
@media (min-width: 768px) {
  .sl-table-wrap { display: block; }
  .sl .sl-cards, .sl .sl-cards[hidden] { display: none; }
  .sl-msort { display: none; }
  .sl-chip { padding: 6px 14px; font-size: 13px; }
  .sl-filters { padding: 1.25rem; }
}
@media (min-width: 1024px) {
  .sl-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.25rem; }
  .sl-fg-b { grid-column: span 2; }
  .sl-fg-r { grid-column: span 2; }
  .sl-fg-s { grid-column: span 4; }
  .sl-fg-f { grid-column: span 3; }
  .sl-fg-a { grid-column: span 3; }
  .sl-has-b .sl-fg-s { grid-column: span 3; }
  .sl-has-b .sl-fg-f { grid-column: span 2; }
}
@media (prefers-reduced-motion: reduce) {
  .sl [class], .sl-tabs button { transition: none; }
}
