body {
    font-family: Arial, sans-serif;
}

#envelopesContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
    height: calc(297mm); /* A4高度 (橫向列印時實際高度) */
}

.envelope {
    width: calc(297mm / 2 - 20px);  /* 每個信封寬度為A4橫式的一半 */
    height: calc(210mm / 2 - 20px); /* 每個信封高度為A4橫式的一半 */
    border: 1px solid black;
    margin: 10px;
    padding: 20px;
    position: relative;
    box-sizing: border-box;
}

#sender {
    position: absolute;
    top: 10px;
    left: 10px;
}

#senderPhone {
    position: absolute;
    top: 40px;
    left: 10px;
}

#receiver {
    position: absolute;
    bottom: 60px;
    right: 10px;
    text-align: right;
}

#receiverPhone {
    position: absolute;
    bottom: 20px;
    right: 10px;
    text-align: right;
}

/* 列印樣式 */
@media print {
    body * {
        visibility: hidden;
    }
    #envelopesContainer, #envelopesContainer * {
        visibility: visible;
    }
    #envelopesContainer {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        page-break-inside: avoid;
    }
    .envelope {
        width: calc(297mm / 2 - 120px);  /* 每個信封寬度為A4橫式的一半 */
        height: calc(210mm / 2 - 120px); /* 每個信封高度為A4橫式的一半 */
        margin: 10px;
        page-break-inside: avoid;
    }
}
