/* Visual Watermark PDF Specific UI */

.hidden { display: none !important; }

.wp-workspace {
    max-width: 1000px !important;
    padding: 0 !important;
    overflow: hidden;
}

.wp-upload-screen {
    padding: 40px;
}

/* Editor Screen */
.wp-editor-screen {
    display: flex;
    flex-direction: column;
    height: 80vh;
    min-height: 600px;
    background: var(--bg-card);
    border-radius: 20px;
}

/* Toolbar */
.wp-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.wp-nav-cluster {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    padding: 5px;
    border-radius: 12px;
}

.wp-nav-btn {
    width: 36px; height: 36px;
    border: none; background: var(--bg-card); border-radius: 8px;
    cursor: pointer; color: var(--text-main); transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.wp-nav-btn:hover { background: var(--primary); color: white; }

.wp-page-indicator {
    font-weight: 700; color: var(--text-main); min-width: 60px; text-align: center;
}

.wp-toolbar-tools {
    display: flex; gap: 10px;
}

.wp-tool-btn {
    background: rgba(37, 99, 235, 0.1); color: var(--primary);
    border: 1px solid rgba(37, 99, 235, 0.2); padding: 8px 15px;
    border-radius: 10px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 8px; font-size: 0.95rem; transition: 0.2s;
}
.wp-tool-btn:hover { background: var(--primary); color: white; }
.wp-file-label { margin: 0; }

/* Canvas Area */
.wp-canvas-container {
    flex: 1;
    background: #cbd5e1; 
    padding: 30px;
    overflow: auto;
    display: flex;
    justify-content: center;
    touch-action: pan-y;
}
[data-theme="dark"] .wp-canvas-container { background: #0f172a; }

.wp-canvas-wrapper {
    position: relative;
    background: white;
    line-height: 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

#pdfCanvas { display: block; max-width: 100%; height: auto; }
.wp-watermark-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }

/* Draggable Watermark Elements */
.wp-element {
    position: absolute;
    border: 2px dashed transparent;
    cursor: grab; user-select: none; touch-action: none;
    pointer-events: auto;
}
.wp-element.active {
    border: 2px solid var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.wp-text-node {
    white-space: nowrap; font-family: Helvetica, Arial, sans-serif;
    font-weight: bold; pointer-events: none;
}

.wp-element img {
    width: 100%; height: 100%; display: block; pointer-events: none;
}

/* Handles & Action Buttons */
.wp-resize-handle {
    width: 20px; height: 20px; background: var(--primary);
    border: 2px solid #fff; border-radius: 50%;
    position: absolute; bottom: -10px; right: -10px;
    cursor: nwse-resize; display: none; z-index: 10;
}

.wp-rotate-handle {
    width: 24px; height: 24px; background: #fff;
    border: 1px solid var(--border); border-radius: 50%;
    position: absolute; top: -38px; left: 50%; transform: translateX(-50%);
    cursor: grab; display: none; align-items: center; justify-content: center;
    color: var(--primary); box-shadow: 0 2px 5px rgba(0,0,0,0.2); z-index: 10;
}

.wp-rotate-stick {
    width: 2px; height: 26px; background: var(--primary);
    position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
    display: none;
}

.wp-delete-btn {
    position: absolute; top: -12px; right: -12px;
    width: 24px; height: 24px; background: #ef4444; color: #fff;
    border-radius: 50%; display: none; align-items: center; justify-content: center;
    cursor: pointer; font-size: 10px; border: 2px solid #fff; z-index: 11;
}

/* New Edit Button */
.wp-edit-btn {
    position: absolute; top: -12px; left: -12px;
    width: 24px; height: 24px; background: var(--primary); color: #fff;
    border-radius: 50%; display: none; align-items: center; justify-content: center;
    cursor: pointer; font-size: 10px; border: 2px solid #fff; z-index: 11;
}

.wp-element.active .wp-resize-handle,
.wp-element.active .wp-rotate-handle,
.wp-element.active .wp-delete-btn,
.wp-element.active .wp-edit-btn,
.wp-element.active .wp-rotate-stick { display: flex; }

/* Bottom Controls */
.wp-bottom-controls {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 20px 25px;
}

.wp-control-row {
    display: flex; gap: 30px; margin-bottom: 20px;
}

.wp-control-group {
    display: flex; flex-direction: column; gap: 8px; flex: 1; max-width: 250px;
}

.wp-control-group label {
    font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase;
}

.wp-slider { width: 100%; cursor: pointer; }

.wp-color-picker {
    width: 100%; height: 40px; padding: 2px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg-input); cursor: pointer;
}

.wp-action-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 15px; border-top: 1px dashed var(--border);
}

.wp-checkbox-label {
    font-size: 1rem; font-weight: 700; color: var(--text-main);
    display: flex; align-items: center; gap: 10px; cursor: pointer;
}

.wp-btn-success { background: var(--success) !important; padding: 12px 30px; }

/* Modals & Overlays */
.wp-modal-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 100;
    display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px);
}

.wp-modal-content {
    background: var(--bg-card); width: 90%; max-width: 400px;
    border-radius: 20px; padding: 30px; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    border: 1px solid var(--border);
}

.wp-modal-content h3 { font-size: 1.3rem; font-weight: 800; color: var(--text-main); margin-bottom: 5px; }

.wp-modal-actions { display: flex; gap: 15px; justify-content: flex-end; }

.wp-processing-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.9); z-index: 999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
}
[data-theme="dark"] .wp-processing-overlay { background: rgba(15,23,42,0.9); }

.wp-loader {
    width: 60px; height: 60px; border: 5px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite; margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile */
@media (max-width: 768px) {
    .wp-action-footer { flex-direction: column; gap: 20px; align-items: stretch; }
    .wp-checkbox-label { justify-content: center; }
    .wp-toolbar { flex-direction: column; gap: 15px; }
}
