/* Watermark Tool Layout */
.workspace {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    align-items: start;
    margin-bottom: 80px;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 1fr;
    }
}

/* Controls Panel */
.controls-panel {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    position: sticky;
    top: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}

.control-group label span {
    color: var(--text-muted);
    font-weight: 400;
}

.control-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    transition: all 0.2s;
}

.control-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16);
}

.range-slider {
    width: 100%;
    cursor: pointer;
    accent-color: var(--primary);
    margin-top: 5px;
}

/* Position Grid 3x3 */
.pos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 150px;
}

.pos-btn {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.pos-btn:hover {
    background: #e2e8f0;
}

.pos-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Preview Area */
.preview-area {
    display: flex;
    justify-content: center;
    background: #eef2f6;
    border-radius: var(--radius);
    padding: 40px;
    min-height: 500px;
    border: 1px dashed var(--border);
}

.pdf-sheet {
    width: 100%;
    max-width: 420px;
    /* Scaled A4ish */
    aspect-ratio: 210/297;
    background: white;
    box-shadow: var(--shadow-preview);
    position: relative;
    overflow: hidden;
    user-select: none;
    display: flex;
    flex-direction: column;
    padding: 30px;
    gap: 15px;
}

/* Dummy Content for visual realism */
.dummy-line {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    width: 100%;
}

.dummy-line.short {
    width: 60%;
}

.dummy-line.med {
    width: 80%;
}

.dummy-block {
    height: 100px;
    background: #f8fafc;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Watermark Layer */
.watermark-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    /* Let clicks pass through if we had draggable logic, but we use grid */
    overflow: hidden;
    display: flex;
    /* We will change justify/align via JS based on grid */
    padding: 20px;
    /* Safe margin */
}

.watermark-text {
    white-space: nowrap;
    line-height: 1;
    transform-origin: center center;
    /* Styles (color, size, opacity, rotate) injected via JS */
}

/* Upload zone override when hidden */
.hidden {
    display: none !important;
}

body.theme-dark .controls-panel,
body.theme-dark .preview-area,
body.theme-dark .pdf-sheet {
    background: #0f172a;
    border-color: var(--border);
    color: var(--text-main);
}

body.theme-dark .control-group label,
body.theme-dark .control-group label span {
    color: var(--text-muted);
}

body.theme-dark .control-input {
    background: #0b1220;
    border-color: var(--border);
    color: var(--text-main);
}

body.theme-dark .pos-btn {
    background: #111827;
    border-color: var(--border);
}

body.theme-dark .pos-btn:hover {
    background: #1e293b;
}

body.theme-dark .dummy-line,
body.theme-dark .dummy-block {
    background: #111827;
}
