@charset "UTF-8";

/*!
Theme Name: Cocoon Child
Description: Cocoon専用の子テーマ
Theme URI: https://wp-cocoon.com/
Author: わいひら
Author URI: https://nelog.jp/
Template:   cocoon-master
Version:    1.1.3
*/

/************************************
** 子テーマ用のスタイルを書く
************************************/
/*必要ならばここにコードを書く*/

/**
 * TCG価格比較システム - 追加スタイル
 * 配置場所: /wp-content/themes/cocoon-child/style.css に追記
 */

/* ==================================================
   共通スタイル
   ================================================== */

.tcg-page {
    --tcg-primary: #007bff;
    --tcg-secondary: #6c757d;
    --tcg-success: #28a745;
    --tcg-danger: #dc3545;
    --tcg-warning: #ffc107;
    --tcg-info: #17a2b8;
    --tcg-light: #f8f9fa;
    --tcg-dark: #343a40;
}

/* ==================================================
   エラーコンテナ
   ================================================== */

.tcg-error-container {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================================================
   ランキングコントロール
   ================================================== */

.tcg-ranking-controls {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ranking-type-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ranking-type-btn:hover:not(.loading) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

.ranking-type-btn:active {
    transform: translateY(0);
}

/* ==================================================
   ランキングテーブル
   ================================================== */

.tcg-ranking-table-container {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ranking-row {
    transition: background-color 0.2s ease;
}

.ranking-row:hover {
    background: #f8f9fa !important;
}

/* ==================================================
   統計ボックス
   ================================================== */

.stat-box {
    transition: all 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
}

/* ==================================================
   ページネーション
   ================================================== */

.page-btn {
    transition: all 0.2s ease;
}

.page-btn:hover {
    transform: scale(1.05);
}

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

@media (max-width: 768px) {
    .tcg-ranking-controls {
        padding: 15px;
    }
    
    .ranking-type-btn {
        font-size: 13px;
        padding: 10px 15px;
    }
    
    .stat-box {
        padding: 20px !important;
    }
    
    .stat-box > div:first-child {
        font-size: 12px !important;
    }
    
    .stat-box > div:last-child {
        font-size: 22px !important;
    }
}

@media (max-width: 480px) {
    .tcg-ranking-controls {
        padding: 10px;
    }
    
    .ranking-type-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* ==================================================
   ローディングアニメーション
   ================================================== */

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--tcg-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* ==================================================
   印刷用スタイル
   ================================================== */

@media print {
    .tcg-ranking-controls,
    .tcg-advertisement,
    .tcg-rakuten-section {
        display: none !important;
    }
    
    .tcg-ranking-table-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .ranking-row {
        page-break-inside: avoid;
    }
}

/* ==================================================
   アクセシビリティ
   ================================================== */

.ranking-type-btn:focus,
.period-select:focus,
.metric-select:focus,
.option-select:focus {
    outline: 3px solid var(--tcg-primary);
    outline-offset: 2px;
}

/* ハイコントラストモード対応 */
@media (prefers-contrast: high) {
    .tcg-ranking-controls {
        border: 2px solid #000;
    }
    
    .ranking-type-btn {
        border: 2px solid #000;
    }
}

/* ダークモード対応（オプション） */
@media (prefers-color-scheme: dark) {
    .tcg-page {
        --tcg-light: #343a40;
        --tcg-dark: #f8f9fa;
    }
    
    .tcg-ranking-controls,
    .tcg-ranking-table-container {
        background: #2b2b2b;
        color: #e0e0e0;
    }
    
    .ranking-row:hover {
        background: #3a3a3a !important;
    }
}

/************************************
** レスポンシブデザイン用のメディアクエリ
************************************/
/*1023px以下*/
@media screen and (max-width: 1023px){
  /*必要ならばここにコードを書く*/
}

/*834px以下*/
@media screen and (max-width: 834px){
  /*必要ならばここにコードを書く*/
}

/*480px以下*/
@media screen and (max-width: 480px){
  /*必要ならばここにコードを書く*/
}

/* ==========================================================
 * トレカプライス共通スタイル
 * ========================================================== */


/* ----------------------------------------------------------
 * ページ上部へ戻るボタン
 * ---------------------------------------------------------- */

#top-button {
  position: fixed;
  right: 5px;
  bottom: 55px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #444;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.3s;
}

#top-button:hover {
  background-color: #666;
  color: #fff;
  text-decoration: none;
}


/* ----------------------------------------------------------
 * ランダム広告
 * inc/shortcode-random-ad.php
 * ---------------------------------------------------------- */

.ad-box {
  margin: 24px 0;
  padding: 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #f5f5f5;
  font-size: 1rem;
}

.ad-box h4 {
  margin-bottom: 8px;
  color: #333;
  font-size: 1.2rem;
}

.ad-box p {
  margin-bottom: 12px;
  color: #555;
}

.ad-box .ad-button {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 4px;
  background-color: #007bff;
  color: #fff;
  text-decoration: none;
  transition: background-color 0.3s;
}

.ad-box .ad-button:hover {
  background-color: #0056b3;
  color: #fff;
  text-decoration: none;
}


/* ----------------------------------------------------------
 * 価格サマリー
 * inc/price_summary.php
 * ---------------------------------------------------------- */

.card-price-summary {
  margin-top: 2em;
  padding: 1.5em;
  border-radius: 8px;
  background-color: #f4f8ff;
}

.card-price-summary h3 {
  margin-bottom: 1em;
  font-size: 1.4em;
}

.card-price-summary .price-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
}

.card-price-summary .price-box {
  min-width: 0;
  padding: 1em;
  border: 1px solid #ddd;
  border-radius: 6px;
  background-color: #fff;
  text-align: center;
}

.card-price-summary .price-box .label {
  color: #444;
  font-size: 14px;
  font-weight: 700;
}

.card-price-summary .price-box .price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 0.3em;
  font-size: 16px;
}

.card-price-summary .diff {
  margin-left: 4px;
  color: #888;
  font-size: 0.9em;
  vertical-align: middle;
}

.card-price-summary .lowest,
.card-price-summary .lowest .diff {
  color: #007700;
}

.card-price-summary .highest,
.card-price-summary .highest .diff {
  color: #aa0000;
}


/* ----------------------------------------------------------
 * 汎用配置
 * ---------------------------------------------------------- */

.img-center {
  display: block;
  margin-right: auto;
  margin-left: auto;
}

.right-align {
  text-align: right;
}

.center-align {
  text-align: center;
}


/* ----------------------------------------------------------
 * WordPress価格テーブル
 * wp_table.py
 * ---------------------------------------------------------- */

.tcg-price-table-group {
  width: 100%;
}

.tcg-price-table-group .right-align {
  text-align: right;
}

.tcg-price-table-group .center-align {
  text-align: center;
}

.tcg-price-table-group .comparison-positive {
  color: red;
}

.tcg-price-table-group .comparison-negative {
  color: blue;
}

.tcg-price-table-group .comparison-neutral {
  color: green;
}


/* お気に入り追加・削除ボタン */

.tcg-price-table-group .add-btn,
.tcg-price-table-group .delete-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.tcg-price-table-group .add-btn {
  margin-right: 5px;
  background-color: #d4edda;
  color: #155724;
}

.tcg-price-table-group .add-btn:hover {
  background-color: #c3e6cb;
}

.tcg-price-table-group .delete-btn {
  background-color: #f8d7da;
  color: #721c24;
}

.tcg-price-table-group .delete-btn:hover {
  background-color: #f1b0b7;
}


/* テーブル本体 */

.tcg-price-table-group .table-wrapper {
  width: 100%;
  overflow: hidden;
}

.tcg-price-table-group table.dataTable {
  width: 100% !important;
  table-layout: fixed !important;
}

.tcg-price-table-group table.dataTable th,
.tcg-price-table-group table.dataTable td {
  min-width: 0 !important;
  max-width: 0;
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.tcg-price-table-group table.dataTable thead th {
  text-align: center !important;
}

.tcg-price-table-group .wrap-column {
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}


/* カード画像 */

.tcg-price-table-group .card-image {
  display: block;
  width: 50px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}


/* ランキング */

.tcg-price-table-group .rank-cell {
  font-weight: 600;
}

.tcg-price-table-group tr.rank-gold > td {
  background-color: rgb(255, 248, 220) !important;
  color: #222 !important;
  font-weight: 700;
}

.tcg-price-table-group tr.rank-silver > td {
  background-color: rgb(245, 245, 245) !important;
  color: #222 !important;
  font-weight: 700;
}

.tcg-price-table-group tr.rank-bronze > td {
  background-color: rgb(255, 244, 232) !important;
  color: #222 !important;
  font-weight: 700;
}


/* 価格・変動表示 */

.tcg-price-table-group .price-low {
  color: blue;
}

.tcg-price-table-group .price-high {
  color: red;
}

.tcg-price-table-group .change-positive {
  color: red;
}

.tcg-price-table-group .change-negative {
  color: blue;
}

.tcg-price-table-group .change-new {
  color: green;
}


/* 補助コンテンツ */

.tcg-price-table-group .no-table-data,
.tcg-price-table-group .statistics-area,
.tcg-price-table-group .graph-img-area {
  margin: 10px 0;
}


/* テーブル切り替えボタン */

.tcg-price-table-group .table-switch-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tcg-price-table-group .table-switch-button {
  min-width: 120px;
  padding: 10px 18px;
  border: 2px solid #4f8fc9;
  border-radius: 10px;
  background-color: #eef7ff;
  color: #245b87;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s,
    transform 0.2s;
}

.tcg-price-table-group .table-switch-button:hover:not(:disabled) {
  background-color: #dbeeff;
  transform: translateY(-1px);
}

.tcg-price-table-group .table-switch-button.active {
  background-color: #4f8fc9;
  color: #fff;
  cursor: default;
  opacity: 1;
}


/* ----------------------------------------------------------
 * スマートフォン表示
 * ---------------------------------------------------------- */

@media screen and (max-width: 768px) {
  .card-price-summary .price-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-price-summary .price-box .label {
    font-size: 12px;
  }

  .card-price-summary .price-box .price {
    font-size: 14px;
  }

  .tcg-price-table-group table.dataTable {
    font-size: 11px;
  }

  .tcg-price-table-group table.dataTable th,
  .tcg-price-table-group table.dataTable td {
    padding: 4px 2px !important;
  }

  .tcg-price-table-group .card-image {
    width: 40px;
  }
}