/* ============================================================================
 * pdf_cart_mirai_eco.css
 * Styles the みらいエコ PDF page. Cart content is cloned into
 * #pdf-cart-mirai_eco .pdf_mirai_eco__cart → reuses the .mirai_eco styles from
 * cart_mirai_eco.css (already injected into the print iframe). This file only adds:
 *   - changes the logo header title when the PDF is mirai_eco
 *   - シミュレーション結果 band (green, per the capture)
 *   - 2 images 省エネ / 健康
 * Scoped under #pdf-cart-mirai_eco / #printPdf.pdf_mirai_eco → does NOT affect PDF door/water.
 * ========================================================================== */

/* --- Logo header title: mirai_eco PDF uses "みらいエコ…", other options keep the default --- */
.logo-inner-txt--mirai_eco {
  display: none;
}
#printPdf.pdf_mirai_eco .logo-inner-txt--default {
  display: none;
}
#printPdf.pdf_mirai_eco .logo-inner-txt--mirai_eco {
  display: block;
}

/* --- シミュレーション結果 band (green — adjust hex if needed) --- */
#pdf-cart-mirai_eco .pdf_result_header {
  width: 100%;
  box-sizing: border-box;
}

#pdf-cart-mirai_eco .pdf_result_header__band {
  width: 100%;
  background: #CEED82;
  color: #ffffff;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  padding: 6px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}

/* --- cloned cart block: remove #cart_mirai_eco max-width, full width in the PDF body --- */
#pdf-cart-mirai_eco .pdf_mirai_eco {
  padding: 6px 22px;
}

#pdf-cart-mirai_eco .pdf_mirai_eco__cart .mirai_eco {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

/* ----------------------------------------------------------------------------
 * Override the cloned cart content in the PDF (mirai_eco PDF ONLY, does not affect screen).
 * The selector includes #pdf-cart-mirai_eco so its specificity is higher than the .mirai_eco …
 * rules in cart_mirai_eco.css → it overrides them. Fill in values in the rules below.
 * -------------------------------------------------------------------------- */
#pdf-cart-mirai_eco .mirai_eco .mirai_eco-head {
}

#pdf-cart-mirai_eco .mirai_eco .content {
  padding: 4px 16px 12px;
}

#pdf-cart-mirai_eco .mirai_eco .subsidy-detail .spec-row {
}

/* --- 引戸 (door_3.png — HORIZONTAL door) enlarged in the PDF OUTPUT ---
   The screen counterpart lives at the END of cart_mirai_eco.css (引戸 wide-door section) but is gated
   behind `@media screen`, so it styles the on-screen PDF preview only; the printed file fell back to the
   base 128×245 cover box → door_3 looked small/cropped. The print body is forced to 1024px (pdf_print.css)
   so mirror the desktop (≥1024) wide-door values here: image ~200px + 35px gap keeps the text column in the
   SAME place as the other doors (65 pad + 200 img + 35 gap = 65 + 140 + 95 base). Scoped to
   #pdf-cart-mirai_eco → PDF mirai_eco only, does not touch the screen or other options. */
@media print {
  #pdf-cart-mirai_eco .mirai_eco .plan-area .plan-row.plan-row--wide-door {
    gap: 35px;
  }

  #pdf-cart-mirai_eco .mirai_eco .plan-row.plan-row--wide-door .plan-photo {
    flex: 0 0 200px;
  }

  #pdf-cart-mirai_eco .mirai_eco .plan-row--wide-door .plan-photo img {
    width: 100%;   /* = 200px */
    height: auto;  /* horizontal door: keep the natural ratio, no crop */
  }
}

/* --- .door-type width in the PDF OUTPUT ---
   The narrowing (desktop 80% / tablet 86%) in cart_mirai_eco.css is gated behind `@media screen`, so the
   printed file fell back to the base width:100% → the green box stretched full-width, unlike the screen cart
   and the PDF preview. The print body is forced to 1024px (pdf_print.css) so mirror the desktop 80% here.
   Scoped to #pdf-cart-mirai_eco → PDF mirai_eco only. */
@media print {
  #pdf-cart-mirai_eco .mirai_eco .plan-desc .door-type {
    width: 80%;
  }
}

/* --- 省エネ / 健康: default 2 boxes per row (tablet/desktop screen + PRINT/PDF) --- */
#pdf-cart-mirai_eco .pdf_mirai_eco__sections {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  align-items: flex-start;
}

#pdf-cart-mirai_eco .pdf_mirai_eco__section {
  flex: 1 1 0;
  min-width: 0;
  background: #fff;
  border: 2px solid #70AD47;
  border-radius: 12px;
  overflow: hidden;
}

/* Mobile SCREEN ONLY (≤767px): 1 box per row (full-width) so content isn't too small.
   Uses "screen and" → does NOT apply when printing (print page box may be <768px) → PDF always keeps 2 boxes/row. */
@media screen and (max-width: 767px) {
  #pdf-cart-mirai_eco .pdf_mirai_eco__sections {
    flex-direction: column;
  }

  #pdf-cart-mirai_eco .pdf_mirai_eco__section {
    flex: 0 0 auto;
    width: 100%;
  }
}

#pdf-cart-mirai_eco .pdf_mirai_eco__section-head {
  background: #70AD47;
  color: #ffffff;
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  letter-spacing: 4px;
  padding: 8px 0;
}

#pdf-cart-mirai_eco .pdf_mirai_eco__section-body {
  padding: 4px;
}

#pdf-cart-mirai_eco .pdf_mirai_eco__section-body img {
  display: block;
  width: 100%;
  height: auto;
}

/* --- When exporting the mirai_eco PDF, do NOT print the 「前の画面に戻る」 button.
       Content stops at the Copyright line (.areaFooter). The button still shows in the preview
       so the user can go back to the cart; it's only hidden when printing. Scoped to #printPdf.pdf_mirai_eco
       → does not affect PDF door/water. --- */
@media print {
  #printPdf.pdf_mirai_eco .areaButtonback {
    display: none !important;
  }
}

/* ============================================================================
 * PDF mirai_eco: active page breaking (multi-page)
 * --------------------------------------------------------------------------
 * Requirement: selecting many その他 options → content is longer than 1 page.
 *   - Do NOT let .pdf_mirai_eco__sections / .areaBottom.item_mirai_eco_pdf / QR be split
 *     → push the whole block to the next page (applyMiraiEcoPageBreaks).
 *   - Page 2 repeats the .areaLogoTop header via the .pdf_page_header wrapper — a mechanism SHARED with
 *     the window flow, declared (hidden by default + .is-active shows it + break-before) in pdf_common.css.
 *     Below is only the part SPECIFIC to mirai_eco.
 * Scoped to #printPdf.pdf_mirai_eco → does NOT affect PDF door/water.
 * ========================================================================== */

@media print {
  /* Do not split these blocks across 2 pages → push the whole block to the next page
     (QR is handled separately in pdf_footer_area.css). subsidy-area = 2-column grid (display:contents) →
     can NOT break inside the block → always push the whole standalone block to the next page. */
  #printPdf.pdf_mirai_eco .mirai_eco .subsidy-area,
  #printPdf.pdf_mirai_eco .pdf_mirai_eco__sections,
  #printPdf.pdf_mirai_eco .areaBottom.item_mirai_eco_pdf {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* subsidy-area is INSIDE the .mirai_eco card (overflow:hidden for rounded corners). When subsidy-area is pushed
     to the next page, the card must be able to SPLIT across pages → force overflow:visible when printing (some
     browsers treat overflow:hidden as monolithic → block page breaks). */
  #printPdf.pdf_mirai_eco .mirai_eco {
    overflow: visible;
  }

  /* overflow:visible (above) removes the card's rounded-corner clip → .mirai_eco-head (green background, SQUARE corners)
     sticks out, making the 2 TOP corners of the card sharp when printed. Compensate by rounding the head itself = INNER radius
     of the card border (18px − 2px border = 16px) so the green corner blends with the border. (The card's BOTTOM corners are
     white-on-white so the border rounds them automatically, no handling needed.) */
  #printPdf.pdf_mirai_eco .mirai_eco-head {
    border-radius: 16px 16px 0 0;
  }

  /* mirai_eco SPECIFIC: the header wrapper is INSIDE .pdf_mirai_eco (22px horizontal padding) → pull it
     full-bleed to match the page 1 header. (The window flow's header is inside the footer, not needed.) */
  #printPdf.pdf_mirai_eco .pdf_mirai_eco .pdf_page_header {
    margin-left: -22px;
    margin-right: -22px;
    width: auto;
  }

  /* The repeated header sits BEFORE the subsidy-area, which is DEEP inside the card: .pdf_mirai_eco(pad 22) >
     .mirai_eco(border 2) > .content(pad 16) → add 18px on top of the header outside the card (-22) to
     full-bleed = -40px. Overrides the -22 rule above thanks to higher specificity (4 classes vs 3). */
  #printPdf.pdf_mirai_eco .mirai_eco .content .pdf_page_header {
    margin-left: -40px;
    margin-right: -40px;
  }
}
