/**
 * DC PDF Editor — layout: dokument na środku + pasek narzędzi
 */

.tool-main--editor {
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

.pdf-hint--toolbar {
  padding: 0;
  flex: 1;
  min-width: 180px;
}

.pdf-hint--toolbar a,
.tool-article__card a {
  color: var(--dc-brand);
  font-weight: 700;
}

/* Empty hero drop */
.pdf-empty {
  padding: 1.25rem 1.5rem 1.75rem;
}

.pdf-drop--hero .dc-drop__zone {
  min-height: 280px;
  padding: 2.5rem 1.5rem;
}

/* Editor shell */
.pdf-editor {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: 68vh;
  border-top: 1px solid var(--dc-line);
}

@media (max-width: 900px) {
  .pdf-editor {
    grid-template-columns: 1fr;
  }
}

.pdf-sidebar {
  padding: 1rem 1rem 1.25rem;
  border-right: 1px solid var(--dc-line);
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: visible;
  max-height: none;
  height: auto;
  align-self: start;
}

@media (max-width: 900px) {
  .pdf-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--dc-line);
  }
}

.pdf-sidebar__file {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--dc-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-sidebar__label {
  margin: 0.35rem 0 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dc-text-muted);
}

.pdf-sidebar__nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pdf-page-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 12px;
  color: var(--dc-text-muted);
  min-width: 0;
}

.pdf-page-label .dc-select {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.45rem;
}

.pdf-acc {
  gap: 0.4rem;
}

.pdf-sidebar .dc-accordion__item {
  background: var(--dc-bg-muted);
}

.pdf-sidebar .dc-accordion__trigger {
  padding: 0.5rem 0.6rem;
  gap: 0.5rem;
  font-size: 13px;
}

.pdf-sidebar .dc-accordion__icon {
  width: 28px;
  height: 28px;
  font-size: 13px;
}

.pdf-sidebar .dc-accordion__title {
  line-height: 1.2;
}

.pdf-sidebar .dc-accordion__sub {
  font-size: 11px;
  font-weight: 500;
  margin-top: 0.12rem;
}

.pdf-sidebar .dc-accordion__chevron {
  width: auto;
  height: auto;
  font-size: 11px;
}

.pdf-sidebar .dc-accordion__body {
  padding: 0 0.65rem 0.7rem;
  font-size: 12px;
  line-height: 1.45;
}

.pdf-acc .dc-accordion__item.is-tool-active {
  border-color: var(--dc-brand);
  box-shadow: 0 0 0 1px rgba(var(--dc-brand-rgb), 0.35);
}

.pdf-opts {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0;
}

.pdf-img-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pdf-img-tile {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.35rem 0.3rem 0.3rem;
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius-sm);
  background: rgba(0, 0, 0, 0.22);
  cursor: grab;
  user-select: none;
}

.pdf-img-tile:hover {
  border-color: rgba(var(--dc-brand-rgb), 0.5);
}

.pdf-img-tile.is-active {
  border-color: var(--dc-brand);
  background: rgba(var(--dc-brand-rgb), 0.14);
}

.pdf-img-tile:active {
  cursor: grabbing;
}

.pdf-img-tile img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: #fff;
  pointer-events: none;
}

.pdf-img-tile__name {
  min-width: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--dc-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-img-tile__del {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--dc-line);
  border-radius: 6px;
  background: transparent;
  color: var(--dc-text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.pdf-img-tile__del:hover {
  color: #fb7185;
  border-color: rgba(251, 113, 133, 0.55);
  background: rgba(251, 113, 133, 0.12);
}

.pdf-page-stage.is-img-drop {
  outline: 2px dashed var(--dc-brand);
  outline-offset: 4px;
}

.pdf-opts .dc-hint {
  margin: 0;
}

.pdf-btn-block {
  width: 100%;
  justify-content: center;
}

.pdf-color {
  width: 100%;
  height: 36px;
  padding: 0;
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius-sm);
  background: transparent;
  cursor: pointer;
}

.dc-input {
  width: 100%;
  min-height: 40px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius-sm);
  background: var(--dc-bg-muted);
  color: var(--dc-text);
  font: inherit;
}

.pdf-form-fields {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 220px;
  overflow: auto;
}

.pdf-form-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--dc-text-muted);
  margin-bottom: 0.25rem;
}

/* Viewport — dokument */
.pdf-viewport {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 68vh;
  background: #0a0c10;
}

.pdf-zoombar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.65rem;
  padding: 0.65rem 0.85rem;
  background: #12151c;
  border-bottom: 1px solid var(--dc-line);
  z-index: 6;
}

.pdf-zoombar__label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0.35rem 0 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--dc-text);
}

.pdf-zoombar__label .fa {
  color: var(--dc-brand);
  font-size: 16px;
}

.pdf-zoombar .dc-btn {
  min-width: 42px;
  padding: 0.45rem 0.65rem;
  font-weight: 700;
}

.pdf-zoombar__value {
  min-width: 4.5rem;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  padding: 0.35rem 0.55rem;
  border-radius: var(--dc-radius-sm);
  background: rgba(var(--dc-brand-rgb), 0.18);
  border: 1px solid rgba(var(--dc-brand-rgb), 0.45);
}

.pdf-place-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: rgba(var(--dc-brand-rgb), 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.pdf-viewport__scroll {
  flex: 1;
  overflow: auto;
  padding: 1.25rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.pdf-page-stage {
  position: relative;
  display: inline-block;
  line-height: 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  background: #fff;
  cursor: default;
}

.pdf-page-stage.is-place {
  cursor: crosshair;
}

.pdf-page-stage.is-draw {
  cursor: crosshair;
}

.pdf-page-stage canvas#pageCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
}

.pdf-draw-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.pdf-page-stage.is-draw .pdf-draw-layer {
  pointer-events: auto;
}

.pdf-overlay-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* Elements on page */
.pdf-el {
  position: absolute;
  pointer-events: auto;
  box-sizing: border-box;
  outline: 1px dashed transparent;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.pdf-el.is-selected {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
  z-index: 4;
}

.pdf-el.is-dragging {
  cursor: grabbing;
}

.pdf-el--image {
  border: 1px dashed rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.06);
}

.pdf-el--image img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  -webkit-user-drag: none;
}

.pdf-el-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid #3b82f6;
  border-radius: 2px;
  z-index: 5;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.25);
}

.pdf-el-handle--nw {
  left: -6px;
  top: -6px;
  cursor: nwse-resize;
}

.pdf-el-handle--ne {
  right: -6px;
  top: -6px;
  cursor: nesw-resize;
}

.pdf-el-handle--sw {
  left: -6px;
  bottom: -6px;
  cursor: nesw-resize;
}

.pdf-el-handle--se {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}

.pdf-el--text {
  min-width: 40px;
  max-width: 70%;
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px dashed rgba(37, 99, 235, 0.45);
  color: #111827;
  font-weight: 600;
  line-height: 1.25;
  white-space: pre-wrap;
  word-break: break-word;
}

.pdf-el--text[contenteditable="true"] {
  cursor: text;
  background: rgba(255, 255, 255, 0.85);
  outline: 2px solid #2563eb;
}

.pdf-el--comment {
  min-width: 110px;
  max-width: 220px;
  padding: 0.4rem 0.5rem;
  background: #fef08a;
  color: #1c1917;
  border: 1px solid #ca8a04;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  word-break: break-word;
}

.pdf-busy {
  opacity: 0.7;
  pointer-events: none;
}
