/* /public/assets/css/tools/sign-pdf.css (FULL REPLACEMENT)
   Editor-only Tool UI (wie Screenshot) – passend zu sign_pdf.twig
*/

:root{
  --bg1:#f5f7ff;
  --bg2:#ffffff;

  --card: rgba(255,255,255,.82);

  --stroke:rgba(15,23,42,.10);
  --stroke2:rgba(15,23,42,.08);

  --text:#0b1220;
  --muted:rgba(15,23,42,.65);

  --blue:#2f67ff;
  --blue2:#4e7bff;

  --shadow: 0 18px 55px rgba(46, 70, 140, .14);
  --shadow2: 0 10px 30px rgba(46, 70, 140, .12);

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
}

/* verhindert “seitliches ziehen” auf mobile */
html, body{ width:100%; overflow-x:hidden; }

.ps{
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 50% 0%, rgba(47,103,255,.10), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg2) 60%);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

.ps *{ box-sizing: border-box; }
.ps a{ color: inherit; }
.ps button{ font: inherit; }

/* sr-only (falls base.twig es nicht hat) */
.sr-only{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

/* ------------------------------------------------------------
   Header
------------------------------------------------------------ */
.ps-header{
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 18px 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
}

.ps-brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color: var(--text);
}

.ps-brand__mark{
  width:40px;height:40px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: rgba(47,103,255,.12);
  color: var(--blue);
}

.ps-brand__text{
  font-weight: 900;
  letter-spacing: .2px;
  font-size: 18px;
}

.ps-header__right{
  display:flex;
  align-items:center;
  gap:10px;
}

/* icon button base */
.ps-icbtn{
  height:38px;
  border-radius: 999px;
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(0,0,0,.04);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  font-size: 14px;
  padding: 0 12px;
  color: rgba(15,23,42,.86);
  user-select:none;
}

/* text version used for label (PDF wählen) */
.ps-icbtn--text{
  font-weight: 900;
  letter-spacing: .2px;
}

/* language details */
.ps-lang{ position: relative; }
.ps-lang summary{ list-style:none; }
.ps-lang summary::-webkit-details-marker{ display:none; }

.ps-flag{ font-size: 16px; }
.ps-langcode{ font-weight: 900; font-size: 12px; opacity:.85; }
.ps-chev{ opacity:.6; font-weight: 900; }

.ps-langmenu{
  position:absolute;
  right:0;
  top: 44px;
  min-width: 180px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 14px;
  box-shadow: 0 18px 55px rgba(0,0,0,.12);
  padding: 8px;
  z-index: 10;
}

.ps-langitem{
  text-decoration:none;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  color: rgba(15,23,42,.86);
  font-weight: 800;
}

.ps-langitem:hover{ background: rgba(47,103,255,.08); }
.ps-langitem.is-active{
  background: rgba(47,103,255,.14);
  border: 1px solid rgba(47,103,255,.18);
}

/* ------------------------------------------------------------
   App Layout (3 columns)
------------------------------------------------------------ */
.ps-app{
  max-width: 1320px;
  margin: 8px auto 26px;
  padding: 0 18px 24px;
  display:grid;
  grid-template-columns: 180px minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.ps-left, .ps-center, .ps-right{
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(10px);
}

/* ------------------------------------------------------------
   Left: Thumbnails
------------------------------------------------------------ */
.ps-left{ padding: 14px; }

.ps-left__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 12px;
}

.ps-left__pager{
  font-weight: 900;
  color: rgba(15,23,42,.70);
  font-size: 12px;
  min-width: 74px;
  text-align:center;
}

.ps-navbtn{
  width: 34px; height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.86);
  cursor:pointer;
  font-weight: 900;
  color: rgba(15,23,42,.70);
}
.ps-navbtn:disabled{ opacity:.55; cursor:not-allowed; }

.ps-thumbs{
  display:flex;
  flex-direction:column;
  gap: 12px;
  max-height: 680px;
  overflow:auto;
  padding-right: 6px;
  overscroll-behavior: contain;
}

.ps-thumb{
  position: relative;
  border-radius: 14px;
  border: 2px solid rgba(15,23,42,.08);
  background: rgba(255,255,255,.90);
  cursor:pointer;
  padding: 10px;
  text-align:center;
}

.ps-thumb--active{
  border-color: rgba(47,103,255,.55);
  box-shadow: 0 10px 26px rgba(47,103,255,.18);
}

.ps-thumb__num{
  position:absolute;
  left: 10px;
  top: 10px;
  width: 34px; height: 34px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  font-weight: 900;
  background: rgba(47,103,255,.22);
  color: rgba(15,23,42,.92);
  border: 1px solid rgba(47,103,255,.22);
}
.ps-thumb--active .ps-thumb__num{
  background: var(--blue);
  color:#fff;
  border-color: rgba(255,255,255,.18);
}

.ps-thumb canvas{
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(15,23,42,.08);
  background:#fff;
}

/* ------------------------------------------------------------
   Center: Viewer
------------------------------------------------------------ */
.ps-center{ padding: 14px; }

.ps-canvasWrap{
  display:flex;
  flex-direction:column;
  gap: 12px;
}

.ps-canvasFrame{
  border-radius: var(--r-lg);
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(245,247,255,.70);
  padding: 16px;
  display:flex;
  justify-content:center;
  align-items:center;
  min-height: 660px;
}

.pageStage{
  position: relative;
  display:inline-block;
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
}

#pdfCanvas{
  display:block;
  border-radius: 10px;
  background:#fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

/* Overlay */
.overlay{
  position:absolute;
  left:0; top:0;
  pointer-events:auto;
}

.sticker{
  position:absolute;
  pointer-events:auto;
  user-select:none;
  transform-origin: top left;
}

.sticker__box{
  position:absolute;
  inset:0;
  border: 2px dashed rgba(47,103,255,.65);
  border-radius: 8px;
  pointer-events:none;
}

.sticker__handle{
  position:absolute;
  width: 12px; height: 12px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(47,103,255,.75);
  box-shadow: 0 6px 16px rgba(47,103,255,.20);
  pointer-events:auto;
}

.sticker__handle[data-h="nw"]{ left:-6px; top:-6px; cursor:nwse-resize; }
.sticker__handle[data-h="ne"]{ right:-6px; top:-6px; cursor:nesw-resize; }
.sticker__handle[data-h="sw"]{ left:-6px; bottom:-6px; cursor:nesw-resize; }
.sticker__handle[data-h="se"]{ right:-6px; bottom:-6px; cursor:nwse-resize; }
.sticker__handle[data-h="n"]{ left:50%; top:-6px; transform:translateX(-50%); cursor:ns-resize; }
.sticker__handle[data-h="s"]{ left:50%; bottom:-6px; transform:translateX(-50%); cursor:ns-resize; }
.sticker__handle[data-h="w"]{ left:-6px; top:50%; transform:translateY(-50%); cursor:ew-resize; }
.sticker__handle[data-h="e"]{ right:-6px; top:50%; transform:translateY(-50%); cursor:ew-resize; }

/* Bottom bar */
.ps-bottomBar{
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.86);
  box-shadow: 0 10px 28px rgba(0,0,0,.05);
  padding: 10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.ps-bottomLeft, .ps-bottomMid, .ps-bottomRight{
  display:flex;
  align-items:center;
  gap: 10px;
}

.ps-bottomBtn{
  height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(245,247,255,.86);
  cursor:pointer;
  font-weight: 900;
  color: rgba(15,23,42,.72);
}

.ps-zoom{
  font-weight: 900;
  color: rgba(15,23,42,.76);
  min-width: 52px;
  text-align:center;
}

.ps-pageBtn{
  width: 38px; height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(245,247,255,.86);
  cursor:pointer;
  font-weight: 900;
  color: rgba(15,23,42,.72);
}
.ps-pageBtn:disabled,
.ps-bottomBtn:disabled{
  opacity:.55;
  cursor:not-allowed;
}

.ps-pageInfo{
  font-weight: 900;
  color: rgba(15,23,42,.76);
  min-width: 130px;
  text-align:center;
}

.ps-iconBtn{
  width: 38px; height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.86);
  cursor:pointer;
  font-weight: 900;
  color: rgba(15,23,42,.68);
}

/* Empty overlay (im viewerStage) */
.ps-empty{
  position:absolute;
  inset: 0;
  display:grid;
  place-items:center;
  padding: 18px;
  background: radial-gradient(800px 500px at 50% 0%, rgba(47,103,255,.10), transparent 60%);
}

.ps-empty__card{
  width: min(520px, 92%);
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 70px rgba(0,0,0,.14);
  padding: 18px;
  text-align:center;
}

.ps-empty__title{
  font-size: 18px;
  font-weight: 950;
  margin-bottom: 6px;
}

.ps-empty__sub{
  color: rgba(15,23,42,.70);
  font-weight: 650;
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 12px;
}

/* ------------------------------------------------------------
   Right: Controls
------------------------------------------------------------ */
.ps-right{ padding: 14px; }

.ps-tabs{
  display:flex;
  gap: 10px;
  border-radius: 999px;
  background: rgba(245,247,255,.72);
  border: 1px solid rgba(15,23,42,.10);
  padding: 8px;
}

.ps-tab{
  flex:1;
  height: 40px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  cursor:pointer;
  font-weight: 900;
  color: rgba(15,23,42,.62);
}

.ps-tab--active{
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
  color: rgba(15,23,42,.88);
}

.ps-panel{
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.86);
}

.ps-panel h3{
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 900;
}

.ps-mini{
  margin: 10px 0 0;
  color: rgba(15,23,42,.62);
  font-size: 12px;
  font-weight: 650;
}

.ps-row{
  display:flex;
  gap: 10px;
  margin-top: 12px;
}

.ps-btn{
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(245,247,255,.78);
  cursor:pointer;
  font-weight: 900;
  color: rgba(15,23,42,.78);
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.ps-btn--primary{
  background: linear-gradient(180deg, rgba(75,123,255,.98), rgba(47,103,255,.95));
  border-color: rgba(47,103,255,.25);
  color:#fff;
  box-shadow: 0 14px 30px rgba(47,103,255,.22);
}

.ps-btn--ghost{ background: rgba(255,255,255,.72); }
.ps-btn--block{ width: 100%; }
.ps-btn--big{ height: 52px; font-size: 16px; }

.ps-sigBox{
  height: 180px;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(245,247,255,.65);
  overflow:hidden;
  display:flex;
}
#sigCanvas{ width:100%; height:100%; display:block; }

.ps-imgPrevWrap{
  margin-top: 12px;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(245,247,255,.65);
  padding: 12px;
  display:none;
}

.ps-imgPrevWrap img{
  width:100%;
  height:auto;
  display:block;
  border-radius: 10px;
  background:#fff;
}

.ps-field{ margin-top: 14px; }
.ps-label{
  display:block;
  font-weight: 900;
  margin-bottom: 8px;
  color: rgba(15,23,42,.72);
}

.ps-rangeRow, .ps-sizeRow{
  display:flex;
  align-items:center;
  gap: 10px;
}

.ps-stepBtn{
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.86);
  cursor:pointer;
  font-weight: 900;
  color: rgba(15,23,42,.72);
}

input[type="range"]{ width:100%; accent-color: var(--blue); }

.ps-check{
  margin-top: 12px;
  display:flex;
  align-items:center;
  gap: 10px;
  font-weight: 900;
  color: rgba(15,23,42,.72);
}

.ps-check input{ width: 18px; height: 18px; }

/* pane visibility */
.pane{ display:none; }
.pane--active{ display:block; }

/* ------------------------------------------------------------
   Download Modal (Twig: ps-modal__*)
------------------------------------------------------------ */
.ps-modal{ position: fixed; inset:0; z-index: 50; }
.ps-modal[hidden]{ display:none; }

.ps-modal__backdrop{
  position:absolute;
  inset:0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(6px);
}

.ps-modal__card{
  position: relative;
  z-index: 2;
  width: min(520px, 92vw);
  margin: 0 auto;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(15,23,42,.12);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 70px rgba(0,0,0,.22);
  padding: 18px;
  text-align:center;
}

.ps-modal__title{
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 950;
}

/* ------------------------------------------------------------
   SEO Section (below fold)
------------------------------------------------------------ */
.ps-seo{
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 18px 34px;
  color: rgba(15,23,42,.78);
}

.ps-seo__intro{ margin: 18px 0 10px; font-weight: 650; }

.ps-seo__list{
  margin: 0;
  padding-left: 18px;
}
.ps-seo__list li{ margin: 8px 0; }

.ps-seo__faq{ margin-top: 16px; }
.ps-seo__faq h2{
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 950;
  color: rgba(15,23,42,.90);
}

.ps-faq{
  background: rgba(255,255,255,.70);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 14px;
  padding: 10px 12px;
  margin-top: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,.05);
}
.ps-faq summary{
  cursor:pointer;
  font-weight: 900;
  color: rgba(15,23,42,.88);
}
.ps-faq__a{
  margin-top: 8px;
  color: rgba(15,23,42,.74);
  font-weight: 650;
  line-height: 1.45;
}

/* ------------------------------------------------------------
   Responsive
------------------------------------------------------------ */
@media (max-width: 980px){
  .ps-app{ grid-template-columns: 1fr; }
  .ps-left{ order: 2; }
  .ps-center{ order: 1; }
  .ps-right{ order: 3; }

  .ps-thumbs{
    flex-direction:row;
    max-height: none;
    overflow:auto;
    padding-bottom: 6px;
  }
  .ps-thumb{ min-width: 140px; }
  .ps-canvasFrame{ min-height: 520px; }
}

@media (max-width: 520px){
  .ps-header{ padding: 14px 14px 8px; }
  .ps-brand__text{ display:none; }
  .ps-app{ padding: 0 14px 18px; }
  .ps-canvasFrame{ padding: 12px; }
  .ps-pageInfo{ min-width: 100px; }
}
