/* ===========================
 * Category Filter — Sub (child)
 * =========================== */
.cat-filter-wrap {
  margin-bottom: 40px;
}

.cat-filter-wrap .cat-filter {
  margin-bottom: 0;
}

.cat-filter--sub {
  margin-top: 10px;
  padding-left: 0;
}

@media (max-width: 768px) {
  .cat-filter--sub {
    border-left: none;
    padding-left: 0;
    border-top: 2px solid var(--color-secondary);
    padding-top: 10px;
    margin-top: 8px;
  }
}

.cat-filter__item--sub {
  font-size: 0.8rem;
  padding: 6px 16px;
}

/* ===========================
 * Match Summary Stats Bar
 * =========================== */
.match-summary {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 48px;
  box-shadow: var(--shadow-card);
  animation: fadeSlideUp 0.5s ease both;
}

.match-summary__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  background: var(--color-white);
}

.match-summary__num {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-primary);
}

.match-summary__item--win .match-summary__num { color: var(--color-secondary); }
.match-summary__item--loss .match-summary__num { color: #d32f2f; }
.match-summary__item--draw .match-summary__num { color: #f9a825; }

.match-summary__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-light);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ===========================
 * Match Row
 * =========================== */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.match-row {
  display: grid;
  grid-template-columns: 4px 130px 140px 1fr 160px;
  align-items: center;
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
  animation: fadeSlideUp 0.5s ease both;
}

.match-row:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Result bar — left color stripe */
.match-row__result-bar {
  width: 4px;
  height: 100%;
  min-height: 80px;
}

.match-row--win .match-row__result-bar { background: var(--color-secondary); }
.match-row--draw .match-row__result-bar { background: #f9a825; }
.match-row--loss .match-row__result-bar { background: #d32f2f; }

/* Date */
.match-row__date {
  padding: 16px 20px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.match-row__date-main {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.02em;
}

.match-row__date-dow {
  font-size: 0.75rem;
  color: var(--color-text-light);
  font-weight: 500;
}

/* Competition */
.match-row__comp {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.match-row__comp-badge {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-secondary);
  letter-spacing: 0.03em;
}

.match-row__comp-round {
  font-size: 0.75rem;
  color: var(--color-text-light);
  padding-left: 2px;
}

/* Teams + Score (center) */
.match-row__teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 12px;
}

.match-row__team {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
}

.match-row__team--home {
  text-align: right;
}

.match-row__team--away {
  text-align: left;
}

.match-row__team--own {
  font-weight: 700;
  color: var(--color-primary);
}

.match-row__score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 80px;
}

.match-row__score-badge {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 10px;
  border-radius: var(--radius);
  color: #fff;
}

.match-row__score-badge--win { background: var(--color-secondary); }
.match-row__score-badge--draw { background: #f9a825; color: var(--color-primary); }
.match-row__score-badge--loss { background: #d32f2f; }

.match-row__score-num {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.05em;
}

/* Venue */
.match-row__venue {
  padding: 16px 20px;
  font-size: 0.8rem;
  color: var(--color-text-light);
  text-align: right;
}

/* ===========================
 * Responsive
 * =========================== */
@media (max-width: 1024px) {
  .match-row {
    grid-template-columns: 4px 110px 120px 1fr 130px;
  }
}

@media (max-width: 768px) {
  .match-summary {
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 32px;
  }

  .match-row {
    grid-template-columns: 4px 1fr;
    grid-template-rows: auto auto auto;
    gap: 0;
    padding: 0;
  }

  .match-row__result-bar {
    grid-row: 1 / -1;
    min-height: auto;
  }

  .match-row__date {
    grid-column: 2;
    padding: 12px 16px 4px;
  }

  .match-row__comp {
    grid-column: 2;
    padding: 0 16px 8px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .match-row__teams {
    grid-column: 2;
    padding: 8px 16px;
    gap: 10px;
  }

  .match-row__team {
    font-size: 0.85rem;
  }

  .match-row__score-num {
    font-size: 1.25rem;
  }

  .match-row__venue {
    grid-column: 2;
    text-align: left;
    padding: 0 16px 12px;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .match-summary {
    grid-template-columns: repeat(3, 1fr);
  }

  .match-summary__num {
    font-size: 1.5rem;
  }

  .match-summary__item {
    padding: 16px 8px;
  }
}

/* ===========================
 * 試合情報ページ — タブ切替
 * =========================== */
.match-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  border-bottom: 2px solid var(--color-border);
  animation: fadeSlideUp 0.5s ease both;
}

.match-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-light);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.match-tab:hover {
  color: var(--color-primary);
}

.match-tab--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-secondary);
}

.match-tab svg {
  flex-shrink: 0;
}

/* ===========================
 * フィルター群（カテゴリー＋年度）
 * =========================== */
.match-filters {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

/* cat-filter のラッパー（.cat-filter-group / .cat-filter-wrap 両対応）を
   flex item として幅制約し、内部の overflow-x: auto を有効化 */
.match-filters .cat-filter-group,
.match-filters .cat-filter-wrap {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 0;
}

.match-filters .cat-filter {
  margin-bottom: 0;
}

/* モバイル時のカテゴリーバー余白調整
   archive.css の margin-inline:-20px（エッジブリード）は維持しつつ、
   padding を増やして見た目の左右余白を確保する。
   親タブ・子タブ両方で同じ 20px の余白に揃える。
   これにより「スクロールすると画面端で見切れる」挙動を保ちながら、
   初期表示時は左右に余白が見える状態になる。 */
@media (max-width: 768px) {
  .match-filters .cat-filter--primary,
  .match-filters .cat-filter--sub {
    padding-inline: 20px;
  }
}

.match-year-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 4px;
}

.match-year-filter__label {
  font-size: 0.85rem;
  color: var(--color-text-light);
  font-weight: 600;
}

.match-year-filter__select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 36px 8px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23777' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s;
}

.match-year-filter__select:hover,
.match-year-filter__select:focus {
  border-color: var(--color-secondary);
  outline: none;
}

/* ===========================
 * 試合カードグリッド（2列レイアウト）
 * =========================== */
.match-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 48px;
  animation: fadeSlideUp 0.5s ease both;
}

.match-card-grid__item {
  animation: fadeSlideUp 0.5s ease both;
}

/* カードの最大幅を解除してグリッド内にフィット */
.match-card-grid .match-result-card,
.match-card-grid .next-match-card {
  max-width: none;
  height: 100%;
}

/* 試合予定カード特有の調整 */
.match-card-grid--upcoming .next-match-card {
  display: flex;
  flex-direction: column;
}

.match-card-grid--upcoming .next-match-card__body {
  flex: 1;
}

/* ===========================
 * 空状態
 * =========================== */
.archive-empty {
  text-align: center;
  padding: 64px 24px;
  animation: fadeSlideUp 0.5s ease both;
}

.archive-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(var(--color-primary-rgb), 0.06);
  color: var(--color-primary);
  margin-bottom: 16px;
}

.archive-empty__text {
  font-size: 1rem;
  color: var(--color-text-light);
  margin-bottom: 24px;
}

/* ===========================
 * レスポンシブ
 * =========================== */
@media (max-width: 900px) {
  .match-card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .match-tabs {
    gap: 0;
  }

  .match-tab {
    flex: 1;
    justify-content: center;
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .match-tab svg {
    width: 16px;
    height: 16px;
  }

  .match-filters {
    gap: 16px;
  }

  .match-year-filter {
    width: 100%;
  }

  .match-year-filter__select {
    flex: 1;
  }
}
