/* Base */
#ndx-table-container,
#ndx-item-container {
  --main-color: #fea092;
  --main-dark-color: #fea092;
  --main-light-color: #fdf3f1;
  --main-text-black: #313131;

  --star-high-color: #ff2600;
  --star-mid-color: #ff7e33;
  --star-low-color: #ffaf54;

  font-size: 14px;
  color: var(--main-text-black);
  text-align: left;
  letter-spacing: 0.05em;
  line-height: 1.5;
  margin: 0 0 32px 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, Roboto, arial, helvetica,
    Hiragino Kaku Gothic ProN, "ヒラギノ角ゴ ProN W3", Meiryo, sans-serif;
  font-weight: normal;
  word-break: break-word;
  word-wrap: break-word;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;

  svg.icon-arrow-down {
    color: #999;
    font-size: 20px;
    width: 20px;
    height: 20px;
  }
  svg.icon-autorenew {
    color: #999;
    font-size: 12px;
    width: 12px;
    height: 12px;
  }
  svg.icon-feedback {
    width: 16px;
    height: 16px;
    fill: #999;
  }

  div,
  span,
  p,
  ol,
  li {
    font-size: 14px;
    line-height: 1.625;
  }

  h2,
  h3,
  b {
    all: unset;
    display: block;
    &::before,
    &::after {
      all: unset;
      content: unset;
    }
  }

  h2 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.4;
    color: #fff;
    padding: 0.75em 1em;
    margin: 2em 0;
    background-color: var(--main-color);
    position: relative;
    &::after {
      position: absolute;
      border: 1px solid #fff;
      content: "";
      top: 4px;
      bottom: 4px;
      left: 4px;
      right: 4px;
    }
  }

  h3 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    padding: 0 0 0.5em;
  }

  b {
    background: linear-gradient(transparent 60%, rgba(254, 198, 214, 0.6) 60%);
    padding: 0 2px 2px;
    font-weight: 700;
    display: inline;
  }

  .score-high {
    color: var(--star-high-color);
  }
  .score-mid {
    color: var(--star-mid-color);
  }
  .score-low {
    color: var(--star-low-color);
  }
  .custom-score-label {
    font-weight: bold;
    font-size: 10px;
    line-height: 1;
  }
  .custom-star-rating {
    display: flex;
    align-items: center;
    font-family: sans-serif;
    .custom-stars {
      position: relative;
      display: inline-block;
      font-size: 12px;
      line-height: 1;
    }
    .custom-stars-outer {
      color: #ccc;
      font-size: 12px;
    }
    .custom-stars-inner {
      position: absolute;
      font-size: 12px;
      top: 0;
      left: 0;
      white-space: nowrap;
      overflow: hidden;
      pointer-events: none;
    }
  }

  .feedback {
    display: flex;
    -webkit-box-pack: end;
    justify-content: end;
    a {
      display: flex;
      align-items: center;
      gap: 4px;
      text-decoration: none;
      color: #999;
      font-size: 12px;
      letter-spacing: normal;
      &:hover {
        text-decoration: underline;
      }
      img {
        width: 16px;
        height: 16px;
      }
      span {
        color: #999;
        font-size: 12px;
      }
    }
  }

  .flat-button {
    display: block;
    background-color: #62cb7d;
    border-radius: 4px;
    color: #fff;
    text-decoration: none;
    padding: 10px;
    font-size: 16px;
    font-weight: 700;
  }

  .rating {
    position: relative;
    display: inline-block;
    font-size: 12px;
    line-height: 1;
    letter-spacing: -1px;
  }
  .stars-base i {
    color: #e7e7e7;
  }
  .stars-fill {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    overflow: hidden;
    color: var(--star-low-color);
  }

  .ndx-questions-box {
    margin-bottom: 20px;
    .layout {
      display: flex;
      align-items: flex-start;
      gap: 4px;
    }

    .profile {
      flex: 0 0 120px;
      text-align: center;
    }

    .avatar {
      width: 80px;
      height: 80px;
      border-radius: 50%;
      object-fit: cover;
      margin-bottom: 8px;
    }

    .info .clinic {
      font-size: 12px;
      color: #666;
      line-height: 1.4;
    }

    .info .name {
      font-size: 14px;
      font-weight: bold;
    }

    .content {
      flex: 1;
    }

    .message {
      font-size: 14px;
      margin-bottom: 20px;
    }

    .question {
      margin-bottom: 24px;
    }

    .question p {
      font-weight: bold;
      margin-bottom: 8px;
    }

    .buttons,
    .pill-types {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }

    .btn,
    .btn-pill {
      padding: 4px 10px;
      min-width: 120px;
      border: 1px solid var(--main-color);
      border-radius: 24px;
      background: white;
      color: #f77;
      font-size: 14px;
      cursor: pointer;
      font-weight: 700;
      /* box-shadow: 0px 2px 4px 0 rgba(0, 0, 0, 0.2); */
    }

    .btn.primary {
      background: var(--main-color);
      color: white;
    }

    .btn-pill.active {
      background: var(--main-color);
      color: white;
    }
  }
  .ndx-buttons {
    display: flex;
    gap: 4px;
    font-size: 12px;
    padding: 8px 0;
    button {
      cursor: pointer;
      min-height: 32px;
      padding: 4px 8px;
      background-color: #fff;
      border: 1px solid #e7e7e7;
      border-radius: 4px;
      box-shadow: none;
      font-weight: normal;
      &:hover {
        background-color: #f7f7f7;
        color: var(--main-text-black);
      }
      &.selected {
        color: #0eb03a;
        background-color: #f5fcf6;
        border-color: #0eb03a;
      }
    }
  }

  .ndx-table-wrapper {
    overflow-x: auto;
    white-space: nowrap;
    letter-spacing: normal;
    .ndx-table {
      table-layout: fixed;
      width: 100%;
      border-collapse: collapse;
      th,
      td {
        font-size: 10px;
        line-height: 1.375;
        color: var(--main-text-black);
        padding: 4px;
        white-space: normal;
        word-break: break-word;
        box-sizing: border-box;
        p,
        span,
        ol,
        li {
          font-size: 10px;
          line-height: 1.375;
          margin: 0;
          padding: 0;
        }
      }
      th {
        border-top: 1px solid #ccc;
        border-bottom: 1px solid #ccc;
        background-color: #fcfdfd;
        font-weight: 700;
        width: 60px;
        color: #fff;
        background-color: var(--main-color);
        &.name {
          text-align: center;
        }
        &.img {
          text-align: center;
          width: 50px;
        }
        &.t6 {
          width: 70px;
        }
        &.t7 {
          width: 150px;
        }
      }
      td {
        height: 56px;
        border: none;
        border-right: 1px solid #e7e7e7;
        &.name {
          p:nth-child(1) {
            color: #999;
            -webkit-line-clamp: 1;
          }
          a {
            text-decoration: underline;
            cursor: pointer;
            color: var(--main-text-black);
          }
        }
        .rank {
          align-items: center;
          border-radius: 999px;
          display: flex;
          justify-content: center;
          font-weight: 700;
          height: 16px;
          width: 16px;
          min-width: 16px;
          padding: 0 2px;
          margin: auto;
          text-wrap-mode: nowrap;
        }
        .no1 {
          background-color: #f2b50d;
          color: #fff;
        }
        .no2 {
          background-color: #738c8c;
          color: #fff;
        }
        .no3 {
          background-color: #b36b4d;
          color: #fff;
        }
        p {
          -webkit-box-orient: vertical;
          display: -webkit-box;
          -webkit-line-clamp: 3;
          overflow: hidden;
        }
        &.img {
          text-align: center;
        }
        img.img {
          max-height: 40px;
          max-width: 40px;
        }
        a.url {
          display: flex;
          align-items: center;
          height: 40px;
          background-color: #0eb03a;
          border-radius: 4px;
          box-shadow: inset 0px -4px 0px rgba(0, 0, 0, 0.1);
          cursor: pointer;
          position: relative;
          vertical-align: top;
          width: auto;
          padding: 0px 0px 4px;
          min-height: 40px;
          color: #fff;
          text-decoration: none;
        }
        svg.icon-close {
          color: #b54300;
          font-size: 16px;
          width: 16px;
          height: 16px;
        }
        svg.icon-check {
          color: #02aa74;
          font-size: 16px;
          width: 16px;
          height: 16px;
        }
      }
      th:nth-child(1),
      td:nth-child(1) {
        position: sticky;
        left: 0;
        z-index: 2;
        width: 32px;
        border-left: 1px solid #ccc;
      }
      th:nth-child(2),
      td:nth-child(2) {
        position: sticky;
        left: 32px; /* 1列目の幅と同じ */
        z-index: 2;
        width: 85px;
        border-right: none;
        &::after {
          content: "";
          position: absolute;
          top: 0;
          right: 0;
          width: 4px; /* 線の太さ */
          height: 100%;
          border-right: 3px double #e7e7e7;
          pointer-events: none;
        }
      }
      th:nth-child(3),
      td:nth-child(3) {
        border-left: none;
      }
      th:last-child,
      td:last-child {
        border-left: 1px solid #ccc;
      }
      tr:nth-child(2n-1) {
        background-color: #fff;
        td:nth-child(1),
        td:nth-child(2) {
          background-color: #fff;
        }
      }
      tr:nth-child(2n) {
        background-color: #fbfbfb;
        td:nth-child(1),
        td:nth-child(2) {
          background-color: #fbfbfb;
        }
      }
      tr:last-child {
        border-bottom: 1px solid #ccc;
      }
    }
  }
  .ndx-table-wrapper tbody tr:nth-of-type(n + 11) {
    display: none;
  }
  .ndx-table-wrapper tbody tr:nth-of-type(10) td {
    border-bottom: 1px solid #ccc;
  }
  #ndx-table-all {
    display: none;
  }
  #ndx-table-all:checked ~ .ndx-table-wrapper tbody tr:nth-of-type(10) td {
    border-bottom: none;
  }
  #ndx-table-all:checked ~ .ndx-table-wrapper tbody tr {
    display: table-row;
  }
  #ndx-table-all:checked ~ label {
    display: none;
  }
  label[for="ndx-table-all"] {
    border: 1px solid #0eb03a;
    border-radius: 4px;
    display: block;
    cursor: pointer;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #0eb03a;
    margin-top: 12px;
    padding: 4px;
    &:hover {
      background-color: #f5fcf6;
    }
    svg.icon-arrow-down {
      color: #0eb03a;
    }
    div:nth-child(1) {
      bottom: 100%;
      position: absolute;
      width: 100%;
      z-index: 1;
      background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0) 0%,
        #f7f7f7 100%
      );
      height: 30px;
    }
    div:nth-child(2) {
      display: inline-flex;
      align-items: center;
      padding: 6px;
    }
  }

  .ndx-item-wrapper {
    margin-top: 50px;
    .ndx-item {
      margin-bottom: 60px;
      .label-circle {
        color: #3073b5;
        border: 1px solid #3073b5;
        border-radius: 15px;
        padding: 2px 10px;
        letter-spacing: normal;
      }
      .score-box {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 12px;
        .col {
          div {
            font-size: 12px;
          }
          span {
            font-weight: 700;
            margin-left: 1em;
          }
          .score {
            margin-bottom: 6px;
          }
          .score span {
            font-size: 22px;
            margin-left: 0;
            line-height: 1;
          }
          &:nth-child(1) {
            width: 34%;
          }
          &:nth-child(2) {
            width: 4%;
          }
          &:nth-child(3) {
            width: 62%;
            background-color: var(--main-light-color);
            padding: 16px 10px;
            line-height: 1.2;
          }
        }
      }
      .info-box {
        width: 100%;
        margin-bottom: 20px;
        .row {
          display: flex;
          flex-wrap: wrap;
          margin-bottom: 14px;
          align-items: stretch;
          border-bottom: 1px solid var(--main-color);

          /* 共通スタイル */
          .label,
          .text {
            padding: 8px;
            box-sizing: border-box;
            width: 25%;
            line-height: 1.2;
          }
          .label {
            background-color: var(--main-color);
            color: #fff;
            font-weight: bold;
            border-top-left-radius: 4px;
            border-top-right-radius: 4px;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
          }
          .text {
            font-size: 14px;
            text-align: left;
          }
        }
        .row:nth-child(1) .text {
          width: 75%;
        }
      }
      .price-box {
        font-size: 16px;
        margin-bottom: 20px;
        & > span {
          font-size: 12px;
          color: #999;
        }
        summary {
          display: grid;
          grid-template-columns: 1fr 30px;
          gap: 6px;
          font-size: 14px;
          line-height: 1.5;
          align-items: center;
          cursor: pointer;
          color: #313131;
          &::-webkit-details-marker {
            display: none;
          }
          .icon-arrow-down {
            width: 30px;
            height: 30px;
            fill: #313131;
          }
        }
        details[open] .icon-arrow-down {
          transform: rotate(180deg);
        }
        .content {
          display: flex;
          flex-direction: column;
          font-size: 14px;
          margin-top: 6px;
        }
        .seq {
          counter-reset: seq-item;
          .seq-item {
            counter-increment: seq-item;
            position: relative;
            padding-left: 2em;
            margin-bottom: 10px;
            p:nth-child(1) {
              margin-bottom: 0;
              & > strong {
                font-size: 16px;
                &:before {
                  content: counter(seq-item);
                  display: inline-block;
                  background: #f7f7f7;
                  color: #313131;
                  border-radius: 50%;
                  font-size: 14px;
                  width: 1.7em;
                  height: 1.7em;
                  line-height: 1.7em;
                  text-align: center;
                  margin-right: 4px;
                  position: absolute;
                  left: 0;
                }
              }
            }
            div {
              line-height: 1.375;
            }
            div:nth-child(3) {
              color: red;
              font-weight: 700;
            }
          }
        }
      }
      .button-box {
        width: 100%;
        text-align: center;
        margin-bottom: 32px;
      }
      .feature-box {
        margin-bottom: 32px;
        & > strong {
          font-size: 16px;
          line-height: 1.375;
        }
        .feedback-boxes {
          display: flex;
          gap: 14px;
          margin-top: 20px;
          margin-bottom: 20px;

          & > div {
            flex: 1;
            border: 1.5px solid;
            border-radius: 4px;
            overflow: hidden;
            & > div:nth-child(1) {
              font-weight: bold;
              font-size: 14px;
              display: flex;
              align-items: center;
              justify-content: center;
              padding: 6px;
            }
            & > div:nth-child(2) {
              font-size: 12px;
              padding: 6px;
            }
            li {
              font-size: 12px;
              line-height: 1.375;
              &::marker {
                color: #313131;
              }
            }
          }

          & > div:nth-child(1) {
            border-color: var(--main-color);
            & > div:nth-child(1) {
              background-color: var(--main-light-color);
              border-bottom: 1.5px solid;
              color: var(--main-color);
            }
          }
          & > div:nth-child(2) {
            border-color: #97bddc;
            & > div:nth-child(1) {
              background-color: #f1f7fc;
              border-bottom: 1.5px solid;
              color: #97bddc;
            }
          }
        }
        & > div:nth-child(3) {
          margin-bottom: 32px;
        }
      }
      .booking-box {
        display: flow-root;
        margin-bottom: 32px;
        & > strong {
          font-size: 16px;
          display: block;
          line-height: 1.375;
          margin-bottom: 20px;
        }

        table.arrow-bg {
          width: 100%;
          margin-bottom: 20px;
          th,
          td {
            border: 0;
            padding: 8px;
            font-size: 12px;
            line-height: 1.375;
            text-align: center;
            vertical-align: middle;
          }
          th {
            width: 21%;
            padding: 4px;
          }
          th:first-child {
            background-color: #fff;
            width: 16%;
          }
          td {
            border-bottom: 1px solid #e7e7e7;
          }
          td:first-child {
            text-align: left;
          }

          th.arrow-bg {
            background-color: var(--main-color);
            color: #fff;
            font-weight: bold;
            position: relative;
            clip-path: polygon(0% 0%, 90% 0%, 100% 50%, 90% 100%, 0% 100%);
          }
        }
        .responsive-table {
          display: flex;
          flex-direction: column;
          gap: 0;
          width: 100%;
        }

        .row {
          display: flex;
          flex-wrap: wrap;
          padding: 0;
        }

        .cell {
          border-bottom: 1px solid #e7e7e7;
          padding: 8px 6px;
          line-height: 1.4;
          font-size: 12px;
          &.label {
            width: 60%;
          }
          &.value {
            width: 40%;
          }
          & > span {
            font-size: 10px;
            line-height: 1.375;
            display: inline-block;
          }
        }

        @media (min-width: 769px) {
          .cell:nth-child(1).label {
            width: 40%;
          }
          .cell:nth-child(2).value,
          .cell:nth-child(3).label,
          .cell:nth-child(4).value {
            width: 20%;
          }
        }
      }
      .steps-box {
        margin-bottom: 32px;
        summary {
          font-size: 16px;
          line-height: 1.375;
          display: grid;
          grid-template-columns: 1fr 30px;
          gap: 6px;
          align-items: center;
          cursor: pointer;
          margin-bottom: 20px;
          span {
            font-size: 12px;
          }
          .icon-arrow-down {
            width: 24px;
            height: 24px;
            fill: #313131;
            border: 2px solid;
            border-radius: 50%;
          }
        }
        details[open] .icon-arrow-down {
          transform: rotate(180deg);
        }
        .glide {
          position: relative;
          width: 60%;
          aspect-ratio: 2/3;
          margin: 40px auto; /* 上下余白＆中央寄せ */
        }

        .glide__slide {
          display: flex;
          align-items: center;
          justify-content: center;
          height: 100%;
        }

        .glide__slide img {
          width: 100%;
          height: 100%;
          object-fit: cover; /* または contain */
          display: block;
          border: none;
          visibility: hidden; /* 最初は非表示（ちらつき防止） */
          margin-bottom: 20px;
        }

        /* 矢印ボタン（初期状態で非表示なら display: none; を追加） */
        .glide__arrow {
          position: absolute;
          top: 50%;
          transform: translateY(-50%);
          background: rgba(0, 0, 0, 0.5);
          color: white;
          border: none;
          font-size: 24px;
          width: 40px;
          height: 40px;
          cursor: pointer;
          display: none;
          align-items: center;
          justify-content: center;
          border-radius: 50%;
          z-index: 10;
          pointer-events: auto;
        }

        /* ← 左矢印を画像の左外側に */
        .glide__arrow--left {
          left: -60px;
        }

        /* → 右矢印を画像の右外側に */
        .glide__arrow--right {
          right: -60px;
        }

        .glide__slides {
          padding-left: 0;
        }

        .glide__arrows {
          /* positionは不要。子要素にabsoluteを使う */
          pointer-events: none; /* 背景クリック無効化（矢印の外側） */
        }
      }
    }
  }
}

/** Custom **/
#ndx-table-container {
  .ndx-table-wrapper {
    .ndx-table {
      th {
        &.img {
          text-align: center;
          width: 50px;
        }
      }
    }
  }
}

/* モーダル */
.custom-modal {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding-top: 50px;
  .custom-modal-content {
    background-color: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }
  .custom-modal-header {
    padding: 6px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    span {
      font-size: 30px;
      line-height: 1;
    }
  }
  .custom-modal-close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
  }
  .custom-modal-body {
    padding: 20px 20px 30px 20px;
    overflow-y: auto;
    flex-grow: 1;
  }
  .custom-modal-close-btn {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin: 20px auto;
    padding: 5px;
    border: 1px solid;
    border-radius: 4px;
    width: 80px;
  }
}
