/*
 * visual10 - pasek koszyka (templates/visual10/_cartbar.php, w .p-dock layoutu), okno koszyka i okno
 * „Potrzebujesz więcej czasu?”. Ciemny pasek (wariant C): tekst biały na --p-ink (kontrast > 15:1), przycisk
 * marki z jasnym obrysem 1,5 px, fokus biały. Wysokość doku mierzy core.js (--p-dock-h).
 * Okno koszyka: telefon - panel od dołu (.p-sheet, jak panel biletów), desktop - panel z prawej.
 */

.p-cartbar {
  background: var(--p-ink);
  color: #fff;
  box-shadow: 0 -8px 24px rgba(21, 22, 26, .22);
}
.p-cartbar :focus-visible { outline-color: #fff !important; }
.p-cartbar-in {
  max-width: var(--p-max);
  margin: 0 auto;
  padding: 6px var(--p-gutter) 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "show go" "time time";
  align-items: center;
  gap: 0 12px;
}
.p-cartbar.is-timer .p-cartbar-in { grid-template-columns: minmax(0, 1fr); grid-template-areas: "time"; padding-top: 4px; padding-bottom: 4px; }

/* „Pokaż koszyk”: liczba sztuk, kwota (bez JS - sam tekst w <noscript>) */
.p-cartbar-show, .p-cartbar-sum {
  grid-area: show;
  justify-self: start;
  max-width: 100%;
}
.p-cartbar-show {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: "count lbl" "total total";
  justify-content: start;
  align-items: baseline;
  gap: 0 10px;
  min-height: 48px;
  margin: 0 0 0 -8px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--p-r-sm, 12px);
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
  line-height: 1.2;
}
.p-cartbar-show:hover { background: rgba(255, 255, 255, .08); }
.p-cartbar-count { grid-area: count; font-size: 14px; color: #d5d8de; white-space: nowrap; }
.p-cartbar-showlbl {
  grid-area: lbl;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.p-cartbar-showlbl .p-ic { stroke-width: 2.4; }
.p-cartbar-total { grid-area: total; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.p-cartbar-sum {
  margin: 0 !important;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 10px;
}

.p-cartbar-go {
  grid-area: go;
  min-height: 52px;
  padding: 0 20px;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .9);
}

/* czas na zakup + ikona „odśwież” = przedłużenie */
.p-cartbar-time {
  grid-area: time;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 0 0 0 2px;
  border-radius: var(--p-r-md, 14px);
  color: #d5d8de;
  font-size: 14px;
  line-height: 18px;
}
.p-cartbar-timetext { min-width: 0; }
.p-cartbar-time.is-warn {
  padding-left: 12px;
  background: #2c2e35;
  color: #fff;
  font-weight: 600;
}
.p-cartbar-time.is-urgent { background: #fdf3e1; color: #5c3500; }
.p-cartbar-time.is-urgent :focus-visible { outline-color: #5c3500 !important; }
.p-cartbar .p-cartbar-extend {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--p-r-pill, 999px);
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.p-cartbar .p-cartbar-extend:hover { background: rgba(255, 255, 255, .12); }
.p-cartbar-extend .p-ic { stroke-width: 2.2; }
.p-cartbar .p-cartbar-time.is-urgent .p-cartbar-extend { color: #5c3500; }
.p-cartbar .p-cartbar-time.is-urgent .p-cartbar-extend:hover { background: rgba(92, 53, 0, .1); }
.p-cartbar .p-cartbar-extend[aria-disabled="true"] { cursor: progress; }
.p-cartbar-extend[aria-busy="true"] .p-ic { animation: p-cb-spin .8s linear infinite; }
@keyframes p-cb-spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 768px) {
  /* bez zakładek pasek jest ostatni w doku: zapas na pasek systemu (core.css --p-safe-b) w tle paska, przyciski nad nim
     (na telefonie zapas mają zakładki pod paskiem) */
  .p-cartbar { padding-bottom: var(--p-safe-b); }
  .p-cartbar-in {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "show time . go";
    gap: 0 24px;
    min-height: 76px;
  }
  .p-cartbar.is-timer .p-cartbar-in { min-height: 0; }
  .p-cartbar-show { grid-template-columns: auto auto auto; grid-template-areas: "total count lbl"; gap: 0 12px; padding: 4px 12px; }
}

/* telefon: klawiatura ekranowa przy polu formularza - pasek się chowa */
@media (max-width: 767.98px) {
  .p-cartbar.is-kbd { display: none; }
}

/* okno „Potrzebujesz więcej czasu?” */
.p-cartbar-dlg { width: min(440px, calc(100vw - 32px)); }
.p-cartbar-dlg .p-dialog-head { padding-top: 20px; }
.p-cartbar-dlg h2:focus { outline: none; }
.p-cartbar-dlg-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 0;
}
.p-cartbar-dlg-foot .p-btn { flex: 1 1 180px; }

/* ---------------------------------------------------------------- okno koszyka */

.p-cartdlg { padding: 0; }
.p-cartdlg[open] { display: flex; flex-direction: column; }
.p-cartdlg-head { align-items: center; padding-top: 18px; }
.p-cartdlg-h { font-size: 24px; line-height: 1.2; margin: 0 !important; }
.p-cartdlg-h:focus { outline: none; }
.p-cartdlg-h:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.p-cartdlg-body { flex: 1 1 auto; }
.p-cartdlg-body[aria-busy="true"] .p-cd-group, .p-cartdlg.is-busy .p-cd-promos { opacity: .55; }
.p-cartdlg-loading { margin: 8px 0 16px !important; color: var(--p-muted); }
.p-cd-note { margin: 0 0 12px !important; }
.p-cd-note .p-btn { margin-top: 8px; }
.p-cd-empty { padding: 24px 8px; text-align: center; }
.p-cd-empty p { margin: 0 !important; font-weight: 600; }

.p-cd-group { padding: 14px 0 6px; border-top: 1px solid var(--p-line); }
.p-cd-group:first-child { border-top: 0; padding-top: 2px; }
.p-cd-ghead { margin-bottom: 4px; }
.p-cd-gtitle { display: inline; font-size: 17px; font-weight: 700; line-height: 1.3; margin-right: 6px !important; }
.p-cd-gtitle a { display: inline-flex; align-items: center; min-height: 44px; color: var(--p-ink); text-decoration: none; }
.p-cd-gtitle a:hover { text-decoration: underline; }
/* „Ten termin” na początku wiersza daty - wiersz rośnie razem z pigułką, nic nie nachodzi przy długim tytule */
.p-cd-here { vertical-align: middle; margin-right: 2px; background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; font-size: 12px; }
.p-cd-when { margin: -8px 0 0 !important; font-size: 14px; color: var(--p-muted); }

.p-cd-lines { list-style: none; margin: 0; padding: 0; }
.p-cd-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main amount" "main acts";
  gap: 2px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--p-line);
}
.p-cd-ghead + .p-cd-lines .p-cd-line:first-child { border-top: 0; }
.p-cd-main { grid-area: main; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.p-cd-name { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.p-cd-name .p-ic { vertical-align: -3px; }
.p-cd-disc { font-weight: 400; color: var(--p-ink-2); }
.p-cd-sub { font-size: 14px; color: var(--p-muted); }
/* opis rodzaju biletu / produktu: krótki w wierszu, dłuższy zwijany (<details>) */
.p-cd-desc-text, .p-cd-desc-body { font-size: 14px; line-height: 20px; color: var(--p-ink-2); overflow-wrap: anywhere; }
.p-cd-desc-text p, .p-cd-desc-body p { margin: 0 0 4px; }
.p-cd-desc-text > :last-child, .p-cd-desc-body > :last-child { margin-bottom: 0; }
.p-cd-desc-body ul, .p-cd-desc-body ol { margin: 0 0 4px; padding-left: 20px; }
.p-cd-desc summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  color: var(--link);
  cursor: pointer;
}
.p-cd-desc summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin: -3px 0 0 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.p-cd-desc[open] summary { margin-bottom: 2px; }
.p-cd-desc[open] summary::after { margin-top: 3px; transform: rotate(-135deg); }
.p-cd-tag {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 8px;
  border-radius: var(--p-r-pill, 999px);
  background: var(--p-bg);
  color: var(--p-ink-2);
  font-size: 12px;
  font-weight: 600;
}
.p-cd-amount { grid-area: amount; justify-self: end; font-size: 16px; }
.p-cd-acts { grid-area: acts; display: flex; align-items: center; justify-content: flex-end; gap: 4px; align-self: end; }
.p-cd-stepper output { min-width: 24px; font-size: 16px; }
.p-cd-remove { color: var(--p-ink-2); }
.p-cd-remove:hover { color: var(--p-err); background: var(--p-err-bg); }
.p-cd-promos { margin-top: 4px; border-top: 1px solid var(--p-line); }

/* voucher / karnet przy bilecie: przycisk tekstowy (cel 44 px), pole numeru w wierszu, dopisek z „Cofnij” */
.p-cd-line > .p-cd-vbox, .p-cd-line > .p-cd-voucher, .p-cd-line > .p-cd-dbox { grid-column: 1 / -1; }
/* zmiana ulgi (rodzaju biletu) przy pozycji */
.p-cd-dopen .p-ic { flex: none; text-decoration: none; }
.p-cd-dform { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 2px; }
.p-cd-dform[hidden] { display: none; }
.p-cd-drow { display: flex; gap: 8px; }
.p-cd-drow .p-select { flex: 1 1 auto; min-width: 0; }
.p-cd-drow .p-btn { flex: none; min-height: 48px; padding: 0 16px; }
/* telefon: pełna nazwa ulgi z ceną - przycisk pod listą */
@media (max-width: 479px) {
  .p-cd-drow { flex-wrap: wrap; }
  .p-cd-drow .p-select { flex-basis: 100%; }
}
.p-cd-derr, .p-cd-dhint { margin: 0 !important; }
.p-cd-dcancel { align-self: flex-start; }
.p-cartdlg .p-linkbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0 0 0 -4px;
  padding: 0 4px;
  border: 0;
  border-radius: var(--p-r-xs, 8px);
  background: transparent;
  color: var(--link, var(--brand-strong));
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.p-cartdlg .p-linkbtn:hover { text-decoration-thickness: 2px; }
.p-cd-vopen .p-ic { flex: none; text-decoration: none; }
.p-cd-vform { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 2px; }
.p-cd-vform[hidden] { display: none; }
.p-cd-vrow { display: flex; gap: 8px; }
.p-cd-vrow .p-input { flex: 1 1 auto; min-width: 0; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.p-cd-vrow .p-btn { flex: none; min-height: 48px; padding: 0 16px; }
.p-cd-verr, .p-cd-vhint { margin: 0 !important; }
.p-cd-vcancel { align-self: flex-start; }
.p-cd-voucher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
  margin-top: 2px;
  padding: 4px 4px 4px 10px;
  border-radius: var(--p-r-sm, 12px);
  background: var(--p-ok-bg);
  color: var(--p-ok);
}
.p-cd-voucher.is-discount { background: var(--p-bg); color: var(--p-ink-2); }
.p-cd-vtext { flex: 1 1 12em; min-width: 0; margin: 0 !important; padding: 6px 0; font-size: 14px; font-weight: 600; line-height: 1.35; }
.p-cd-vtext .p-ic { vertical-align: -4px; }
.p-cd-vcode { font-variant-numeric: tabular-nums; font-weight: 400; }
.p-cd-voucher .p-linkbtn { margin-left: auto; color: inherit; }
.p-cartdlg-vpaid {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: -6px 0 0 !important;
  color: var(--p-ok);
  font-weight: 600;
}
.p-cartdlg-topay[hidden], .p-cartdlg-vpaid[hidden] { display: none; }

.p-cartdlg-foot { display: flex; flex-direction: column; gap: 10px; }
.p-cartdlg-msg { margin: 0 !important; }
.p-cartdlg-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 !important;
}
.p-cartdlg-totallbl { color: var(--p-ink-2); }
.p-cartdlg-count { color: var(--p-muted); font-size: 14px; }
.p-cartdlg-total strong { font-size: 24px; font-weight: 800; }
.p-cartdlg-acts { display: flex; flex-wrap: wrap; gap: 8px; }
/* oba przyciski w jednym rzędzie, gdy się mieszczą; inaczej jeden pod drugim (bez łamania etykiet) */
.p-cartdlg-acts .p-btn { flex: 1 1 auto; min-height: 52px; padding: 0 12px; white-space: nowrap; }

/* telefon: panel od dołu z uchwytem (jak panel biletów) */
@media (max-width: 767.98px) {
  .p-cartdlg-head { position: sticky; }
  .p-cartdlg-head::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 2px;
    background: var(--p-line-2);
  }
}
/* desktop: panel z prawej na całą wysokość (tło także pod paskiem systemu), zapas na pasek w stopce okna */
@media (min-width: 768px) {
  .p-dialog.p-cartdlg {
    width: min(480px, 100vw);
    height: 100%;
    max-height: 100%;
    margin: 0 0 0 auto;
    bottom: 0;
    border-radius: var(--p-r-lg, 24px) 0 0 var(--p-r-lg, 24px);
  }
  .p-cartdlg[open] { animation: p-cd-in .22s ease-out; }
  .p-cartdlg-head { padding: 22px 24px 12px; }
  .p-cartdlg-body { padding: 0 24px 16px; }
  .p-cartdlg-foot { padding: 14px 24px calc(22px + var(--p-safe-b)); }
}
@keyframes p-cd-in {
  from { transform: translateX(32px); opacity: .6; }
  to { transform: none; opacity: 1; }
}

@media (forced-colors: active) {
  .p-cartbar { border-top: 1px solid CanvasText; }
  .p-cartbar-extend, .p-cartbar-time.is-warn, .p-cartbar-show { border: 1px solid CanvasText; }
  .p-cd-tag, .p-cd-here, .p-cd-voucher { border: 1px solid CanvasText; }
  .p-cartdlg .p-linkbtn { color: LinkText; }
}
