﻿/* nx-doc.css - Local theme override */

/* Layout: place control box to the right of the page content */
.fx-doc {
    --nx-primary-fg: black !important;
    --fx-doc-width: 210mm;
    --fx-doc-height: 297mm;
    --fx-doc-control-space: 4rem;
    --fx-doc-scale: min(1, calc((100cqw - var(--fx-doc-control-space) - (var(--nx-space) * 2)) / var(--fx-doc-width)));
    grid-column: -1/1;
    position: relative;
    container-type: inline-size;
    display: block;
    width: 100%;
    box-sizing: border-box;
    border-radius: var(--nx-border-radius);
    padding: var(--nx-space);
    padding-right: calc(var(--nx-space) + var(--fx-doc-control-space));
    background: var(--nx-primary-bg);
}

/* Control box sits beside the content (not absolutely positioned) */
.fx-doc-controlbox {
    position: absolute;
    top: var(--nx-space);
    right: var(--nx-space);
    z-index: 1;
}

/* Keep the existing page content size but allow it to shrink on small screens */
.fx-doc-content {
    width: var(--fx-doc-width);
    max-width: var(--fx-doc-width);
    height: var(--fx-doc-height);
    box-sizing: border-box;
    background: white;
    color: #000;
    border-radius: var(--nx-border-radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    overflow: hidden;
    position: relative;
    padding: 10mm 10mm;
    display: block;
    margin: 0 auto;
    transform-origin: top left;
    zoom: var(--fx-doc-scale);
}

/* Page container */
.fx-doc-pages {
    max-width: var(--fx-doc-width);
    display: flex;
    flex-direction: column;
    gap: var(--nx-space);
    padding: var(--nx-space);
}

/* Individual page */
.fx-doc-page {
    max-width: var(--fx-doc-width);
    background: white;
    border-radius: var(--nx-border-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

@media print {
    .fx-doc {
        max-width: 210mm;
        padding: 0;
        background: transparent;
        display: block;
        width: auto;
        container-type: normal;
    }

    .fx-doc-content {
        width: 210mm;
        max-width: 210mm;
        height: auto;
        min-height: 297mm;
        padding: 10mm 10mm;
        overflow: visible;
        box-shadow: none;
        border-radius: 0;
        zoom: 1 !important;
        transform: none !important;
        margin: 0;
    }

    .fx-doc-pages {
        max-width: 210mm;
        display: block;
        gap: 0;
        padding: 0;
    }

    .fx-doc-page {
        max-width: 210mm;
        box-shadow: none;
        margin: 0;
        border-radius: 0;
        break-after: page;
        page-break-after: always;
    }

    .fx-doc-measure {
        display: none;
    }

    .fx-doc-controlbox {
        display: none;
    }
}

/* Continuous document preview.
   The document keeps its A4 width and scales down horizontally,
   but its height grows with the content instead of being clipped. */
.fx-doc--continuous .fx-doc-content {
    height: auto;
    min-height: var(--fx-doc-height);
    overflow: visible;
}
