/* ==========================================================================
   components.css — elementy wielokrotnego użytku
   ========================================================================== */

/* --- Przyciski --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 16px;
  font-weight: 650;
  font-size: 16px;
  transition: transform 0.15s var(--ease-out), background-color 0.2s, opacity 0.2s;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn-primary { background: var(--brand); color: var(--brand-contrast); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn-primary:active { background: var(--brand-strong); }
.btn-secondary { background: var(--brand-soft); color: var(--brand-strong); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:active { background: color-mix(in srgb, var(--danger) 85%, black); }
.btn-ghost { background: transparent; color: var(--brand); padding: 0 12px; min-height: 40px; }
.btn-block { width: 100%; }
.btn-split { justify-content: space-between; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--ease-out);
}
.icon-btn:active { transform: scale(0.92); }

/* --- Tagi (wege, ostre, nowość…) --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 8px 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tag svg { width: 13px; height: 13px; }
.tag-wege { background: #e6f4e8; color: #23733a; }
.tag-ostre { background: #fde8e4; color: #c0341d; }
.tag-nowosc { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 55%, black); }
.tag-promo { background: var(--brand); color: var(--brand-contrast); }
.tag-bestseller, .tag-polecane { background: var(--brand-soft); color: var(--brand-strong); }

/* --- Licznik ilości (− 1 +) --- */
.stepper {
  display: inline-flex;
  align-items: center;
  height: 40px;
  border-radius: 999px;
  background: var(--brand-softer);
  border: 1px solid var(--brand-soft);
}
.stepper button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--brand);
  transition: transform 0.12s var(--ease-out), background-color 0.15s;
}
.stepper button:active { transform: scale(0.85); background: var(--brand-soft); }
.stepper button svg { width: 18px; height: 18px; }
.stepper-value {
  min-width: 26px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stepper-lg { height: 52px; }
.stepper-lg button { width: 48px; height: 52px; }

/* --- Dolny pasek zakładek (styl iOS: półprzezroczysty z rozmyciem) --- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative;
  flex: 1;
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  transition: color 0.2s;
}
.tab svg { width: 25px; height: 25px; transition: transform 0.25s var(--ease-spring); }
.tab.is-active { color: var(--brand); }
.tab.is-active svg { transform: translateY(-1px) scale(1.06); }
.tab-badge {
  position: absolute;
  top: 0;
  left: calc(50% + 6px);
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-contrast);
  font-size: 11px;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  border: 2px solid var(--surface);
  box-sizing: content-box;
}
.bump { animation: bump 0.45s var(--ease-spring); }
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* --- Panel wysuwany od dołu (bottom sheet) --- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(20, 14, 10, 0.45);
  /* bez „fill-mode” — inaczej animacja blokowałaby zmianę przezroczystości przy przeciąganiu */
  animation: fade-in 0.25s ease;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 91;
  max-width: var(--content-max);
  margin: 0 auto;
  max-height: calc(100dvh - var(--safe-top) - 24px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  /* „clip” zamiast samego „hidden”: przeglądarka nie może programowo przewinąć panelu
     (np. przy fokusie na polu formularza), przewija się tylko .sheet-scroll */
  overflow: clip;
  /* bez „fill-mode” — po wjechaniu panel musi reagować na przeciąganie (inline transform) */
  animation: sheet-in 0.42s var(--ease-out);
  will-change: transform;
}
.sheet.is-dragging { transition: none; }
.sheet.is-closing { animation: sheet-out 0.26s ease-in both; }
.sheet-backdrop.is-closing { animation: fade-out 0.26s ease-in both; }
.sheet-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 2;
  width: 38px;
  height: 5px;
  margin-left: -19px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.sheet-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}
.sheet-footer {
  padding: 12px var(--gutter) calc(12px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}

@keyframes sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheet-out { from { transform: translateY(var(--drag-y, 0)); } to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

/* --- Okno potwierdzenia --- */
.confirm-sheet {
  padding: 36px var(--gutter) calc(16px + var(--safe-bottom));
  text-align: center;
}
.confirm-sheet h2 { padding: 0 40px; }
.confirm-sheet p { margin-top: 8px; color: var(--text-muted); }
.confirm-actions { display: grid; gap: 10px; margin-top: 24px; }

/* --- Powiadomienia (toast) --- */
.toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 11px 16px 11px 12px;
  border-radius: 14px;
  background: #1f1a17;
  color: #fff;
  font-size: 15px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.4s var(--ease-spring) both;
}
.toast svg { width: 20px; height: 20px; flex: none; color: #6fdc8c; }
.toast.is-leaving { animation: toast-out 0.25s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* --- Wybór jednej opcji (rozmiar) --- */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
}
.segmented label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 8px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s var(--ease-out);
}
.segmented label:active { transform: scale(0.97); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented .seg-label { font-weight: 650; }
.segmented .seg-price { font-size: 13px; color: var(--text-muted); }
.segmented label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-softer);
  box-shadow: 0 0 0 1px var(--brand) inset;
}
.segmented label:has(input:checked) .seg-price { color: var(--brand-strong); }
.seg-price s { color: var(--text-faint); font-size: 12px; }
.seg-price .promo-price { color: var(--brand); font-weight: 700; }

/* --- Wybór wielu opcji (dodatki) --- */
.check-row {
  position: relative; /* ukryty checkbox musi zostać wewnątrz przewijanej listy */
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.check-row:last-child { border-bottom: 0; }
.check-row input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1.8px solid color-mix(in srgb, var(--text) 25%, transparent);
  color: transparent;
  transition: background-color 0.18s, border-color 0.18s, transform 0.2s var(--ease-spring);
}
.check-box svg { width: 16px; height: 16px; }
.check-row input:checked + .check-box {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-contrast);
  transform: scale(1.06);
}
.check-row.is-disabled { opacity: 0.4; pointer-events: none; }
.check-name { flex: 1; }
.check-price { color: var(--text-muted); font-size: 15px; font-variant-numeric: tabular-nums; }

/* --- Stan pusty --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 48px 24px;
}
.empty-state .empty-art { width: 150px; height: 150px; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); max-width: 280px; }
.empty-state .btn { margin-top: 12px; }
