/* ============================================================
   esign-pdf.css  —  PDF eSign Tool Styles
   ============================================================ */
:root {
    --primary: #6366f1;
}

body.light {
    --primary: #4f46e5;
}

.tool-header {
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto 40px auto;
}


.tool-layout.single-col {
    display: flex;
    justify-content: center;
    margin: 0 auto !important;
    max-width: 1200px;
    width: 100%;
}

.tool-layout.single-col > div {
    width: 100%;
}

/* Editor container overrides single-col to go full-width */
.tool-layout.single-col > #editor-container {
    width: 100%;
    max-width: 100%;
}

/* ── Progress bar shimmer ── */
#load-progress {
    background: linear-gradient(90deg, var(--primary), #818cf8) !important;
    position: relative;
    overflow: hidden;
    border-radius: 100px;
}

#load-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.6) 50%,
            rgba(255, 255, 255, 0) 100%);
    animation: shimmer-swipe 1.5s infinite linear;
}

@keyframes shimmer-swipe {
    0% {
        transform: translateX(-150%);
    }

    100% {
        transform: translateX(50%);
    }
}

/* ── Dropzone ── */
.p2w-dropzone {
    border: 2px dashed var(--glass-border);
    border-radius: 20px;
    padding: 56px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: rgba(255, 255, 255, 0.02);
}

.p2w-dropzone:hover,
.p2w-dropzone.drag-over {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--red);
    transform: translateY(-2px);
}

.drop-icon {
    font-size: 64px;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.3));
}

.p2w-dropzone h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'Outfit', sans-serif;
}

.p2w-dropzone p {
    color: var(--text-2);
    margin-bottom: 24px;
}

.privacy-badge {
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-3);
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: inline-block;
}

/* ── Editor Grid ── */
.esign-editor-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

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

/* ── Document Viewer (Left) ── */
.doc-viewer-column {
    min-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 20px;
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.viewer-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    margin: 0;
}

.viewer-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
}

#page-indicator {
    font-size: 12px;
    color: var(--text-2);
    min-width: 80px;
    text-align: center;
}

/* ── Canvas Area ── */
.doc-canvas-area {
    position: relative;
    flex: 1;
    overflow: auto;
    background: var(--bg-body);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 400px;
    padding: 16px;
}

.canvas-wrapper {
    position: relative;
    display: inline-block;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    border-radius: 2px;
    background: white;
}

#doc-canvas {
    display: block;
    max-width: 100%;
}

#sig-overlay-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* children will override */
}

.drop-hint {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--text-3);
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.3s;
}

.drop-hint.hidden {
    opacity: 0;
}

.viewer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

/* ── Signature Overlays (draggable) ── */
.sig-overlay {
    position: absolute;
    cursor: move;
    pointer-events: all;
    border: 1.5px dashed rgba(99, 102, 241, 0.7);
    border-radius: 4px;
    box-sizing: border-box;
    user-select: none;
    transition: border-color 0.15s;
}

.sig-overlay:hover {
    border-color: var(--primary);
}

.sig-overlay img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.sig-overlay .delete-sig-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    line-height: 1;
}

.sig-overlay:hover .delete-sig-btn {
    display: flex;
}

.sig-overlay .resize-handle {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: se-resize;
    display: none;
}

.sig-overlay:hover .resize-handle {
    display: block;
}

/* ── Signature Creator (Right) ── */
.sig-creator-column {
    padding: 20px;
}

/* Tabs */
.sig-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--glass-border);
    position: relative;
    z-index: 1;
}

.sig-tab-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    background: linear-gradient(135deg, #f97316, #fb923c);
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 0;
    pointer-events: none;
}

.sig-tab {
    flex: 1;
    padding: 10px 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: transparent !important;
    color: var(--text-2);
    border-radius: 7px;
    transition: color 0.2s ease;
    font-family: 'Outfit', sans-serif;
    position: relative;
    z-index: 2;
}

.sig-tab.active {
    color: #ffffff !important;
}

body.light .sig-tab.active {
    color: #ffffff !important;
}

body.light .sig-tabs {
    background: rgba(0, 0, 0, 0.04);
}



.tab-hint {
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 10px;
}

/* Canvas Frame */
.canvas-frame {
    position: relative;
    border: 1.5px solid var(--glass-border);
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.canvas-frame:focus-within,
.canvas-frame:active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.canvas-frame canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

#tab-draw .canvas-frame canvas {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='4' cy='16' r='2' fill='%236366f1'/%3E%3Cline x1='4' y1='16' x2='16' y2='4' stroke='%236366f1' stroke-width='2'/%3E%3C/svg%3E") 4 16, crosshair;
    touch-action: none; /* critical for pointer events on mobile */
}

/* Subtle guide line inside the signature box */
.canvas-frame::after {
    content: '';
    position: absolute;
    bottom: 28%;
    left: 8%;
    right: 8%;
    height: 1px;
    background: rgba(0,0,0,0.07);
    pointer-events: none;
    border-radius: 2px;
}

/* Draw canvas placeholder text */
.sig-canvas-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.18);
    pointer-events: none;
    font-style: italic;
    letter-spacing: 2px;
    transition: opacity 0.3s;
    font-family: 'Caveat', cursive;
}

/* Pen-active state: canvas glows to signal drawing is live */
#sig-canvas.pen-active {
    cursor: none !important; /* hide default cursor while drawing */
    outline: none;
}
#tab-draw .canvas-frame:has(#sig-canvas.pen-active) {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.25), 0 0 20px rgba(99,102,241,0.15);
}

/* Hint text below canvas */
.draw-mode-hint {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 6px;
    text-align: center;
    transition: color 0.2s;
    min-height: 16px;
    letter-spacing: 0.3px;
}
.draw-mode-hint.active {
    color: #6366f1;
    font-weight: 600;
}

/* Draw Controls */
.sig-draw-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* Upload drop area */
.upload-drop-area {
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-2);
    transition: all 0.2s ease;
}

.upload-drop-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

/* Icon Button */
.icon-btn {
    background: var(--bg-body);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-1);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Figtree', sans-serif;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Color Swatch */
.color-swatch {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 2px solid var(--glass-border);
    cursor: pointer;
    background: none;
    padding: 3px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    vertical-align: middle;
}

.color-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-swatch::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 10px rgba(99, 102, 241, 0.2);
}

.color-swatch:active {
    transform: scale(0.95);
}

/* Custom range */
.custom-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: 3px solid var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    transition: all 0.15s ease;
}

.custom-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.8);
}

/* Setting Group */
.setting-group {
    margin-bottom: 16px;
}

.setting-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-3);
    margin-bottom: 8px;
}

/* Success stats */
.stat-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-val {
    font-size: 22px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-3);
}

/* Export button green */
.rb-btn-success {
    background: linear-gradient(135deg, #059669, #10b981) !important;
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.rb-btn-success:hover {
    background: linear-gradient(135deg, #047857, #059669) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4) !important;
}