/*!
 * 123PhotoTool tool-page layout: one look for every tool.
 *
 * Every photo tool is the same five parts, in the same places:
 *
 *   .pt-tool               the tool card (title + grid)
 *   .pt-tool-panel         controls: upload zone, settings, then save
 *     .pt-tool-upload        the "Upload Photo / drop / paste" zone
 *     .pt-tool-save          format, quality and the Save button, last
 *   .pt-tool-stage         the editor column
 *     .pt-tool-viewport      the photo's box: empty state, then the canvas
 *     .pt-tool-empty         empty state: one Upload button and the samples
 *     .pt-tool-status        the one-line message under the photo
 *
 * Desktop: controls on the left, the photo on the right in a workspace of
 * a fixed height, so the editor is the same size from tool to tool. Phone:
 * the photo first, with its one Upload button; once a photo loads the
 * full-screen editor (pt-app.css) takes over.
 *
 * The pages carry years of inline styles (borders, fixed 450px boxes), so
 * the rules that set the shared look are !important by design.
 */
:root {
  --pt-radius: 16px;
  --pt-radius-sm: 12px;
  --pt-line: #e3e7ee;
  --pt-surface: #f6f8fb;
  --pt-ink: #343f52;
  --pt-muted: #6c757d;
  --pt-accent: var(--bs-primary, #3f78e0);
  --pt-accent-soft: rgba(63, 120, 224, 0.06);
  --pt-ws-h: clamp(440px, 66vh, 720px);
  --pt-ws-h-phone: min(60vh, 520px);
}

/* Nothing on a phone page may push the layout wider than the screen: one
   stray element (a long FAQ question that would not wrap) widens the layout
   viewport, the page scrolls sideways and every tap lands off target. */
html { overflow-x: clip; }
/* Scrolling something into view (focus, #links, find, scrollIntoView) stops
   below the sticky header; --pt-head is its height (pt-app.js measures it). */
html { scroll-padding-top: calc(var(--pt-head, 78px) + 12px); }
/* The theme's body { overflow-x: hidden !important } stops reaching the
   viewport once <html> clips, and makes <body> a scroll container of its
   own: the window never scrolls, so the sticky header and back-to-top never
   show and phones keep their address bar open. clip makes no scroller. */
body { overflow-x: clip !important; }
.card-header .btn-link { white-space: normal; text-align: start; }
.card-header .btn-link > .uil { flex: none; margin-inline-start: 8px; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.pt-tool > h1,
.pt-tool > .pt-tool-title {
  font-size: clamp(1.45rem, 1.05rem + 1.3vw, 2.05rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1.5rem !important;
}

/* ── Controls panel ──────────────────────────────────────────────────────── */
.pt-tool-panel { gap: 0; }
.pt-tool-panel > * { width: 100%; }
.pt-tool-upload {
  border: 1.5px dashed #c5d3ea !important;
  border-radius: var(--pt-radius-sm) !important;
  background: var(--pt-accent-soft) !important;
  padding: 14px 12px !important;
  margin-bottom: 1.25rem !important;
  transition: border-color 0.15s, background-color 0.15s;
}
.pt-tool-upload:hover { border-color: var(--pt-accent) !important; }
.pt-tool-upload .btn { min-height: 46px; font-weight: 600; }
.pt-tool-upload p { margin-bottom: 0 !important; }
/* Each setting: name on the left, live value on the right, control below. */
.pt-tool-panel .form-label { color: var(--pt-ink); font-weight: 600; }
/* The value keeps its own order: "20 px" in an Arabic page otherwise reads
   "px 20" (the phone editor's readout does the same). */
.pt-tool-panel .form-label > span[id$="-value"],
.pt-tool-panel [id$="-value"].fw-bold { font-variant-numeric: tabular-nums; unicode-bidi: plaintext; }
.pt-tool-panel .form-range { height: 1.75rem; }
.pt-tool-save {
  border-top: 1px solid var(--pt-line);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
  margin-bottom: 0 !important;
}
.pt-tool-savebar { margin-top: 0.25rem; margin-bottom: 0 !important; display: flex; flex-wrap: wrap; gap: 8px; }
.pt-tool-savebar > .btn:not(.btn-success) { min-height: 50px; flex: 1 0 auto; }
.pt-tool-save .btn-success,
.pt-tool-savebar .btn-success {
  width: 100%;
  min-height: 50px;
  font-weight: 600;
  font-size: 1rem;
  /* Bootstrap's own: smudge and blur-editor set every phone button to 1.4,
     which made their Save 6px shorter than everyone else's. */
  line-height: var(--bs-btn-line-height);
}
/* A second button sits beside Save at its own size while the two fit; when
   they do not ("Copy Color Information", "Farbinformationen kopieren") each
   takes a full row. Labels wrap rather than run out of the bar (.btn is
   nowrap). The grow weights keep the spare room on Save's side. */
.pt-tool-savebar > .btn { min-width: 0; max-width: 100%; white-space: normal; }
.pt-tool-savebar > .btn-success { width: auto; flex: 1000 1 auto; }

/* Save in progress (pt-app.js): the button holds a spinner until the file is
   ready, and a second click is ignored. */
.btn.pt-saving { position: relative; color: transparent !important; pointer-events: none; }
.btn.pt-saving::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  border: 3px solid rgba(30, 34, 40, 0.25);
  border-top-color: #1e2228;
  animation: pt-ui-spin 0.8s linear infinite;
}
@keyframes pt-ui-spin { to { transform: rotate(360deg); } }

/* ── Editor ──────────────────────────────────────────────────────────────── */
.pt-tool-viewport {
  position: relative;
  width: 100%;
  min-height: 420px !important;
  max-height: none !important;
  max-width: none !important;
  border: 1px solid var(--pt-line) !important;
  border-radius: var(--pt-radius) !important;
  background: var(--pt-surface) !important;
  box-shadow: none !important;
}
/* A workspace of one size on every tool, empty or loaded (so nothing jumps
   when the photo arrives); the photo is fitted in it. */
@media (min-width: 768px) {
  .pt-tool-viewport { height: var(--pt-ws-h) !important; }
  /* Where the settings run longer than the photo box, the photo stays in
     view while the lower settings are used (below the fixed header). */
  .pt-tool-stage { position: sticky; top: calc(var(--pt-head, 78px) + 10px); align-self: flex-start; }
  /* A tool's own toolbars (Undo / Redo, zoom) sit in one row under the
     photo, so the photo box starts level with the upload box as on every
     other tool. */
  .pt-tool-stage:has(> .pt-tool-deskbar) {
    flex-direction: row !important;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center !important;
    column-gap: 12px;
  }
  .pt-tool-stage:has(> .pt-tool-deskbar) > * { flex: 0 0 100%; order: 2; }
  .pt-tool-stage:has(> .pt-tool-deskbar) > .pt-tool-viewport { order: 0; }
  /* One button height, icon font or SVG, so toolbars side by side line up;
     an icon and its label sit 6px apart. */
  .pt-tool-deskbar .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding-top: 0; padding-bottom: 0; }
  .pt-tool-deskbar .btn > .uil { line-height: 1; }
  .pt-tool-stage > .pt-tool-deskbar {
    order: 1 !important;
    flex: 0 1 auto !important;
    width: auto !important;
    margin: 12px 0 0 !important;
    /* Never wider than the photo box: long labels (de, fr, ru) wrap to a
       second row instead of running past the card at tablet widths. */
    max-width: 100%;
    flex-wrap: wrap;
    row-gap: 8px;
  }
}
/* Tablet portrait (iPad, 768-991px wide): side by side, the photo box was
   ~360px wide and 720 tall, so a landscape photo was a 334x250 strip in the
   middle of it. The photo goes on top at the full width, the settings under
   it, and the box takes about half the screen so the first settings are in
   view under it. Landscape tablets and small laptop windows keep the
   columns. */
@media (min-width: 768px) and (max-width: 991.98px) and (orientation: portrait) {
  :root { --pt-ws-h: clamp(420px, 50vh, 620px); }
  .pt-tool .pt-tool-stage,
  .pt-tool .pt-tool-panel { flex: 0 0 100% !important; width: 100% !important; max-width: 100% !important; }
  .pt-tool .pt-tool-stage { order: 1 !important; position: static; }
  .pt-tool .pt-tool-panel { order: 2 !important; margin-top: 1.25rem; }
}
.pt-fit-page .pt-app-fit {
  width: var(--pt-fit-w) !important;
  height: var(--pt-fit-h) !important;
  max-width: none !important;
  max-height: none !important;
}
.pt-tool-empty-upload { min-height: 48px; font-weight: 600; padding-left: 1.5rem; padding-right: 1.5rem; }
.pt-tool-status {
  min-height: 1.5em;
  font-size: 0.875rem;
  color: var(--pt-muted);
  text-align: center;
}

/* Desktop extras the shell adds to the photo box (pt-app.js). */
.pt-vbar {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  z-index: 6;
  display: none;
  gap: 6px;
}
.pt-app-loaded > .pt-vbar { display: flex; }
html.pt-phone .pt-vbar { display: none !important; }
.pt-vbar-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--pt-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  padding: 0;
}
.pt-vbar-btn svg { width: 20px; height: 20px; }
.pt-vbar-btn:hover { background: #fff; color: var(--pt-accent); }
.pt-vbar-btn.pressed { background: var(--pt-accent); color: #fff; }
.pt-compare-label {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 6;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
  display: none;
}
.pt-comparing > .pt-compare-label { display: block; }

/* Drop a photo anywhere on a tool page (desktop). */
.pt-drop {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(63, 120, 224, 0.14);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.pt-drop.show { display: flex; }
.pt-drop-card {
  padding: 28px 40px;
  border: 2px dashed var(--pt-accent);
  border-radius: 20px;
  background: #fff;
  color: var(--pt-ink);
  font-size: 1.15rem;
  font-weight: 700;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* ── Phone page ──────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .pt-tool { padding: 1rem !important; }
  .pt-tool > h1, .pt-tool > .pt-tool-title { margin-bottom: 1rem !important; }
  .pt-tool-viewport { min-height: 320px !important; }
  /* Between editing sessions the photo is a picture on the page: the box
     hugs it (pt-app.js fits it to the width and a share of the height). */
  /* Scoped to the page column: in the editor the box sits in the stage. */
  .pt-tool-stage > .pt-tool-viewport.pt-app-loaded.pt-fit-page { height: auto !important; min-height: 0 !important; }
  .pt-tool-stage > .pt-tool-viewport.pt-app-loaded:not(.pt-fit-page) { height: var(--pt-ws-h-phone) !important; }
  /* One way in: the Upload button in the photo box, not a second one above. */
  .pt-tool .pt-tool-mobile-upload { display: none !important; }
  .pt-tool .pt-tool-empty-upload { display: flex !important; }
  .pt-tool-panel { margin-top: 1rem !important; }
  /* iOS zooms the page into any field under 16px when it is tapped, and
     the theme's are 15px. */
  .pt-tool .form-select, .pt-tool .form-control { font-size: 16px; }
  /* With the phone editor, every control lives in it: the page is the
     title, the photo box and the content. (In the editor's sheet the panel
     is no longer inside .pt-tool, so this does not reach it there.) */
  /* .pt-tool-app is in the markup, not set by script, so nothing shifts. */
  .pt-tool.pt-tool-app .pt-tool-panel { display: none !important; }
  /* Toolbars over the photo (Undo / Redo, zoom) live in the editor's top
     bar on a phone. */
  .pt-tool.pt-tool-app .pt-tool-deskbar { display: none !important; }
  /* "drag & drop" means nothing on a phone; the box says what to do. An
     error stays (a file that would not open, a photo too big for the tool):
     with no photo in, the editor never opens to say it. */
  .pt-tool.pt-tool-app .pt-tool-stage:has(.pt-tool-viewport:not(.pt-app-loaded)) .pt-tool-status:not(.text-danger) { display: none; }
}
