/* ============================================================
   Rail ekranów, panel wariantów, przyciski, podsumowanie, toast
   ============================================================ */

/* ---------------- Rail: ekrany ---------------- */
.rail__title { padding: 0 var(--s-2); }

.rail__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.rail__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: var(--c-canvas);
  font-size: var(--fs-14);
  color: var(--c-ink);
  letter-spacing: var(--ls-tight);
  text-align: left;
  transition: background var(--t-fast) var(--e-out),
              color var(--t-fast) var(--e-out),
              border-color var(--t-fast) var(--e-out);
}

.rail__item:hover:not([disabled]) { background: var(--c-gray-light); }

/* Bieżący ekran — jedyne miejsce z akcentem w tej kolumnie */
.rail__item[aria-current="true"] {
  background: var(--c-accent-2);
  color: var(--c-accent-2-ink);
  font-weight: 600;
}

.rail__item[aria-current="true"]:hover { background: var(--c-accent-2-hover); }

/* Ekrany jeszcze nieprzygotowane: bez kółka, z plakietką „soon" */
.rail__item[disabled] {
  background: transparent;
  border-color: var(--c-line);
  color: var(--c-ink-faint);
}

/* Znacznik postępu: pusty ⇄ odwiedzony ⇄ bieżący */
.rail__dot {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--c-line-strong);
  background: var(--c-surface);
  color: transparent;
}

.rail__item--seen .rail__dot {
  border-color: transparent;
  background: var(--c-gray-dark);
  color: var(--c-surface);
}

.rail__item[aria-current="true"] .rail__dot {
  border-color: transparent;
  background: var(--c-accent);
  color: var(--c-accent-ink);
}

.rail__label { flex: 1 1 auto; min-width: 0; }

.rail__badge {
  font-size: var(--fs-12);
  color: var(--c-ink-muted);
  background: var(--c-canvas);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* ---------------- Panel: grupy wariantów ---------------- */
.groups {
  display: flex;
  flex-direction: column;
  gap: var(--s-7);
}

.group { display: flex; flex-direction: column; gap: var(--s-4); }

.group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}

.group__value {
  font-size: var(--fs-13);
  color: var(--c-ink-muted);
  letter-spacing: var(--ls-tight);
}

.group__options {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: var(--s-3);
}

/* ---------------- Thumbnail ---------------- */
.thumb {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  text-align: left;
  border-radius: var(--r-md);
  /* Nieaktywne warianty przygaszone — wybrany jest jedynym pełnym. */
  opacity: 0.5;
  transition: transform var(--t-fast) var(--e-out),
              opacity var(--t-mid) var(--e-out);
}

.thumb:hover:not(:disabled) { opacity: 0.8; }

/* Wariant zablokowany przez regułę dostępności */
.thumb--locked {
  opacity: 0.22;
  cursor: not-allowed;
  filter: grayscale(1);
}

.thumb--locked:hover { opacity: 0.3; }

.thumb[aria-pressed="true"] { opacity: 1; }

.thumb__frame {
  position: relative;
  display: block;          /* <span> inline nie ma offsetWidth ani wysokości */
  width: 100%;
  overflow: hidden;
  /* Ta sama wartość co karta wariantu w trybie Edit (.cms-variant__frame).
     Warstwa z własnym `radius` nadpisuje to inline — patrz js/ui/panel.js. */
  border-radius: var(--r-md);
  background: var(--c-surface-sunk);
  border: 1px solid var(--c-line);
  box-shadow: var(--sh-1);
  transition: border-color var(--t-mid) var(--e-out),
              box-shadow var(--t-mid) var(--e-out);
}

.thumb__frame::after {
  /* delikatne rozjaśnienie dolnej krawędzi kadru */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 28%;
  pointer-events: none;
}

/* Bez pozycjonowania: obraz zostaje w normalnym flow i nadaje kadrowi
   wysokość, a placeholderowy .thumb__canvas (absolutny) kotwiczy się
   do .thumb__frame tak jak wcześniej. */
.thumb__media { display: block; }

.thumb__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.thumb:hover .thumb__frame {
  border-color: var(--c-line-strong);
  box-shadow: var(--sh-2);
}

.thumb[aria-pressed="true"] .thumb__frame {
  border-color: var(--c-accent);
  box-shadow: var(--sh-2);
}

.thumb__check {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--c-surface);
  background: var(--c-accent-2);
  color: var(--c-accent-2-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--t-mid) var(--e-out),
              transform var(--t-mid) var(--e-out);
  z-index: 3;
}

.thumb[aria-pressed="true"] .thumb__check {
  opacity: 1;
  transform: scale(1);
}

.thumb__meta {
  display: flex;
  justify-content: center;
  padding: 0 2px;
}



.thumb__name {
  font-size: var(--fs-13);
  color: var(--c-ink-muted);
  letter-spacing: var(--ls-tight);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb[aria-pressed="true"] .thumb__name { color: var(--c-ink); font-weight: 600; }

/* ---------------- Podsumowanie konfiguracji ---------------- */
.summary {
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-surface-sunk);
  padding: var(--s-4) var(--s-5) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.summary__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.summary__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  font-size: var(--fs-13);
}

.summary__key { color: var(--c-ink-muted); letter-spacing: var(--ls-tight); }
.summary__val { color: var(--c-ink); font-weight: 550; font-variant-numeric: tabular-nums; }

.summary__hash {
  border-top: 1px solid var(--c-line);
  padding-top: var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--c-ink-faint);
  word-break: break-all;
}

/* ---------------- Przyciski ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 34px;
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  font-size: var(--fs-13);
  font-weight: 550;
  letter-spacing: var(--ls-tight);
  white-space: nowrap;
  border: 1px solid transparent;
  text-decoration: none;          /* „Preview" jest linkiem, nie przyciskiem */
  transition: background var(--t-fast) var(--e-out),
              border-color var(--t-fast) var(--e-out),
              color var(--t-fast) var(--e-out),
              opacity var(--t-fast) var(--e-out);
}

.btn--primary {
  background: var(--c-accent);
  color: var(--c-accent-ink);
}
.btn--primary:hover { background: var(--c-black-hover); }
.btn--primary:active { background: var(--c-black-active); }

.btn--ghost {
  color: var(--c-ink-soft);
  border-color: var(--c-line);
  background: var(--c-field);
}
.btn--ghost:hover {
  background: var(--c-surface-hover);
  border-color: var(--c-line-strong);
  color: var(--c-ink);
}

.btn--pill { height: 44px; padding: 0 var(--s-5); border-radius: var(--r-pill); font-size: var(--fs-14); }
.btn--sm { height: 36px; padding: 0 var(--s-4); font-size: var(--fs-13); }

.btn--accent {
  background: var(--c-accent-2);
  color: var(--c-accent-2-ink);
}
.btn--accent:hover { background: var(--c-accent-2-hover); }

.btn--dark {
  background: var(--c-accent);
  color: var(--c-accent-ink);
}
.btn--dark:hover { background: var(--c-black-hover); }
.btn--dark:disabled { opacity: 0.35; }
.btn--dark:disabled:hover { background: var(--c-accent); }

/* Sam znak, bez podpisu — kwadrat, żeby ikona stała w środku. */
.btn--icon {
  width: 40px;
  padding: 0;
  height: 40px;
  border-radius: var(--r-pill);
  color: var(--c-ink-soft);
  background: transparent;
}
.btn--icon:hover { background: var(--c-surface-hover); color: var(--c-ink); }

/* Kropka „coś czeka" — używa jej przycisk ustawień, gdy w skrzynce
   leży paczka z pluginu Figmy. */
/* Cel importu paczki z Figmy — wąski, bo stoi w wierszu obok przycisków. */
.wp-inbox__target { width: auto; max-width: 180px; }

.btn--dot { position: relative; }

.btn--dot::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-accent-2);
  box-shadow: 0 0 0 2px var(--c-surface);
}

.btn__icon { display: inline-flex; }
.btn__icon svg { display: block; }

.btn--quiet {
  height: 28px;
  padding: 0 var(--s-3);
  font-size: var(--fs-12);
  color: var(--c-ink-muted);
}
.btn--quiet:hover { color: var(--c-ink); background: var(--c-surface-hover); }
.btn--quiet:disabled { opacity: 0.4; }
.btn--quiet:disabled:hover { background: none; color: var(--c-ink-muted); }

/* ---------------- Toast ---------------- */
.toast-layer {
  position: fixed;
  left: 50%;
  bottom: var(--s-7);
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  border-radius: var(--r-pill);
  background: var(--c-accent);
  color: var(--c-accent-ink);
  font-size: var(--fs-13);
  letter-spacing: var(--ls-tight);
  box-shadow: var(--sh-2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-mid) var(--e-out),
              transform var(--t-mid) var(--e-out);
}

.toast--visible { opacity: 1; transform: translateY(0); }

.toast__icon { display: flex; opacity: 0.9; }

/* ============================================================
   Responsywne nadpisania komponentów
   (ten plik ładuje się po layout.css — nadpisania muszą być tutaj)
   ============================================================ */
@media (max-width: 1039px) {
  .rail__title { display: none; }

  .rail__list {
    flex-direction: row;
    gap: var(--s-2);
  }

  .rail__item {
    width: auto;
    white-space: nowrap;
  }

  .rail__item[aria-current="true"] {
    box-shadow: inset 0 -2px 0 var(--c-accent);
  }
}
