/* Basic Setup */
:root {
    --color-light: #F2F2F2;
    /* 背景色: オフホワイト */
    --color-grey: #AFAFAF;
    /* サブテキスト: グレー */
    --color-sage: #9AB492;
    /* アクセント: セージグリーン */
    --color-dark-green: #4A5F40;
    /* メイン文字/ボタン: ディープモス */
    --color-gold: #C2A86C;
    /* 強調/バッジ: ゴールド */
    --font-display: 'Poppins', sans-serif;
    /* タイトル用 */
    --font-body: 'Open Sans', sans-serif;
    /* 本文用 */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: #555;
    color: var(--color-dark-green);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    padding: 20px;
}

/* A4 Paper Container */
.page-container {
    background-color: var(--color-light);
    width: 210mm;
    /* A4 Width */
    min-height: 297mm;
    /* A4 Height */
    padding: 15mm 20mm;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    position: relative;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--color-sage);
    padding-bottom: 15px;
}

.main-title {
    font-size: 20px;
    font-family: var(--font-display);
    letter-spacing: 0.1em;
    margin-bottom: 5px;
    color: var(--color-grey);
}

.subtitle {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.provider-name {
    font-size: 28px;
    font-family: var(--font-display);
    color: var(--color-dark-green);
    line-height: 1.2;
    margin-top: 5px;
}

.provider-name-jp {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-dark-green);
}

/* Intro Text Only */
.intro-text-only {
    text-align: center;
    margin-bottom: 25px;
    font-size: 14px;
    line-height: 1.8;
}

/* Rates Grid Layout */
/* Rates Grid Layout */
.rates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    grid-template-areas:
        "hours   image"
        "spot regular";
}

/* 1. Business Hours (Top Left) */
/* 1. Business Hours (Top Left) */
.business-hours {
    grid-area: hours;
    text-align: center;
    background-color: #fff;
    border: 2px solid var(--color-sage);
    color: var(--color-dark-green);
    padding: 45px 10px;
    /* Top/Bottom 45px padding */
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hours-note {
    margin-top: 10px;
    padding-top: 5px;
    border-top: 1px dashed var(--color-sage);
    font-size: 11px;
    color: #555;
    text-align: center;
}

.hours-note p {
    margin: 0;
}

/* 2. Profile Image (Top Right) */
.top-image-box {
    grid-area: image;
    position: relative;
    /* Setup for absolute child */
    width: 100%;
    /* No height set, it will stretch to grid row height defined by business-hours */
}

.top-grid-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 100% 35%;
    /* Show right side */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ... (skip other styles) ... */

.contact-info-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: flex-start;
    padding: 0 60px;
    /* Added padding */
}

/* 4. Regular Plan (Bottom Left) */
.rates-grid>.rate-card:nth-child(3) {
    grid-area: regular;
    background-color: #fff;
    border: 2px solid var(--color-sage);
    box-shadow: 0 4px 12px rgba(154, 180, 146, 0.3);
}

.rates-grid>.rate-card:nth-child(3) .card-title {
    color: var(--color-sage);
    border-bottom: 1px solid var(--color-sage);
    font-weight: bold;
}

/* 5. Spot Plan (Bottom Right) */
.rates-grid>.rate-card:nth-child(4) {
    grid-area: spot;
    background-color: #fff;
    border: 2px solid var(--color-gold);
    box-shadow: 0 4px 12px rgba(194, 168, 108, 0.3);
}

.rates-grid>.rate-card:nth-child(4) .card-title {
    color: var(--color-gold);
    border-bottom: 1px solid var(--color-gold);
    font-weight: bold;
}

/* General Rate Card Style */
/* General Rate Card Style */
.rate-card {
    background-color: #fff;
    border: 1px solid var(--color-grey);
    border-radius: 8px;
    padding: 25px 10px;
    text-align: center;
    width: 100%;
    /* box-shadow removed for cleaner print */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.rate-card.highlight {
    background-color: #fff;
    border-color: var(--color-gold);
}

/* Card Inner Styles */
.card-title {
    font-size: 16px;
    font-family: var(--font-display);
    margin-bottom: 5px;
    color: var(--color-dark-green);
    border-bottom: 1px dashed var(--color-grey);
    padding-bottom: 5px;
}

.card-price {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-dark-green);
    margin-bottom: 5px;
}

.card-details {
    font-size: 12px;
    color: #666;
}

.highlight-text {
    font-weight: bold;
    color: #555;
    /* background: #eee; removed to avoid gray box */
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

/* Sections */
.section {
    margin-bottom: 40px;
    /* Increased separation */
}

.section-title {
    font-size: 18px;
    font-family: var(--font-display);
    border-left: 5px solid var(--color-sage);
    padding-left: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.section-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    object-position: center center;
    border-radius: 6px;
    opacity: 0.95;
}

.footer-img {
    height: 100px;
    opacity: 0.8;
}

/* Option Prices */
/* Card Inner Styles */
.card-title {
    font-size: 16px;
    margin-bottom: 5px;
    color: var(--text-color);
    border-bottom: 1px dashed var(--light-gray);
    padding-bottom: 5px;
}

.card-price {
    font-size: 22px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.card-details {
    font-size: 12px;
    color: #666;
}

.highlight-text {
    font-weight: bold;
    color: #555;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

/* Sections */
.section {
    margin-bottom: 40px;
    /* Duplicate updated */
}

.section-title {
    font-size: 18px;
    border-left: 5px solid var(--accent-color);
    padding-left: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.section-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    object-position: center center;
    border-radius: 6px;
    opacity: 0.95;
}

.footer-img {
    height: 100px;
    opacity: 0.8;
}

/* Option Prices */
.option-price {
    font-weight: normal;
    color: var(--color-dark-green);
}

.small-note {
    font-size: 11px;
    color: #666;
}

.image-wrapper-center {
    text-align: center;
    margin: 20px 0;
}

.image-wrapper-center {
    text-align: center;
    margin: 20px 0;
}

/* Table */
.simple-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.simple-table th,
.simple-table td {
    border-bottom: 1px solid var(--color-grey);
    padding: 8px;
    text-align: left;
}

.simple-table th {
    width: 40%;
    color: var(--color-dark-green);
    font-weight: 500;
}

.policy-table td.free {
    color: var(--color-dark-green);
    font-weight: bold;
}

.policy-subtext {
    font-size: 11px;
    color: #666;
    margin-top: 5px;
}

/* Policy Text */
.policy-text {
    font-size: 13px;
    margin-bottom: 5px;
}

/* Info Grid (Old) */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* New 2x2 Mixed Grid */
.grid-2x2-mixed {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.grid-box {
    border-radius: 8px;
    overflow: hidden;
    height: 180px;
    /* Fixed height for uniformity */
}

.text-box {
    background-color: #F8F8F8;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Aligned to top */
}

.text-box h3 {
    font-size: 15px;
    margin-bottom: 8px;
    color: #555;
    border-bottom: 2px solid var(--color-gold);
    padding-bottom: 4px;
    display: inline-block;
}

.text-box p {
    font-size: 13px;
    line-height: 1.5;
}

.payment-info-compact p {
    margin-bottom: 4px;
    font-size: 12px;
}

.image-box {
    background-color: #eee;
}

.box-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.reading-img {
    object-position: center 37%;
}

/* Footer & Contact */
.footer {
    margin-top: 20px;
    padding-top: 15px;
    padding-bottom: 30px;
    /* Added bottom padding */
    border-top: 2px solid var(--color-grey);
}

.contact-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 15px;
}

.contact-title {
    font-size: 16px;
    margin-bottom: 30px;
    /* Increased margin */
    color: var(--color-dark-green);
    font-family: var(--font-display);
}

.contact-info-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: flex-start;
    padding: 0 60px;
    /* Added padding */
}

.contact-text {
    flex: 1;
}

.contact-item {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.contact-item .label {
    font-weight: bold;
    width: 50px;
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
}

.contact-item .value {
    font-size: 15px;
    font-weight: 500;
}

/* QR Code Area */
.qr-area {
    display: flex;
    gap: 40px;
}

.qr-box {
    text-align: center;
}

.qr-placeholder {
    width: 40px;
    height: 40px;
    background-color: #EEE;
    border: 2px dashed #CCC;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #999;
    border-radius: 6px;
    margin: 0 auto 3px;
}

.qr-label {
    font-size: 11px;
    color: #666;
    font-weight: bold;
    text-decoration: none;
    /* Remove underline for links */
    display: inline-block;
}

.qr-image-final {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
    margin: 0 auto 3px;
    border-radius: 4px;
}

/* Print Specifics */
@media print {
    body {
        background-color: white;
        padding: 0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .page-container {
        width: 100%;
        height: auto;
        min-height: 0;
        box-shadow: none;
        margin: 0;
        padding: 8mm 15mm;
        /* 余白を詰める */
        page-break-after: avoid;
    }

    /* --- Spacing Reductions for Single Page --- */
    .header {
        margin-bottom: 10px;
        padding-bottom: 5px;
    }

    .provider-name {
        font-size: 22px;
        margin-top: 0;
    }

    .main-title {
        font-size: 18px;
        margin-bottom: 0;
    }

    .subtitle {
        margin-bottom: 5px;
    }

    .intro-text-only {
        margin-bottom: 15px;
        font-size: 11px;
        line-height: 1.4;
    }

    .section {
        margin-bottom: 15px;
        /* 大幅に削減 40px -> 15px */
        page-break-inside: avoid;
    }

    .section-title {
        font-size: 15px;
        margin-bottom: 5px;
        border-color: var(--color-sage) !important;
    }

    /* Grid Compact */
    .rates-grid {
        gap: 8px;
        margin-bottom: 10px;
    }

    .business-hours {
        padding: 15px 5px;
    }

    .rate-card {
        padding: 10px 5px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card-price {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .highlight-text {
        font-size: 11px;
    }

    /* Options Table */
    .simple-table th,
    .simple-table td {
        padding: 4px 5px;
        font-size: 11px;
    }

    .option-price {
        font-size: 12px;
    }

    /* Info Grid */
    .grid-2x2-mixed {
        gap: 8px;
    }

    .grid-box {
        height: 120px;
        /* 高さ削減 180px -> 120px */
    }

    .text-box {
        padding: 8px;
    }

    .text-box h3 {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .text-box p {
        font-size: 11px;
        line-height: 1.3;
    }

    .payment-info-compact p {
        margin-bottom: 2px;
    }

    /* Policy */
    .policy-text {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .policy-subtext {
        margin-top: 2px;
        font-size: 10px;
    }

    /* Footer */
    .footer {
        margin-top: 10px;
        padding-top: 5px;
        padding-bottom: 0;
        border-top: 1px solid var(--color-grey);
    }

    .contact-title {
        margin-bottom: 10px;
        font-size: 14px;
    }

    .contact-info-row {
        padding: 0 40px;
    }

    .contact-item .label {
        font-size: 10px;
    }

    .contact-item .value {
        font-size: 13px;
    }

    .qr-area {
        gap: 20px;
    }

    .qr-image-final {
        width: 32px;
        height: 32px;
    }

    .qr-label {
        font-size: 9px;
    }

    .page-break {
        page-break-before: avoid;
        margin-top: 0;
    }
}

/* Responsive Styles for Mobile */
@media screen and (max-width: 820px) {
    body {
        padding: 10px;
    }

    .page-container {
        width: 100%;
        max-width: 100%;
        padding: 20px 15px;
        min-height: auto;
    }

    .header {
        margin-bottom: 20px;
    }

    .provider-name {
        font-size: 24px;
    }

    /* Stack Rates Grid */
    .rates-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "image"
            "hours"
            "spot"
            "regular";
        gap: 20px;
    }

    /* Adjust Image Box for stacking */
    .top-image-box {
        height: 250px;
        /* Give height since it's no longer expanding with neighbor */
        margin-bottom: 10px;
    }

    .top-grid-img {
        object-position: center 35%;
        /* Adjust focus */
    }

    .business-hours {
        padding: 30px 15px;
    }

    /* Stack Info Grid */
    .grid-2x2-mixed {
        grid-template-columns: 1fr;
    }

    .grid-box {
        height: auto;
        min-height: 200px;
        /* Ensure images have height */
    }

    .text-box {
        min-height: auto;
        /* Let text expand naturally */
    }

    /* Adjust Contact Section */
    .contact-info-row {
        flex-direction: column;
        padding: 0 10px;
        gap: 30px;
    }

    .contact-text {
        width: 100%;
        margin-bottom: 10px;
    }

    .qr-area {
        width: 100%;
        justify-content: center;
        gap: 25px;
    }

    /* Adjust table for small screens if needed */
    .simple-table th,
    .simple-table td {
        display: block;
        width: 100%;
    }

    .simple-table th {
        background-color: #f9f9f9;
        border-bottom: none;
        padding-bottom: 2px;
    }

    .simple-table td {
        padding-top: 2px;
        border-bottom: 1px solid var(--color-grey);
    }

    .simple-table tr {
        margin-bottom: 10px;
        display: block;
    }

    /* Better Mobile Policy Table (Card Style) */
    .policy-table {
        border-spacing: 0;
        border-collapse: separate;
        /* Allow border-radius */
    }

    .policy-table th,
    .policy-table td {
        display: block;
        width: 100%;
    }

    .policy-table tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
        /* Subtle shadow for depth */
    }

    .policy-table th {
        background-color: #f4f7f3;
        /* Very light sage tint to match theme */
        color: var(--color-dark-green);
        padding: 12px 15px;
        font-size: 14px;
        text-align: left;
        border-bottom: 1px solid #eee;
        font-weight: bold;
    }

    .policy-table td {
        padding: 15px;
        background-color: #fff;
        text-align: right;
        /* Values right aligned */
        border-bottom: none;
        font-size: 15px;
    }

    .policy-table td.free {
        font-weight: bold;
        color: var(--color-dark-green);
        font-size: 16px;
    }
}