/* ==========================================================================
   PUDEN DOCS - PDF Signer Styles
   ========================================================================== */

/* Workspace Container */
.workspace {
    max-width: 1240px;
    width: 100%;
    margin: 1.5rem auto 4.5rem;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Glassmorphic Base Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
}

/* Dropzone */
.dropzone {
    border: 2px dashed rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-lg);
    padding: 3.5rem 2rem;
    text-align: center;
    background: rgba(17, 24, 39, 0.4);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    outline: none;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.dropzone-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.25rem;
    transition: transform 0.25s ease;
}

.dropzone:hover .dropzone-icon {
    transform: scale(1.1);
    color: #fff;
    border-color: var(--accent-primary);
}

.dropzone-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.dropzone-subtitle {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.dropzone-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-dim);
    flex-wrap: wrap;
}

.dropzone-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Signing Studio Layout */
.signer-stage {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .signer-stage {
        grid-template-columns: 1fr;
    }
}

/* Sidebar Controls */
.signer-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Sign Tabs */
.sign-tabs {
    display: flex;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
}

.sign-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 600;
    padding: 0.6rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.sign-tab-btn.active {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* Signature Box / Preview */
.sig-source-box {
    background: rgba(11, 15, 25, 0.6);
    border: 1px dashed var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    position: relative;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.sig-source-box.has-sig {
    border-style: solid;
    border-color: rgba(99, 102, 241, 0.3);
    background: #0f172a;
}

/* Checkerboard transparent background preview */
.transparent-checkered {
    background-image: 
        linear-gradient(45deg, #1e293b 25%, transparent 25%),
        linear-gradient(-45deg, #1e293b 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1e293b 75%),
        linear-gradient(-45deg, transparent 75%, #1e293b 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    background-color: #0b0f19;
}

.sig-preview-img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

/* Background Remover Controls */
.bg-remover-card {
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bg-remover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bg-remover-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bg-remover-title i {
    color: var(--accent-cyan);
}

.bg-toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
}

.bg-toggle-switch input[type="checkbox"] {
    accent-color: var(--accent-emerald);
    width: 16px;
    height: 16px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.slider-label span:last-child {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-cyan);
}

.range-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
}

/* Ink Color Options */
.ink-color-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ink-color-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.ink-color-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.ink-color-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
    color: #fff;
}

.ink-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.btn-add-sig-to-pdf {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, #6366f1 0%, #38bdf8 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
}

.btn-add-sig-to-pdf:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-add-sig-to-pdf:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* PDF Viewport & Canvas Stage */
.pdf-viewer-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pager-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-pager {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-pager:hover:not(:disabled) {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-pager:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pager-indicator {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    padding: 0 0.4rem;
}

.zoom-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-finish-pdf {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.4rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    transition: all 0.25s ease;
}

.btn-finish-pdf:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
    filter: brightness(1.08);
}

.btn-finish-pdf:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* PDF Canvas Wrapper */
.pdf-viewport-wrapper {
    background: #090d16;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
    min-height: 600px;
    position: relative;
}

.pdf-canvas-container {
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
    border-radius: 4px;
    background: #ffffff;
    display: inline-block;
    user-select: none;
}

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

/* Draggable & Resizable Signature Overlay Element */
.sig-draggable-element {
    position: absolute;
    cursor: move;
    border: 1.5px dashed var(--accent-cyan);
    border-radius: 4px;
    background: rgba(6, 182, 212, 0.05);
    touch-action: none;
    user-select: none;
    z-index: 50;
    transition: border-color 0.15s;
}

.sig-draggable-element:hover, .sig-draggable-element.selected {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
}

.sig-draggable-element img {
    width: 100%;
    height: 100%;
    pointer-events: none;
    object-fit: contain;
}

/* Resize Handles */
.sig-resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #38bdf8;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    bottom: -7px;
    right: -7px;
    cursor: se-resize;
    z-index: 60;
}

/* Action controls above the active signature */
.sig-action-toolbar {
    position: absolute;
    top: -38px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    padding: 3px 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    z-index: 70;
}

.btn-sig-action {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-sig-action:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.btn-sig-action.btn-del:hover {
    color: #fb7185;
    background: rgba(244, 63, 94, 0.2);
}

/* Draw Signature Pad Modal */
.draw-pad-container {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    background: #fff;
    position: relative;
    cursor: crosshair;
    touch-action: none;
}

#drawCanvas {
    display: block;
    width: 100%;
    height: 200px;
    border-radius: var(--radius-md);
}

.draw-pad-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.btn-draw-clear {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-dim);
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.btn-draw-clear:hover {
    color: #fb7185;
    border-color: rgba(244, 63, 94, 0.3);
}

.btn-draw-save {
    background: var(--accent-primary);
    border: none;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.btn-draw-save:hover {
    filter: brightness(1.1);
}
