/*
  True PDF Redactor — additions layered on top of merge-tool.css's shared
  chrome (processing overlay, error modal, settings panel, toolbar, file
  cards) and bates-tool.css's shared components (accordion).
*/

/* ---------- Empty studio state ---------- */

.redactor-editor-empty-state {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: auto;
}

.redactor-empty-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    max-width: 520px;
    min-height: 240px;
    padding: 2rem 1.25rem;
    border: 2px dashed var(--color-border-strong, var(--color-border));
    border-radius: 16px;
    background: var(--color-surface);
    cursor: pointer;
    text-align: center;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.redactor-empty-dropzone:hover,
.redactor-empty-dropzone.is-dragover {
    border-color: var(--color-primary);
    background: var(--color-surface-soft);
}

.redactor-empty-dropzone h4 {
    margin: 0.5rem 0 0.1rem;
    font-weight: 700;
    color: var(--color-text);
}

.redactor-empty-dropzone p {
    margin: 0;
    font-size: var(--font-size-sm);
}

/* ---------- Pages-only studio: this tool has no Files view, so the shared
   .global-file-stage host (normally a scrolling grid) needs to stretch to the
   full available height instead of shrink-wrapping its content. ---------- */

#fileListContainer {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* ---------- File tabs: compact switcher, replaces the old file-card grid ---------- */

.redactor-file-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-soft);
}

.redactor-file-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 200px;
    padding: 0.25rem 0.4rem 0.25rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
}

.redactor-file-tab.is-active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
}

.redactor-file-tab .tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.redactor-file-tab .tab-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: var(--color-muted);
    flex-shrink: 0;
}

.redactor-file-tab .tab-remove:hover {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}

/* ---------- Pages view: mini page strip + main drawing canvas ---------- */

.redactor-pages-view {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.redactor-pages-row {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.redactor-page-strip {
    flex: 0 0 84px;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    border-right: 1px solid var(--color-border);
    background: var(--color-surface-soft);
}

.redactor-strip-thumb {
    position: relative;
    width: 100%;
    border: 2px solid transparent;
    border-radius: var(--radius-sm, 6px);
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.08));
    line-height: 0;
}

.redactor-strip-thumb.is-current {
    border-color: var(--color-primary);
}

.redactor-strip-thumb canvas {
    display: block;
    width: 100%;
    height: auto;
}

.redactor-strip-thumb .strip-page-label {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    font-size: 0.58rem;
    padding: 0 4px;
    border-radius: 3px;
}

.redactor-strip-thumb .strip-zone-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--color-danger, #dc2626);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0 5px;
    border-radius: 999px;
}

.redactor-main-canvas-wrap {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* No justify-content:center here — centering a flex item that's taller
       than its scrollable container clips its start off-screen (the classic
       flexbox-centering-hides-the-top bug). Auto margins on the child give
       the same "centered when it fits, top-aligned when it scrolls" result
       without that clipping. */
    overflow: auto;
    scrollbar-gutter: stable;
    padding: 1rem;
    background: var(--color-canvas);
}

.redactor-canvas-stage {
    position: relative;
    margin: auto;
    box-shadow: var(--shadow-md);
    background: #fff;
}

.redactor-canvas-stage canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

#pageRenderCanvas {
    position: relative;
}

#zoneOverlayCanvas {
    cursor: crosshair;
}

.redactor-page-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* ---------- Settings ---------- */

#flattenWarning {
    line-height: 1.4;
}

#zoneCountBadge {
    white-space: nowrap;
}

/* ---------- Mobile: hide the left page-thumbnail strip (the canvas's own
   prev/next page nav already handles navigation) so the canvas gets full
   width instead of being squeezed. ---------- */
@media (max-width: 900px) {
    .redactor-page-strip {
        display: none;
    }
}
