/*
================================================
Print-O-Matic用 印刷/PDF出力スタイルシート（調整版）
================================================
*/

/* すべての印刷専用スタイルを @media print ブロック内に記述 */
@media print {
    
    /* ページの基本設定 
    ------------------------------------------------ */
    /* ページの余白設定 (A4縦を想定) */
    @page {
        size: A4 portrait;
        margin: 2cm 1.5cm; /* 上下2cm、左右1.5cmなど、適切な余白を設定 */
    }

    /* 1. フォントの基本設定 (印刷時のみ適用)
    ------------------------------------------------ */
    body, div, section, span, th, td, p {
        /* 日本語フォントを優先し、確実に黒字で印刷 */
        font-family: "Yu Gothic Medium", "游ゴシック Medium", YuGothic, "游ゴシック体", "ヒラギノ角ゴ Pro W3", "メイリオ", sans-serif !important;
        font-size: 14px;
        color: #000 !important; 
    }
    /* 印刷時に背景色や画像を含める設定（ブラウザ依存） */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* 2. 印刷時の改ページ設定
    ------------------------------------------------ */
    
    /* 各書類（<section class="document">）が始まる前に必ず改ページ */
    .document {
        page-break-before: always;
    }
    /* 最初の書類の前では改ページしない */
    .document:first-of-type { 
        page-break-before: avoid;
    }
    
    /* 書類内（class="docPage"が続く場合）での改ページ */
    .docPage + .docPage {
        page-break-before: always;
    }
    
    /* HTMLで指定されている改ページを確実に適用 */
    .pageBreakBefore {
        page-break-before: always !important;
    }

    /* テーブルや記事などの要素内での途中の改ページを防ぐ */
    table, article, tr {
        page-break-inside: avoid;
    }

    /* 印刷対象外要素の非表示 (HTMLにある .noPrint や Print-O-Maticのデフォルト設定) */
    .noPrint {
        display: none !important;
    }

    /* 3. 全帳票共通のスタイル
    ------------------------------------------------ */
    .docTitle {
        text-align: center;
        font-size: 28px;
        margin-top: 1em;
        margin-bottom: 1em;
    }
    table {
        margin: 0;
        border-collapse: collapse;
        width: 100%;
    }
    table tr {
        border: none;
    }
    th, td {
        padding: 0 1em;
        line-height: 1.4em;
        vertical-align: top;
        text-align: left;
        font-weight: normal;
    }


    /* 4. 各帳票固有のスタイル
    ------------------------------------------------ */

    /* 4-1. 登記申請書 (docRegApp) */
    table.tableRegApp tr > th:first-child {
        width: 12em;
    }
    table.tableRegApp .applicationDate {
        padding-top: 1em;
        padding-bottom: 2em;
    }
    table.tableRegApp .applicationDate div {
        display: inline-block;
    }
    table.tableRegApp .applicationDate div span.writeArea {
        display: inline-block;
        width: 3em;
    }
    table.tableRegApp .step6Relationship td {
        height: 5em;
    }
    table.tableRegApp .step6Relationship td span.stamp {
        padding-left: 15em;
    }
    .tableRealestate th {
        width: 12em;
    }
    section.docRegApp {
        padding-top: 20vh; /* 印刷時のページ位置調整 */
    }
    section.docRegApp .heirList {
        display: inline-block;
        padding-left: 2em;
    }
    section.docRegApp .docPage-subsequent .tableRegAppRealestateWrapper-subsequent {
        min-height: 20vh;
    }
    section.docRegApp table.tableRealestate_siteRight {
        width: 33.333333%;
        float: left;
    }
    section.docRegApp table.tableRealestate_siteRight th,
    section.docRegApp table.tableRealestate_siteRight td {
        width: auto;
        white-space: nowrap !important;
    }


    /* 4-2. 遺産分割協議書 (docConsultation) */
    .docConsultation .date {
        text-align: right;
    }
    .docConsultation .heirLists {
        text-align: right;
    }
    .docConsultation .heirList {
        padding: 0.5em 0;
    }
    .docConsultation .heirList .data .title {
        font-size: 1.2em;
        padding-right: 25%;
    }
    .docConsultation .heirList .data .name {
        font-size: 0.8em;
        padding-right: 25%;
    }
    .docConsultation .realEstateHeir .name,
    .docConsultation .heirNames .name {
        display: inline-block;
    }
    .docConsultation .listHeir {
        min-height: 20vh;
    }
    .docConsultation table.tableRealestate_siteRight {
        width: 33.333333%;
        float: left;
    }
    .docConsultation table.tableRealestate_siteRight th,
    .docConsultation table.tableRealestate_siteRight td {
        width: auto;
        white-space: nowrap;
    }


    /* 4-3. 委任状 (docProxy) */
    .docProxy .note,
    .docProxy .zokunin {
        padding-left: 1em;
    }
    .docProxy .delegationList {
        padding-left: 2em;
    }
    .docProxy .signature {
        padding: 2em 4em;
    }
    .docProxy .signature table.tableDelegator .text-node {
        display: inline-block;
        min-height: 3em;
    }
    .docProxy .delegatorWrapper > div {
        display: inline-block;
    }
    .docProxy .delegatorWrapper .left {
        padding-right: 1em;
    }
    .docProxy .delegatorWrapper .center {
        padding-right: 4em;
    }
    .docProxy .delegatorWrapper .right {
        font-size: 0.8em;
    }
    .docProxy .recordTitle {
        text-align: center;
        font-size: 1.1em;
        padding: 2em 0 4em;
    }
    .docProxy .tableRealestateWrapper {
        min-height: 20vh;
    }
    .docProxy table.tableRealestate_siteRight {
        width: 33.333333%;
        float: left;
    }
    .docProxy table.tableRealestate_siteRight th,
    .docProxy table.tableRealestate_siteRight td {
        width: auto;
        white-space: nowrap !important;
    }


    /* 4-4. 収入印紙貼付台紙 (docCover) */
    .docCover h1.docCoverTitle {
        padding-top: 20%;
        padding-left: 10%;
    }
    .docCover .tableWrapper {
        display: flex !important;
        justify-content: center !important;
        padding-top: 10%;
    }
    .docCover table.inshi {
        width: auto;
    }
    .docCover table.inshi td {
        border: dashed 1px #555;
        padding: 2em 4em;
        text-align: center;
    }
    .docCover table.inshi tr:first-child td {
        border-bottom: none;
    }


    /* 4-5. 原本還付表紙 (docMount) */
    .docMount .wrapper {
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-around !important;
        height: 100vh;
    }
    .docMount table.kanpu {
        width: auto !important;
    }
    .docMount table.kanpu td {
        border: solid 1px #ff0000;
        padding: 0.5em 1em;
    }
    .docMount table.kanpu td h1.docTiele.docMountTitle {
        font-size: 3em;
        color: #ff0000;
        font-weight: bold;
    }
    .docMount table.kanpu td:last-child {
        border-left: none;
        width: 5em;
    }
    .docMount .wrapper div:last-child {
        text-align: right;
    }
    .docMount .wrapper div:last-child p {
        margin-top: 2em;
    }
    .docMount .wrapper div:last-child p span {
        border-bottom: solid 1px #555;
        padding-bottom: 4px;
    }
} /* @media print の閉じタグ */