@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght=400;600;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #0f172a;
    color: #f8fafc;
    min-height: 100vh;
    margin: 0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.workspace-container {
    position: relative;
    width: 100%;
    max-width: 1024px;
    aspect-ratio: 1 / 1.4142;
    user-select: none;
    touch-action: none;
}

.document-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 1024px;
    background-color: #1e293b;
    border: 1px solid #334155;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    user-select: none;
    touch-action: none;
}

.workspace-container .document-wrapper {
    position: absolute;
    inset: 0;
    max-width: 100%;
    overflow: hidden;
}

.document-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.svg-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: auto;
    user-select: none;
    touch-action: none;
}

.svg-overlay svg :is(rect, circle, path, ellipse, polygon) {
    pointer-events: all !important;
    cursor: pointer !important;
    transition: all 0.1s ease-in-out;
}

.svg-overlay svg :is(rect, circle, path, ellipse, polygon):hover {
    stroke: #ef4444 !important;
    stroke-width: 2.5px !important;
}

.selected-shape {
    fill: #000000 !important;
    fill-opacity: 1 !important;
    stroke: #000000 !important;
    stroke-width: 1.5px !important;
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(1) !important;
}

.selected-shape-red {
    fill: #ef4444 !important;
    fill-opacity: 0.85 !important;
    stroke: #b91c1c !important;
    stroke-width: 2px !important;
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(1) !important;
}

.align-handle {
    position: absolute;
    width: 36px;
    height: 36px;
    transform: translate(-50%, -50%);
    z-index: 50;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: none;
    transition: transform 0.15s;
}

.align-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.15);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ef4444;
    cursor: pointer;
}

:is(.custom-scroll, .scrollbar-custom)::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

:is(.custom-scroll, .scrollbar-custom)::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 4px;
}

:is(.custom-scroll, .scrollbar-custom)::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

:is(.custom-scroll, .scrollbar-custom)::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

@media print {
    @page { size: A4 portrait; margin: 0; }
    html, body { width: 100%; height: 100%; margin: 0 !important; padding: 0 !important; background: #fff !important; }
    body * { visibility: hidden; }
    :is(.workspace-container, .document-wrapper),
    :is(.workspace-container, .document-wrapper) * { visibility: visible; }
    :is(.workspace-container, .document-wrapper) {
        position: absolute; inset: 0; width: 100vw !important; height: 100% !important;
        border: none !important; box-shadow: none !important; margin: 0 !important; z-index: 100;
    }
    .document-wrapper img, .svg-overlay { width: 100% !important; height: 100% !important; }
    .svg-overlay svg :is(rect, circle, path, ellipse, polygon):not(.selected-shape):not(.selected-shape-red) { display: none !important; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}