/**
 * タブ切り替え機能付き記事一覧 - スタイルシート
 * Path: includes/tab-posts/assets/css/tab-posts.css
 */

/* ===============================
   メインコンテナ
================================ */
.custom-post-tabs-container {
  margin: 20px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ===============================
 タブナビゲーション
================================ */
.custom-tabs-nav {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 20px;
  gap: 5px;
  padding: 0;
}

.custom-tab-button {
  background: #f8f9fa;
  border: 1px solid #ddd;
  padding: 12px 20px;
  cursor: pointer;
  border-radius: 5px 5px 0 0;
  transition: all 0.3s ease;
  text-decoration: none;
  color: #333;
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  outline: none;
}

.custom-tab-button:hover {
  background: #e9ecef;
  text-decoration: none;
  color: #333;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.custom-tab-button:focus {
  box-shadow: 0 0 0 3px rgba(0, 123, 186, 0.3);
}

.custom-tab-button.active {
  background: #007cba;
  color: white;
  border-color: #007cba;
  z-index: 1;
}

.custom-tab-button.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: #007cba;
}

.tab-icon {
  font-size: 16px;
}

.tab-text {
  font-weight: 600;
}

.tab-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
}

.custom-tab-button.active .tab-count {
  background: rgba(255, 255, 255, 0.3);
}

/* ===============================
 タブコンテンツ
================================ */
.custom-tabs-content-wrapper {
  position: relative;
}

.custom-tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.custom-tab-content.active {
  display: block;
}

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

/* ===============================
 記事一覧コンテナ
================================ */
.custom-posts-container {
  margin-bottom: 30px;
}

/* グリッドレイアウト */
.custom-posts-container.grid-layout {
  display: grid;
  gap: 20px;
}

.custom-posts-container.grid-layout.columns-1 {
  grid-template-columns: 1fr;
}

.custom-posts-container.grid-layout.columns-2 {
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.custom-posts-container.grid-layout.columns-3 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.custom-posts-container.grid-layout.columns-4 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* リストレイアウト */
.custom-posts-container.list-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===============================
 記事カード
================================ */
.article-card {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  transform: translateY(-3px);
}

/* リストレイアウト時の横並び */
.custom-posts-container.list-layout .article-card {
  flex-direction: row;
  align-items: flex-start;
}

/* ===============================
 記事画像
================================ */
.card-image-link {
  display: block;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.card-image {
  position: relative;
  overflow: hidden;
  background: #f8f9fa;
  height: 160px; /* 横長の固定高さ */
  aspect-ratio: 16/9; /* 16:9の横長比率 */
}

/* リストレイアウト時の画像サイズ */
.custom-posts-container.list-layout .card-image {
  width: 280px;
  height: 160px; /* 横長サイズに統一 */
  aspect-ratio: 16/9;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.article-card:hover .card-image img {
  transform: scale(1.05);
}

/* カテゴリーラベル */
.card-category-label {
  position: absolute;
  top: 12px;
  left: 12px;
  background: linear-gradient(135deg, #007cba, #005a8b);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
  transition: all 0.3s ease;
}

.article-card:hover .card-category-label {
  background: linear-gradient(135deg, #005a8b, #007cba);
  transform: scale(1.05);
}

/* ===============================
 記事コンテンツ
================================ */
.card-content {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* タイトル */
.card-title {
  margin: 0 0 15px 0;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 700;
  flex-grow: 1;
}

.card-title a {
  color: #333;
  text-decoration: none;
  transition: color 0.3s ease;
}

.card-title a:hover {
  color: #007cba;
}

/* 日付情報 */
.card-dates {
  display: flex;
  gap: 8px;
  font-size: 13px;
}

.date-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #666;
}

.date-item .fa {
  color: #999;
  font-size: 12px;
  width: 14px;
  text-align: center;
}

.date-value {
  font-weight: 500;
}

.posted-date {
  color: #666;
}

.updated-date {
  color: #4caf50;
  font-size: 12px;
}

/* 抜粋 */
.card-excerpt {
  color: #666;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 15px 0;
  flex-grow: 1;
}

/* リストレイアウト用の追加情報 */
.card-meta-extra {
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.card-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}

.author-label {
  color: #999;
}

.author-name {
  color: #333;
  font-weight: 600;
}

.card-read-more {
  text-align: left;
}

.read-more-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #007cba;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
}

.read-more-button:hover {
  color: #005a8b;
  text-decoration: none;
}

.read-more-arrow {
  transition: transform 0.3s ease;
}

.read-more-button:hover .read-more-arrow {
  transform: translateX(3px);
}

/* ===============================
 記事が見つからない場合
================================ */
.custom-no-posts {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  background: #f8f9fa;
  border-radius: 12px;
  margin: 20px 0;
}

.no-posts-icon {
  font-size: 48px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.custom-no-posts h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 20px;
}

.custom-no-posts p {
  margin: 0;
  font-style: italic;
}

.custom-no-categories {
  text-align: center;
  padding: 20px;
  color: #666;
  font-style: italic;
}

/* ===============================
 ページネーション
================================ */
.custom-pagination {
  margin: 40px 0;
  text-align: center;
}

.pagination-info {
  margin-bottom: 15px;
}

.pagination-text {
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

.pagination-list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination-item {
  margin: 0;
}

.pagination-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 15px;
  border: 1px solid #ddd;
  text-decoration: none;
  color: #333;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
  min-width: 44px;
  justify-content: center;
  background: white;
}

.pagination-link:hover {
  background: #007cba;
  color: white;
  border-color: #007cba;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 186, 0.3);
}

.pagination-link.current {
  background: #007cba;
  color: white;
  border-color: #007cba;
  box-shadow: 0 4px 12px rgba(0, 123, 186, 0.3);
}

.pagination-dots {
  padding: 10px 8px;
  color: #999;
  font-weight: bold;
}

.pagination-icon {
  font-size: 16px;
}

/* ===============================
 レスポンシブデザイン
================================ */
@media (max-width: 768px) {
  .custom-tabs-nav {
      flex-direction: column;
      gap: 8px;
  }
  
  .custom-tab-button {
      border-radius: 8px;
      justify-content: center;
      padding: 15px 20px;
  }
  
  .custom-posts-container.grid-layout {
      grid-template-columns: 1fr;
  }
  
  /* 記事カード - モバイル対応 */
  .custom-posts-container.list-layout .article-card {
      flex-direction: column;
  }
  
  .custom-posts-container.list-layout .card-image {
      width: 100%;
      height: 180px; /* モバイルでも横長を維持 */
      aspect-ratio: 16/9;
  }
  
  .card-content {
      padding: 15px;
  }
  
  .card-title {
      font-size: 16px;
  }
  
  .card-dates {
      gap: 15px;
  }
  
  .date-item {
      font-size: 12px;
  }
  
  .pagination-list {
      gap: 4px;
  }
  
  .pagination-link {
      padding: 8px 12px;
      font-size: 14px;
      min-width: 40px;
  }
  
  .pagination-text {
      display: none;
  }
  
  .pagination-item.first,
  .pagination-item.last {
      display: none;
  }
}

@media (max-width: 480px) {
  .custom-post-tabs-container {
      margin: 15px 0;
  }
  
  .card-content {
      padding: 12px;
  }
  
  .card-title {
      font-size: 15px;
  }
  
  .card-excerpt {
      font-size: 13px;
  }
  
  .card-dates {
      gap: 6px;
  }
  
  .date-item {
      font-size: 11px;
  }
  
  .card-image {
      height: 160px; /* 小さい画面でも横長を維持 */
      aspect-ratio: 16/9;
  }
  
  .card-category-label {
      font-size: 10px;
      padding: 3px 10px;
  }
  
  .pagination-link {
      padding: 6px 10px;
      min-width: 36px;
  }
}

/* ===============================
 アクセシビリティ
================================ */
@media (prefers-reduced-motion: reduce) {
  .custom-post-item,
  .custom-tab-button,
  .pagination-link,
  .custom-post-image img {
      transition: none;
  }
  
  .custom-tab-content {
      animation: none;
  }
}

/* ハイコントラストモード対応 */
@media (prefers-contrast: high) {
  .custom-post-item {
      border-color: #000;
  }
  
  .custom-tab-button {
      border-color: #000;
  }
  
  .custom-tab-button.active {
      background: #000;
      color: #fff;
  }
}