/* ============================================================
   Price History Table - 過去価格表
   
   既存の custom.css の :root で定義された --gold-* 変数を使用
============================================================ */

.price-history {
  margin: 40px 0;
}

.price-history__lead {
  text-align: center;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-2, #2a3450);
  margin: 0 0 24px;
}

.price-history__table-wrap {
  overflow-x: auto;
  border: 1px solid #e8e3d4;
  border-radius: 6px;
  background: #fff;
  margin-bottom: 20px;
}

.price-history__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 480px;
}

.price-history__th {
  background: var(--gold-700, #8c6f2e);
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: 12px 8px;
  letter-spacing: 0.04em;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.price-history__th--date  { width: 30%; }
.price-history__th--price { width: 45%; }
.price-history__th--diff  { width: 25%; }

.price-history__td {
  padding: 12px 10px;
  border-bottom: 1px solid #f0e8d4;
  text-align: center;
}

.price-history__row:nth-child(odd) {
  background: #fafaf7;
}

.price-history__row:last-child .price-history__td {
  border-bottom: 0;
}

.price-history__row--empty .price-history__empty {
  text-align: center;
  padding: 40px 20px;
  color: #888;
  font-size: 14px;
}

/* ============================================================
   スケルトンローディング (初期表示)
============================================================ */

.price-history__row--skeleton .price-history__td {
  padding: 14px 10px;
}

.price-history__skel {
  display: inline-block;
  width: 80%;
  height: 14px;
  background: linear-gradient(90deg, #f0e8d4 0%, #faf5e3 50%, #f0e8d4 100%);
  background-size: 200% 100%;
  border-radius: 3px;
  animation: priceHistorySkel 1.4s ease-in-out infinite;
}

.price-history__row--skeleton:nth-child(odd) .price-history__skel {
  width: 70%;
}
.price-history__row--skeleton:nth-child(even) .price-history__skel {
  width: 85%;
}

@keyframes priceHistorySkel {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 読み込み中のテーブル全体の見た目を少し抑える */
.price-history__table[data-state="loading"] {
  opacity: 0.85;
}


.price-history__td--date {
  font-weight: 600;
  color: var(--ink-2, #2a3450);
  font-family: 'Noto Sans JP', var(--sans, sans-serif);
  font-size: 13px;
}

.price-history__td--price {
  font-weight: 700;
}

.price-history__price-num {
  font-size: 16px;
  color: var(--gold-700, #8c6f2e);
  font-family: 'Noto Sans JP', var(--sans, sans-serif);
}

.price-history__price-unit {
  font-size: 11px;
  color: #888;
  margin-left: 2px;
}

.price-history__td--diff {
  font-weight: 700;
  font-size: 13px;
  font-family: 'Noto Sans JP', var(--sans, sans-serif);
}

.price-history__td--diff.is-up {
  color: #c0392b;  /* 値上がり: 赤 (日本式) */
}

.price-history__td--diff.is-down {
  color: #2980b9;  /* 値下がり: 青 (日本式) */
}

.price-history__td--diff.is-zero {
  color: #888;
}

/* ============================================================
   「もっと見る」ボタン
============================================================ */

.price-history__more-wrap {
  text-align: center;
}

.price-history__more-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: #fff;
  color: var(--gold-700, #8c6f2e);
  border: 2px solid var(--gold-500, #c9a961);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.price-history__more-btn:hover:not(:disabled) {
  background: var(--gold-500, #c9a961);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(201, 169, 97, 0.25);
}

.price-history__more-btn:disabled {
  background: #f5f5f5;
  color: #999;
  border-color: #ddd;
  cursor: not-allowed;
}

.price-history__more-btn-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.15s;
}

.price-history__more-btn:disabled .price-history__more-btn-icon {
  opacity: 0.4;
}

.price-history__more-btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.price-history__more-btn-loading::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: priceHistorySpin 0.6s linear infinite;
}

@keyframes priceHistorySpin {
  to { transform: rotate(360deg); }
}

.price-history__more-note {
  text-align: center;
  font-size: 12px;
  color: #888;
  margin: 10px 0 0;
}


/* ============================================================
   レスポンシブ
============================================================ */

@media (max-width: 768px) {
  .price-history__table {
    font-size: 13px;
  }
  .price-history__th,
  .price-history__td {
    padding: 10px 6px;
  }
  .price-history__price-num {
    font-size: 14px;
  }
  .price-history__td--diff {
    font-size: 12px;
  }
  .price-history__more-btn {
    padding: 12px 20px;
    font-size: 13px;
    width: 100%;
    max-width: 360px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .price-history__th--date  { width: 32%; }
  .price-history__th--price { width: 40%; }
  .price-history__th--diff  { width: 28%; }
  .price-history__td--date {
    font-size: 11px;
  }
}
