/* ============================================================
   CarShot — tools.css
   Wspólny układ "edytora" dla darmowych narzędzi:
   kompresja-zdjec · kadrowanie-zdjec · znak-wodny · rozmywanie-tablic-rejestracyjnych
   Panel ustawień po lewej (przyklejony), scena + taśma zdjęć + wyniki po prawej,
   przyklejony pasek akcji na dole, więc żaden podgląd nie zasłania przycisków.
   Wszystko pod .te, żeby nie ruszać reszty serwisu.
   ============================================================ */

.te-wrap { max-width: 1320px; }

.te { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 960px) { .te { grid-template-columns: 1fr; gap: 20px; } }

/* ---------- Panel boczny ---------- */
.te-side {
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 50px -34px rgba(20,20,40,0.35);
  padding: 20px 20px 8px;
}
@media (min-width: 961px) {
  .te-side { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; scrollbar-width: thin; }
}
.te-group { padding: 16px 0 18px; border-top: 1px solid var(--line); }
.te-group:first-child { border-top: 0; padding-top: 0; }
.te-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 11px; }
.te-label b { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--ink); font-weight: 700; font-family: ui-monospace, Menlo, monospace; background: var(--bg-soft); border-radius: 7px; padding: 2px 8px; }
.te-hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 8px; }
.te-hint[hidden], .te-hint[style*="display:none"] { display: none; }

/* Dropzone w panelu — kompaktowa */
.te .dropzone { padding: 22px 14px; gap: 5px; border-radius: 14px; }
.te .dropzone .dz-icon { font-size: 26px; }
.te .dropzone strong { font-size: 15px; }
.te .dropzone .dz-sub { font-size: 12.5px; }

/* ---------- Przełącznik (switch) ---------- */
.te-switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; padding: 4px 0; }
.te-switch input { position: absolute; opacity: 0; pointer-events: none; }
.te-sw { flex: none; position: relative; width: 44px; height: 26px; border-radius: 999px; background: #cfd0d8; transition: background .18s; }
.te-sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.28); transition: transform .18s cubic-bezier(.3,.7,.3,1.2); }
.te-switch input:checked + .te-sw { background: var(--accent); }
.te-switch input:checked + .te-sw::after { transform: translateX(18px); }
.te-switch input:focus-visible + .te-sw { outline: 3px solid rgba(43,89,255,.28); outline-offset: 2px; }
.te-switch .te-sw-txt { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.te-switch .te-sw-txt small { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 1px; }

/* ---------- Segmenty / chipy ---------- */
.te-seg { display: flex; gap: 4px; padding: 4px; background: var(--bg-soft); border-radius: 12px; }
.te-seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 9px 6px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.te-seg button:hover { color: var(--ink); }
.te-seg button.on { background: #fff; color: var(--accent-ink); box-shadow: 0 1px 6px rgba(20,20,40,.14); }
.te-seg button:disabled { opacity: .45; cursor: not-allowed; }

.te-chips-title { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 12px 0 7px; }
.te-chips-title:first-child { margin-top: 0; }
.te-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.te-chip { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.te-chip:hover { border-color: var(--accent); }
.te-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.te-chip small { font-weight: 500; opacity: .7; margin-left: 4px; }

.te select.te-select, .te-select {
  width: 100%; font: inherit; font-size: 14.5px; color: var(--ink); background: #fff; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 11px; padding: 11px 38px 11px 13px;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2374747c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.te-select:focus-visible { outline: 3px solid rgba(43,89,255,.22); border-color: var(--accent); }
.te-num { display: flex; gap: 8px; margin-top: 10px; }
.te-num input { flex: 1; min-width: 0; font: inherit; font-size: 14.5px; border: 1px solid var(--line-strong); border-radius: 11px; padding: 10px 12px; background: #fff; color: var(--ink); }
.te-num input:focus-visible { outline: 3px solid rgba(43,89,255,.22); border-color: var(--accent); }

/* ---------- Suwaki z wypełnieniem ---------- */
.te input[type="range"].range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 6px 0 4px; border-radius: 999px; cursor: pointer; outline: none;
  background: linear-gradient(to right, var(--accent) 0, var(--accent) var(--p, 50%), #dcdde4 var(--p, 50%), #dcdde4 100%);
}
.te input[type="range"].range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 2px 8px rgba(43,89,255,.35); cursor: grab; transition: transform .12s; }
.te input[type="range"].range::-webkit-slider-thumb:active { transform: scale(1.15); cursor: grabbing; }
.te input[type="range"].range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 2px 8px rgba(43,89,255,.35); cursor: grab; }
.te input[type="range"].range:focus-visible { box-shadow: 0 0 0 4px rgba(43,89,255,.18); }

/* ---------- Główna kolumna ---------- */
.te-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.te-stage { position: relative; border-radius: 18px; border: 1px solid var(--line); overflow: hidden;
  background: #f1f1f4 repeating-conic-gradient(#e9e9ee 0% 25%, #f4f4f7 0% 50%) 50% / 22px 22px; }
.te-stage-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 340px; padding: 30px; color: var(--muted); font-size: 14.5px;
  background: var(--bg-softer); border: 2px dashed var(--line-strong); border-radius: 18px;
}
.te-stage-empty[hidden] { display: none; }
.te-stage-empty .ic { width: 54px; height: 54px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 24px; }
.te-stage-empty b { color: var(--ink); font-size: 16px; }

/* Pasek narzędzi nad sceną */
.te-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.te-tools .te-sp { flex: 1; }
.te-iconbtn, .te-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-2);
  border-radius: 10px; height: 36px; padding: 0 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.te-iconbtn { width: 36px; padding: 0; font-size: 18px; line-height: 1; }
.te-iconbtn:hover, .te-pill:hover { border-color: var(--accent); background: var(--accent-soft); }
.te-pill.on, .te-iconbtn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.te-zoomval { min-width: 48px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; user-select: none; }
.te-zoomval:hover { color: var(--accent-ink); }

/* ---------- Taśma zdjęć (filmstrip) ---------- */
.te-stripwrap { display: none; }
.te-stripwrap.has { display: block; }
.te-stripbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.te-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; margin: 0; border: 0; }
.te-strip > div {
  position: relative; flex: none; width: 104px; height: 78px; padding: 0; border: 2px solid transparent; border-radius: 12px;
  overflow: hidden; cursor: pointer; background: var(--bg-soft); transition: border-color .15s, transform .15s; display: block; font-size: 0;
}
.te-strip > div:hover { transform: translateY(-2px); }
.te-strip > div.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,89,255,.16); }
.te-strip > div .thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.te-strip > div .name { display: none; }
.te-strip > div .size, .te-strip > div .badge {
  position: absolute; left: 5px; bottom: 5px; font-size: 10.5px; font-weight: 700; line-height: 1; color: #fff;
  background: rgba(19,19,22,.72); border-radius: 6px; padding: 3px 6px; font-family: ui-monospace, Menlo, monospace;
}
.te-strip > div .badge { background: var(--accent); font-family: inherit; }
.te-strip > div button {
  position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: rgba(19,19,22,.72); color: #fff; font-size: 11px; line-height: 22px; opacity: 0; transition: opacity .15s, background .15s;
}
.te-strip > div:hover button, .te-strip > div:focus-within button { opacity: 1; }
.te-strip > div button:hover { background: #e0522a; }
@media (hover: none) { .te-strip > div button { opacity: 1; } }

/* ---------- Wyniki ---------- */
.te-results { border: 1px solid var(--line); border-radius: 16px; background: #fff; overflow: hidden; }
.te-results:empty { display: none; }
.te-results .cmp-row { padding: 12px 16px; }
.te-results .cmp-row:last-child { border-bottom: 0; }
.te-results .cmp-row-stats .dl { border: 1px solid var(--line-strong); border-radius: 9px; padding: 6px 12px; background: #fff; }
.te-results .cmp-row-stats .dl:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Przyklejony pasek akcji ---------- */
.te-bar {
  position: sticky; bottom: 14px; z-index: 30; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.94); border: 1px solid var(--line);
  box-shadow: 0 16px 44px -18px rgba(20,20,40,.45); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.te-bar .te-bar-info { flex: 1; min-width: 160px; font-size: 13.5px; color: var(--ink-2); }
.te-bar .te-bar-info b { color: var(--accent-ink); }
.te-bar .btn { white-space: nowrap; }
.te-bar [hidden] { display: none !important; }
.te-progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; flex-basis: 100%; }
.te-progress[hidden] { display: none; }
.te-progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- Alert ---------- */
.te-alert { display: none; background: #fdf3e0; border: 1px solid #f3dcae; border-radius: 12px; padding: 11px 14px; font-size: 13.5px; color: #8a5a12; margin-top: 12px; }
.te-alert.on { display: block; }

/* ---------- Siatka kadru (kadrowanie) ---------- */
.te-grid-lines { position: absolute; inset: 0; pointer-events: none; z-index: 3; display: none;
  background:
    linear-gradient(to right, transparent calc(33.333% - .5px), rgba(255,255,255,.75) calc(33.333% - .5px), rgba(255,255,255,.75) calc(33.333% + .5px), transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), rgba(255,255,255,.75) calc(66.666% - .5px), rgba(255,255,255,.75) calc(66.666% + .5px), transparent calc(66.666% + .5px)),
    linear-gradient(to bottom, transparent calc(33.333% - .5px), rgba(255,255,255,.75) calc(33.333% - .5px), rgba(255,255,255,.75) calc(33.333% + .5px), transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), rgba(255,255,255,.75) calc(66.666% - .5px), rgba(255,255,255,.75) calc(66.666% + .5px), transparent calc(66.666% + .5px));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}
.te-stage.show-grid .te-grid-lines { display: block; }

/* ---------- Siatka pozycji (znak wodny) ---------- */
.te .wz-pos-grid { max-width: 150px; gap: 6px; }
.te .wz-pos-grid button { border-radius: 9px; }

/* ---------- Karty podglądów (znak wodny) ---------- */
.te .wz-results { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 0; gap: 14px; }
.te .wz-card { background: #fff; border-radius: 14px; box-shadow: 0 10px 30px -24px rgba(20,20,40,.5); }
.te .wz-card-foot { border-top: 1px solid var(--line); }
.te .wz-card-foot button:hover { color: #e0522a; }

/* ---------- Mobile: pasek akcji na całą szerokość ---------- */
.te-bar > span:not([hidden]) { display: contents; }
@media (max-width: 960px) {
  .te-bar { bottom: 8px; padding: 10px 12px; gap: 8px; }
  .te-bar .te-bar-info { flex-basis: 100%; font-size: 12.5px; }
  .te-bar .btn { flex: 1; padding: 11px 10px; font-size: 14px; }
}
