
/* =========================================================
 * STEP9-G-1: 比較商品の選択 / 固定トレイ
 * ========================================================= */

.va-compare-tray[hidden] {
  display: none !important;
}

.va-compare-tray {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9990;
  width: min(420px, calc(100vw - 36px));
  color: #332d29;
}

body.admin-bar .va-compare-tray {
  bottom: 18px;
}

.va-compare-tray-inner {
  overflow: hidden;
  border: 1px solid #dfd2ca;
  border-radius: 14px;
  background: rgba(255, 253, 250, 0.98);
  box-shadow: 0 16px 46px rgba(58, 45, 38, 0.16);
  backdrop-filter: blur(10px);
}

.va-compare-tray-head,
.va-compare-tray-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
}

.va-compare-tray-head {
  border-bottom: 1px solid #eee4dc;
}

.va-compare-tray-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.va-compare-tray-head strong {
  font-size: 0.92rem;
}

.va-compare-tray-head span {
  color: #8a7e76;
  font-size: 0.72rem;
}

.va-compare-clear {
  padding: 0;
  border: 0;
  background: transparent;
  color: #9d6d72;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.va-compare-clear:hover,
.va-compare-clear:focus-visible {
  text-decoration: underline;
}

.va-compare-selected-list {
  display: grid;
  gap: 0;
}

.va-compare-selected-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 7px 12px;
  border-bottom: 1px solid #f0e7e0;
}

.va-compare-selected-item:last-child {
  border-bottom: 0;
}

.va-compare-selected-number {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #f2e7e4;
  color: #a66f76;
  font-size: 0.68rem;
  font-weight: 700;
}

.va-compare-selected-title {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.va-compare-remove {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9a8d85;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.va-compare-remove:hover,
.va-compare-remove:focus-visible {
  background: #f4ebe7;
  color: #9d656d;
}

.va-compare-tray-foot {
  border-top: 1px solid #eee4dc;
  background: #fcf8f5;
}

.va-compare-tray-foot p {
  margin: 0;
  color: #83776f;
  font-size: 0.72rem;
  line-height: 1.45;
}

.va-compare-next {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid #d8ccc4;
  border-radius: 7px;
  background: #eee8e3;
  color: #9a8e86;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: default;
}

.va-compare-message {
  min-height: 0;
  padding: 0 14px;
  color: #a06970;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: right;
}

.va-compare-message:not(:empty) {
  min-height: 30px;
  padding-top: 6px;
  padding-bottom: 9px;
}

/* =========================================================
 * 14. モバイル比較リストの省スペース化（PCは従来表示）
 * ========================================================= */
.va-compare-mini,
.va-compare-tray-close {
  display: none;
}

.va-compare-tray-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 商品一覧・詳細の比較ボタン共通状態 */
.va-compare-toggle {
  cursor: pointer !important;
  opacity: 1 !important;
}

.va-compare-toggle.is-selected {
  border-color: #bf858b !important;
  background: #fff5f3 !important;
  color: #9e666d !important;
}

.va-compare-toggle:focus-visible {
  outline: 2px solid rgba(191, 133, 139, 0.28);
  outline-offset: 2px;
}

@media (max-width: 620px) {
  .va-compare-tray {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: min(420px, calc(100vw - 20px));
  }

  /* 初期状態は小型ボタンのみ。画面下部の大部分を覆わない。 */
  .va-compare-tray[data-va-compare-open="false"] {
    width: auto;
  }

  .va-compare-tray[data-va-compare-open="false"] .va-compare-tray-inner,
  .va-compare-tray[data-va-compare-open="true"] .va-compare-mini {
    display: none;
  }

  .va-compare-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 110px;
    min-height: 46px;
    padding: 10px 17px;
    border: 1px solid #aa747a;
    border-radius: 999px;
    background: #a66f76;
    box-shadow: 0 6px 22px rgba(67, 42, 46, 0.23);
    color: #fff;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
  }

  .va-compare-mini b {
    font-weight: 800;
  }

  .va-compare-mini:focus-visible,
  .va-compare-tray-close:focus-visible {
    outline: 3px solid #6b424c;
    outline-offset: 3px;
  }

  .va-compare-tray-inner {
    max-height: min(72vh, calc(100dvh - 40px));
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .va-compare-tray-head {
    align-items: center;
    gap: 8px;
  }

  .va-compare-tray-controls {
    gap: 12px;
    flex-shrink: 0;
  }

  .va-compare-tray-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 4px 8px;
    border: 1px solid #e0d4cd;
    border-radius: 7px;
    background: #fff;
    color: #675953;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
  }

  .va-compare-tray-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .va-compare-selected-title {
    white-space: normal;
  }
}


/* STEP9-G-2: 2商品以上で比較ボタンを有効化 */
.va-compare-next.is-ready {
  border-color: #bf858b;
  background: #bf858b;
  color: #fff;
  cursor: pointer;
}

.va-compare-next.is-ready:hover,
.va-compare-next.is-ready:focus-visible {
  border-color: #aa747a;
  background: #aa747a;
}
