/* ================================================
   領収書ジェネレーター — スクリーン用スタイル
   ================================================ */

/* ---------- 入力エリア ---------- */
.input-area {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 32px;
}

.form-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 700px) {
    .form-columns {
        grid-template-columns: 1fr;
    }
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #2c5f2e;
    border-bottom: 2px solid #2c5f2e;
    padding-bottom: 6px;
    margin-bottom: 16px;
}

.section-title i {
    margin-right: 6px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 4px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #2c5f2e;
    box-shadow: 0 0 0 2px rgba(44, 95, 46, 0.15);
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.required {
    display: inline-block;
    background: #c0392b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

/* 発行者保存ボタン */
.btn-save {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f5f5f5;
    border: 1px solid #ccc;
    color: #444;
    padding: 7px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.15s;
}

.btn-save:hover {
    background: #e8e8e8;
}

.btn-save.saved {
    background: #e8f5e9;
    border-color: #2c5f2e;
    color: #2c5f2e;
}

/* 宛名エリア */
.names-section {
    margin-bottom: 20px;
}

.hint {
    font-size: 0.82rem;
    color: #666;
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.hint i {
    color: #2196f3;
    margin-right: 4px;
}

#nameList {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.6;
}

#nameList:focus {
    outline: none;
    border-color: #2c5f2e;
    box-shadow: 0 0 0 2px rgba(44, 95, 46, 0.15);
}

.name-count {
    text-align: right;
    font-size: 0.82rem;
    color: #888;
    margin-top: 4px;
}

/* アクションボタン */
.action-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-generate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #2c5f2e;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-generate:hover {
    background: #1e4020;
}

.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1565c0;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-print:hover:not(:disabled) {
    background: #0d47a1;
}

.btn-print:disabled {
    background: #aaa;
    cursor: not-allowed;
}

/* ---------- プレビューエリア ---------- */
.receipts-area {
    margin-bottom: 32px;
}

.preview-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #bbb;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.preview-placeholder i {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

.preview-placeholder p {
    font-size: 0.95rem;
    line-height: 1.8;
}

/* ---------- 領収書ペア ---------- */
.receipt-pair {
    margin-bottom: 16px;
}

/* ---------- 領収書1枚 ---------- */
.receipt {
    background: #fff;
    border: 1px solid #999;
    padding: 28px 36px;
    max-width: 680px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.receipt-title {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5em;
    padding-bottom: 12px;
    border-bottom: 2px solid #222;
    margin: 0 0 24px 0;
    color: #111;
}

/* 宛名行 */
.recipient-line {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 22px;
    padding-bottom: 4px;
    border-bottom: 1px solid #333;
}

.recipient-name {
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
    letter-spacing: 0.05em;
    color: #111;
}

.recipient-sama {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    padding-bottom: 2px;
    color: #111;
}

/* 金額行 */
.amount-line {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: #f8f8f8;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.amount-label {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

.amount-box {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.amount-yen {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111;
}

.amount-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #111;
    border-bottom: 2px double #333;
    padding-bottom: 2px;
}

.amount-nari {
    font-size: 1rem;
    color: #333;
    font-weight: 600;
}

/* 但し書き */
.purpose-line {
    display: flex;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 28px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ddd;
}

.purpose-label {
    font-size: 0.95rem;
    color: #555;
    white-space: nowrap;
}

.purpose-value {
    font-size: 0.95rem;
    color: #222;
    flex: 1;
}

/* フッター（日付・発行者） */
.receipt-footer {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 20px;
}

.receipt-date-issuer {
    text-align: right;
}

.receipt-date {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 8px;
}

.issuer-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 4px;
}

.issuer-address,
.issuer-tel {
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 2px;
}

/* 収入印紙欄 */
.stamp-box {
    width: 60px;
    height: 60px;
    border: 1px solid #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #888;
    text-align: center;
    line-height: 1.4;
    flex-shrink: 0;
}

/* 切り取り線 */
.receipt-separator {
    max-width: 680px;
    margin: 0 auto;
    height: 0;
    border-top: 1.5px dashed #aaa;
    text-align: center;
    overflow: visible;
    position: relative;
}

.receipt-separator span {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #f5f5f5;
    padding: 0 10px;
    font-size: 0.72rem;
    color: #aaa;
    white-space: nowrap;
}


/* ================================================
   印刷用スタイル
   ================================================ */
@media print {

    /* 非表示にする要素 */
    .no-print,
    .class-mode-toggle,
    .ad-left,
    .ad-right,
    .ad-horizontal,
    header,
    footer {
        display: none !important;
    }

    /* ページ設定 */
    @page {
        size: A4 portrait;
        margin: 10mm 12mm;
    }

    html,
    body {
        margin: 0;
        padding: 0;
        background: #fff;
    }

    .site-wrapper,
    .container,
    main {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    .receipts-area {
        margin: 0;
    }

    /* 2枚1組でページ区切り */
    .receipt-pair {
        page-break-after: always;
        page-break-inside: avoid;
        height: 277mm;
        display: flex;
        flex-direction: column;
        margin: 0;
    }

    .receipt-pair:last-child {
        page-break-after: auto;
    }

    /* 各領収書はペアの半分 */
    .receipt {
        flex: 1;
        max-width: 100%;
        box-shadow: none;
        border: 1px solid #555;
        border-radius: 0;
        padding: 16mm 18mm;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        margin: 0;
        box-sizing: border-box;
        min-height: 0;
    }

    /* 切り取り線 */
    .receipt-separator {
        max-width: 100%;
        flex-shrink: 0;
        border-top: 1px dashed #999;
    }

    .receipt-separator span {
        background: #fff;
    }

    /* 印刷時の文字色を黒に統一 */
    .receipt-title,
    .recipient-name,
    .recipient-sama,
    .amount-label,
    .amount-yen,
    .amount-value,
    .amount-nari,
    .purpose-label,
    .purpose-value,
    .receipt-date,
    .issuer-name {
        color: #000 !important;
    }

    .issuer-address,
    .issuer-tel {
        color: #333 !important;
    }

    /* 金額ボックスは印刷時に背景なし */
    .amount-line {
        background: none;
        border: none;
        padding: 0;
    }

    .recipient-line {
        border-bottom: 1px solid #000;
    }

    .stamp-box {
        border: 1px solid #555;
        color: #333;
    }
}
