@charset "utf-8";

/* pages/plan-detail.css  —  /plan/smartpriceplan, /plan/basicplan */

.page-plan-detail {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3xl);
  padding-top: var(--sp-3xl);

  @media (max-width: 1023px) {
    gap: var(--sp-2xl);
    padding-top: var(--sp-2xl);
  }
}

/* .container > section の margin-top と gap が二重に効くので打ち消す。
   横位置の auto は残すため margin-top だけ上書きする。
   padding はここで一括指定しない（各ブロック側の padding が負けてしまう）。
   枠や背景を持つ .plan-outline / .plan-feature は自前で padding を持っている */
.page-plan-detail > section {
  margin-top: 0;
}

/* プラン概要と特長の説明はひとまとまりなので詰める（デザインの spacer は 16px） */
.page-plan-detail > .plan-feature {
  margin-top: calc(var(--sp-md) - var(--sp-3xl));

  @media (max-width: 1023px) {
    margin-top: calc(var(--sp-md) - var(--sp-2xl));
  }
}

/* SPでは概要・特長を画面幅いっぱいに伸ばす */
@media (max-width: 1023px) {
  .page-plan-detail > .plan-outline,
  .page-plan-detail > .plan-feature {
    margin-right: calc(var(--container-gutter) * -1);
    margin-left: calc(var(--container-gutter) * -1);
    width: calc(100% + var(--container-gutter) * 2);
    max-width: none;
  }
}

.page-plan-detail-smart {
  --plan-color: var(--c-plan-smart);
  --plan-color-accent: var(--c-plan-smart-accent);
  --plan-color-light: var(--c-plan-smart-light);
}

.page-plan-detail-basic {
  --plan-color: var(--c-plan-basic);
  --plan-color-accent: var(--c-plan-basic-accent);
  --plan-color-light: var(--c-plan-basic-light);
}

/* ----------------------------------------- */
/* プラン概要 */
/* ----------------------------------------- */
.plan-outline {
  padding: var(--sp-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
  border: 2px solid var(--plan-color);
  border-radius: var(--radius-xl);

  @media (max-width: 1023px) {
    padding: var(--sp-md);
    grid-template-columns: 1fr;
  }
}

.plan-outline-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-md);
}

.plan-outline-catch {
  color: var(--plan-color);
  font-size: var(--fs-lg);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.plan-outline-name {
  display: flex;
  gap: var(--sp-lg);
  align-items: center;
}

.plan-outline-badge {
  padding: 0 var(--sp-md);
  display: inline-flex;
  align-items: center;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--plan-color);
  color: var(--c-white);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
}

.plan-outline-title {
  margin-top: var(--sp-xs);
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.4;
}

.plan-outline-coin {
  padding: var(--sp-md);
  width: 100%;
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--plan-color-light);
  font-size: var(--fs-md);
  font-weight: 700;

  em {
    font-size: var(--fs-2xl);
    font-weight: 700;
    font-family: var(--font-num);
  }
}

.plan-outline-recommend {
  padding: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  border-radius: var(--radius-md);
  background: var(--c-bg-gray);

  ul {
    display: flex;
    flex-direction: column;
    gap: var(--sp-xs);
  }

  li {
    padding-left: 28px;
    position: relative;
    font-size: var(--fs-md);

    /* icon-check.svg は単色（#F07D0A）が焼き込まれているのでマスクとして使い、
       塗りはプランカラーで当てる */
    &::before {
      content: "";
      position: absolute;
      top: 0.5em;
      left: 0;
      width: 20px;
      height: 14px;
      background: var(--plan-color-accent);
      mask: url(../../images/common/icon-check.svg) no-repeat 0 0 / contain;
    }
  }
}

.plan-outline-recommend-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  text-align: center;
  line-height: var(--lh-snug);
}

/* ----------------------------------------- */
/* プランの特長 */
/* ----------------------------------------- */
.plan-feature {
  padding: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  border-radius: var(--radius-xl);
  background: var(--plan-color-light);

  @media (max-width: 1023px) {
    padding: var(--sp-md);
  }
}

.plan-feature-body {
  padding: var(--sp-lg);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-xl);
  border-radius: var(--radius-xl);
  background: var(--c-white);

  @media (max-width: 1023px) {
    padding: var(--sp-md);
    grid-template-columns: 1fr;
    gap: var(--sp-md);
  }
}

.plan-feature-text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);

  p {
    font-size: var(--fs-md);
    line-height: 1.7;
  }
}

.plan-feature-image {
  max-width: 100%;
  height: auto;
}

/* でんき予報導線 */
.plan-forecast {
  padding: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  border-radius: var(--radius-xl);
  background: var(--c-white);

  @media (max-width: 1023px) {
    padding: var(--sp-md);
  }
}

.plan-forecast-body {
  display: flex;
  gap: var(--sp-2xl);
  align-items: center;

  @media (max-width: 1023px) {
    flex-direction: column;
    gap: var(--sp-md);
  }
}

.plan-forecast-image {
  flex-shrink: 0;
  max-width: 100%;
  height: auto;
}

.plan-forecast-text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2xs);

  p {
    font-size: var(--fs-base);
    line-height: 1.8;
  }
}

.plan-forecast-eyebrow {
  color: var(--c-blue);
  font-weight: 700;
}

.plan-forecast-text .plan-forecast-title {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.plan-forecast-action {
  padding: var(--sp-md) 0;
  display: flex;
  justify-content: center;
  background: var(--c-bg-gray);
}

/* ----------------------------------------- */
/* 料金例テーブル（SPのカード表示） */
/* ----------------------------------------- */
/* 表組み自体は blocks/plan-card.css。ここはプラン詳細ページ限定の
   SPカード化。トップページの同テーブルは4列で構成が違うため対象外 */
.page-plan-detail .plan-example-table {
  @media (max-width: 767px) {
    overflow-x: visible;

    table,
    thead,
    tbody,
    tr,
    th,
    td {
      display: block;
      width: auto;
    }

    table {
      min-width: 0;
    }

    /* thead はカード上部のリードにする */
    thead tr {
      margin-bottom: var(--sp-md);
      display: flex;
      flex-direction: column;
      gap: var(--sp-xs);
    }

    thead th {
      padding: var(--sp-sm);
      border: 0;
      border-radius: var(--radius-md);
    }

    th.plan-example-blank {
      display: none;
    }

    .plan-example-current {
      border: 1px solid var(--c-border);
    }

    /* tbody は「1行＝1カード」 */
    tbody tr {
      margin-bottom: var(--sp-md);
      border: 1px solid var(--c-border);
      border-radius: var(--radius-md);
      overflow: hidden;

      &:last-child {
        margin-bottom: 0;
      }
    }

    /* 行見出しがカードの見出し */
    tbody th {
      padding: var(--sp-xs) var(--sp-md);
      border: 0;
      background: var(--c-bg-gray);
      font-weight: 700;
      text-align: left;
    }

    tbody td {
      padding: var(--sp-xs) var(--sp-md);
      border: 0;
      text-align: right;

      /* どちらのプランの値かを左に出す */
      &::before {
        content: attr(data-label);
        margin-right: var(--sp-md);
        float: left;
        color: var(--c-note);
        font-weight: 400;
      }
    }

    tbody td + td {
      border-top: 1px solid var(--c-border);
    }

    /* 「13,095 コイン」が単位の途中で折れないようにする。
       ラベルの右に入らない場合は塊ごと次の行へ送る */
    .plan-example-num {
      white-space: nowrap;
    }
  }
}

/* ----------------------------------------- */
/* 料金単価テーブル（ベーシックプラン） */
/* ----------------------------------------- */
.plan-price-table-wrap {
  padding: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  align-items: center;
  border-radius: var(--radius-xl);
  background: var(--c-white);

  @media (max-width: 1023px) {
    padding: var(--sp-md);
  }
}

.plan-price-lead {
  font-size: var(--fs-md);
  text-align: center;
}

/* エリア選択。ネイティブの select を使い、矢印だけ ::after で描く。
   destyle.css が select の見た目を落としているので一から指定する */
.plan-price-areas {
  position: relative;
  width: 100%;
  max-width: 320px;

  &::after {
    content: "";
    position: absolute;
    top: 50%;
    right: var(--sp-md);
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--c-blue);
    border-bottom: 2px solid var(--c-blue);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
  }
}

.plan-price-select {
  padding: var(--sp-sm) var(--sp-2xl) var(--sp-sm) var(--sp-lg);
  appearance: none;
  width: 100%;
  border: 2px solid var(--c-blue);
  border-radius: var(--radius-xs);
  background: var(--c-white);
  color: var(--c-text);
  font-family: inherit;
  font-size: var(--fs-md);
  font-weight: 700;
  line-height: var(--lh-snug);
  text-align: center;
  cursor: pointer;

  &:focus-visible {
    outline: 2px solid var(--c-blue-accent);
    outline-offset: 2px;
  }

  @media (max-width: 1023px) {
    padding: var(--sp-xs) var(--sp-2xl) var(--sp-xs) var(--sp-md);
    font-size: var(--fs-base);
  }
}

.plan-price-panel {
  width: 100%;
}

/* 単価が未支給のエリア */
.plan-price-pending {
  padding: var(--sp-2xl) var(--sp-lg);
  color: var(--c-note);
  font-weight: 500;
  line-height: var(--lh-snug);
  text-align: center;
  background: var(--c-bg-gray);
  border-radius: var(--radius-md);
}

.plan-price-table {
  width: 100%;
  overflow-x: auto;

  table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
  }

  th,
  td {
    padding: var(--sp-xs);
    border: 1px solid var(--c-border);
    font-size: var(--fs-base);
    text-align: center;
    vertical-align: middle;
    font-family: var(--font-num);
    height: 72px;
    a {
      font-size: var(--fs-md);
    }
  }

  thead th {
    background: var(--plan-color);
    color: var(--c-white);
    font-size: var(--fs-md);
    font-weight: 700;

    img {
      display: block;
      margin: 0 auto var(--sp-2xs);
    }
  }

  td span {
    display: block;
    color: var(--c-note);
    font-size: var(--fs-sm);
    text-align: center;
  }

  /* スマホでは5列を詰め込まず、区分ごとのカードに組み替える。
     tbody = カード（見出しは data-group）、tr = カード内の小ブロック、
     各値は data-label を項目名として「項目名 … 値」の1行にする。
     区分セル（rowspan あり）はカード見出しと重複するので隠す */
  @media (max-width: 767px) {
    overflow-x: visible;

    table,
    tbody,
    tr,
    th,
    td {
      display: block;
      width: auto;
      height: auto;
    }

    table {
      min-width: 0;
    }

    thead {
      display: none;
    }

    tbody {
      margin-bottom: var(--sp-md);
      border: 1px solid var(--c-border);
      border-radius: var(--radius-md);
      overflow: hidden;

      &:last-child {
        margin-bottom: 0;
      }

      /* カード見出し（区分） */
      &::before {
        content: attr(data-group);
        padding: var(--sp-xs) var(--sp-md);
        display: block;
        background: var(--plan-color);
        color: var(--c-white);
        font-size: var(--fs-base);
        font-weight: 700;
      }
    }

    /* 同じカード内の2つめ以降の小ブロックは区切り線で分ける */
    tr + tr {
      border-top: 1px solid var(--c-border);
    }

    th.plan-price-category {
      display: none;
    }

    th,
    td {
      padding: var(--sp-xs) var(--sp-md);
      border: 0;
      font-size: var(--fs-base);
      text-align: right;

      /* 項目名を左、値を右に置く */
      &::before {
        content: attr(data-label);
        margin-right: var(--sp-md);
        float: left;
        color: var(--c-note);
        font-weight: 400;
      }
    }

    /* 契約種別は小ブロックの見出しなので全幅・左寄せ。
       「—」しか入っていない行はカードでは情報がないので隠す */
    th.plan-price-type {
      background: var(--c-bg-gray);
      font-weight: 700;
      text-align: left;
    }

    th.plan-price-type[data-none] {
      display: none;
    }

    /* 「契約電流（A）」は折り返さず1行で見せる */
    th.plan-price-type span {
      display: inline;
      font-size: var(--fs-sm);
    }

    /* 値に添える注記は値の下に置く */
    td span {
      display: block;
      color: var(--c-note);
      font-size: var(--fs-sm);
      text-align: right;
    }

    /* 電源調達関連料金のリンク行は項目名なしで中央に置く */
    td[colspan] {
      text-align: center;

      &::before {
        display: none;
      }
    }
  }
}

.plan-price-table th.plan-price-category {
  background: var(--c-white);
  font-size: var(--fs-md);
  font-weight: 700;

  span {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 400;
    text-align: center;
  }
}

.plan-price-type {
  background: var(--c-bg-gray);
  font-weight: 700;

  span {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 400;
    text-align: center;
  }
}

.plan-price-discounted {
  color: var(--c-red);
  font-weight: 700;
}

/* ----------------------------------------- */
/* 電気料金の仕組み */
/* ----------------------------------------- */
.plan-pricing {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.plan-pricing-lead {
  margin-top: var(--sp-lg);
  font-size: var(--fs-md);
  line-height: 1.7;
}

.plan-formula-list {
  display: grid;
  gap: var(--sp-2xs);
}

.plan-formula-list-smart {
  grid-template-columns: 256fr 504fr 256fr;

  @media (max-width: 1023px) {
    grid-template-columns: 1fr;
    gap: var(--sp-lg);
  }
}

.plan-formula-list-basic {
  grid-template-columns: repeat(4, 1fr);

  @media (max-width: 1023px) {
    grid-template-columns: 1fr;
    gap: var(--sp-lg);
  }
}

.plan-formula {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--formula-color);
  border-radius: var(--radius-md);
  /* overflow: hidden にすると「＋」バッジが切られるので、
     見出しの角丸は .plan-formula-head 側で持たせている */

  &:not(:last-child)::after {
    content: "＋";
    position: absolute;
    top: 50%;
    right: -18px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 2px solid var(--c-white);
    border-radius: var(--radius-full);
    background: var(--c-bg-info-icon);
    font-size: var(--fs-xl);
    font-weight: 700;
    line-height: 1;

    @media (max-width: 1023px) {
      top: auto;
      right: 50%;
      bottom: -28px;
      transform: translateX(50%);
    }
  }
}

/* 数式カードの色。Figma のトークンに無い色のためここで定義する */
.plan-formula-base {
  --formula-color: #ea575e;
}

.plan-formula-usage {
  --formula-color: #f17048;
}

.plan-formula-energy {
  --formula-color: #4aa3d5;
}

.plan-formula-renewable {
  --formula-color: #88c912;
}

.plan-formula-head {
  padding: var(--sp-xs) var(--sp-sm);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2xs);
  align-items: center;
  justify-content: center;
  height: 44px;
  /* 枠線 2px を差し引いた角丸 */
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--formula-color);
  color: var(--c-white);
  font-size: var(--fs-base);
  font-weight: 700;
  text-align: center;
}

.plan-formula-tag {
  padding: var(--sp-xs) var(--sp-md);
  border-radius: var(--radius-full);
  background: var(--c-white);
  color: var(--c-text);
  font-size: var(--fs-xs);
  font-weight: 400;
  line-height: 1;
}

.plan-formula-body {
  flex: 1;
  padding: var(--sp-md);
  display: flex;
  flex-direction: column;
  justify-content: center;

  p {
    font-size: var(--fs-base);
    line-height: 1.8;
    text-align: center;
  }
}

.plan-formula-body-split {
  flex-direction: row;
  gap: var(--sp-xs);
  align-items: center;

  > div {
    flex: 1;
  }
}

.plan-formula-label {
  font-weight: 700;
}

.plan-formula-body .plan-formula-plus {
  flex-shrink: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
}

.plan-energyfees-notice {
  padding: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  border: 2px solid var(--c-border);
  border-radius: var(--radius-xl);

  p {
    font-size: var(--fs-md);
    line-height: 1.7;
  }

  & + .plan-note-list {
    margin-top: calc(var(--sp-md) * -1);
  }
}

/* .title--md が display: flex を持っていて hidden 属性だけでは消えないので、
   .plan-example の直下に限って [hidden] を効かせる（js/common.js のエリア切り替え用） */
.plan-example > [hidden] {
  display: none;
}

.plan-note-band {
  margin-top: var(--sp-xl);
  padding: var(--sp-lg);
  background: var(--c-bg-gray);
  border-radius: var(--radius-xl);
  @media (max-width: 1023px) {
    padding: var(--sp-md);
    margin: var(--sp-lg) calc(var(--container-padding) * -1) 0;
    width: calc(100% + var(--container-padding) * 2);
  }
}

.plan-note {
  padding: var(--sp-lg);
  border-radius: var(--radius-xl);
  background: var(--c-white);
}

.plan-note-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2xs);

  li {
    font-size: var(--fs-sm);
    line-height: 1.5;
    color: var(--c-note);
  }
}

/* ----------------------------------------- */
/* 重要書類・電気需給約款 */
/* ----------------------------------------- */
.plan-agreement {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2xl);
}

.plan-doc-list {
  padding: var(--sp-lg);
  display: flex;
  gap: var(--sp-md);
  justify-content: center;
  border-radius: var(--radius-xl);
  background: var(--c-bg-gray);

  @media (max-width: 1023px) {
    flex-direction: column;
    align-items: center;
  }
}

.plan-doc-btn {
  padding: 0 var(--sp-lg);
  display: inline-flex;
  gap: var(--sp-xs);
  align-items: center;
  line-height: 40px;
  justify-content: center;
  border: 2px solid var(--c-blue-accent);
  border-radius: var(--radius-full);
  background: var(--c-white);
  color: var(--c-text);
  font-size: var(--fs-md);
  text-decoration: none;
  &[target="_blank"] {
    &::after {
      content: none;
    }
  }
  @media (hover: hover) {
    &:hover {
      background: var(--c-blue);
      color: var(--c-white);
    }
  }
}

.plan-agreement-body {
  display: grid;
  grid-template-columns: 182px 720px;
  justify-content: space-between;

  @media (max-width: 1023px) {
    grid-template-columns: 1fr;
    gap: var(--sp-lg);
  }
}

/* 左カラム。見出しは上端、イラストは下端に置く。
   .title--md を直接 grid アイテムにすると伸縮で罫線がセクション全高まで
   伸びてしまうが、この flex カラムの中なら高さは内容ぶんに収まる */
.plan-agreement-head {
  display: flex;
  flex-direction: column;
}

/* デザインでは約款リストの下端と揃うので margin-top: auto で下寄せ */
.plan-agreement-image {
  margin-top: auto;
  max-width: 100%;
  height: auto;

  @media (max-width: 1023px) {
    display: none;
  }
}

.plan-agreement-content {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2xl);
}

.plan-agreement-lead {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);

  p {
    font-size: var(--fs-md);
  }
  p.caution {
    font-size: var(--fs-base);
    line-height: var(--lh-snug);
    color: var(--c-note);
  }
}

/* ----------------------------------------- */
/* 申し込みボタン */
/* ----------------------------------------- */
.plan-apply {
  /* セクション内に置いたときの上の間隔。直下に置く場合は gap が担う */
  margin-top: var(--sp-3xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  align-items: center;

  @media (max-width: 1023px) {
    margin-top: var(--sp-2xl);
  }
}

.page-plan-detail > .plan-apply {
  margin-top: 0;
}

/* エリア切り替えで料金例の表を隠しているとき（js/common.js）は、
   直前が消えて上の余白が親の gap と二重になるので margin-top を落とす */
.plan-example-table[hidden] + .plan-apply {
  margin-top: 0;
}

/* ボタン上に重ねる吹き出し（simulation-cta-note と同じ考え方） */
.plan-apply-note {
  padding: 0 var(--sp-lg);
  position: relative;
  z-index: 1;
  order: -1;
  margin-bottom: -20px;
  display: flex;
  align-items: center;
  height: 32px;
  border: 1px solid var(--plan-color-accent);
  border-radius: var(--radius-xs);
  background: var(--c-white);
  color: var(--plan-color-accent);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;

  &::before,
  &::after {
    content: "";
    position: absolute;
    left: 50%;
    border-style: solid;
    border-color: transparent;
    transform: translateX(-50%);
  }

  &::before {
    bottom: -6px;
    border-width: 6px 5px 0;
    border-top-color: var(--plan-color-accent);
  }

  &::after {
    bottom: -5px;
    border-width: 6px 5px 0;
    border-top-color: var(--c-white);
  }
}
