/**
 * allrank.css
 * 歴代総合ポイントページ専用スタイル
 * rankin_top.cssをベースに調整
 */

/* モバイル専用要素（デフォルトは非表示） */
.sidebar-mobile-header {
  display: none;
}

.mobile-filter-btn {
  display: none;
}

.page-top-btn {
  display: none;
}

.sidebar-overlay {
  display: none;
}

/* コンテナ */
.allrank-container {
  display: flex;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

/* サイドバー */
.allrank-sidebar {
  flex: 0 0 220px;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 0.9rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid #ddd;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-list li {
  margin-bottom: 0.3rem;
}

.sidebar-list a {
  display: block;
  padding: 0.5rem 0.8rem;
  color: #007bff;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.2s;
}

.sidebar-list a:hover {
  background: #f0f0f0;
}

.sidebar-list a.active {
  background: #007bff;
  color: #fff;
  font-weight: bold;
}

.sidebar-description {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.6;
  margin: 0 0 0.8rem 0;
}

/* メインコンテンツ */
.allrank-main {
  flex: 1;
  min-width: 0;
}

.allrank-title {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.allrank-description {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 1rem;
}

.allrank-stats {
  font-size: 0.9rem;
  color: #777;
  margin-bottom: 1.5rem;
}

.no-data-message {
  text-align: center;
  color: #999;
  padding: 3rem;
  background: #f9f9f9;
  border-radius: 8px;
}

/* カード一覧 */
.allrank-items {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* 個別カード */
.allrank-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  transition: box-shadow 0.2s, background 0.2s;
}

.allrank-card:hover {
  background: #fafafa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.allrank-card.deleted {
  opacity: 0.6;
  background: #f5f5f5;
}

/* 順位バッジ */
.card-rank {
  flex: 0 0 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #6c757d;
  color: #fff;
  font-weight: bold;
  font-size: 1rem;
  border-radius: 50%;
}

/* 1〜3位は特別色 */
.card-rank.rank-1 {
  background: linear-gradient(135deg, #ffd700 0%, #ffb300 100%);
  color: #333;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.card-rank.rank-2 {
  background: linear-gradient(135deg, #c0c0c0 0%, #a0a0a0 100%);
  color: #333;
  box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.card-rank.rank-3 {
  background: linear-gradient(135deg, #cd7f32 0%, #a0522d 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

/* サムネイル */
.card-thumb {
  flex: 0 0 130px;
  height: 73px;
  position: relative;
}

.card-thumb a {
  position: relative;
  display: block;
  width: 130px;
  height: 73px;
}

.thumb-placeholder {
  width: 130px;
  height: 73px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 0.8rem;
}

/* JSで挿入される画像用スタイル */
.card-thumb img,
.card-thumb a img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  border-radius: 4px;
}

.deleted-thumb {
  background: #ccc;
  color: #666;
}

/* カード情報 */
.card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-main {
  flex: 1;
}

.card-title {
  font-size: 0.95rem;
  margin: 0 0 0.4rem 0;
  line-height: 1.4;
}

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

.card-title a:hover {
  color: #007bff;
  text-decoration: underline;
}

.card-title.deleted-title {
  color: #999;
  text-decoration: line-through;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.8rem;
  color: #777;
}

.meta-date {
  color: #999;
}

.meta-source {
  color: #555;
}

.meta-source a {
  color: #007bff;
  text-decoration: none;
}

.meta-source a:hover {
  text-decoration: underline;
}

.meta-source strong {
  color: #dc3545;
}

.meta-link {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
}

.meta-link:hover {
  text-decoration: underline;
}

/* 投稿者情報 */
.card-uploader {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #eee;
}

.card-uploader.deleted-uploader {
  opacity: 0.7;
}

.uploader-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #555;
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s;
}

.uploader-link:hover {
  color: #007bff;
}

.uploader-icon,
.uploader-icon-placeholder {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  background: #e0e0e0;
  flex-shrink: 0;
}

.uploader-name {
  font-weight: 500;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 総合ポイント（右端に大きく表示） */
.card-point {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  color: #fff;
  min-width: 80px;
}

.point-number {
  font-size: 1.3rem;
  font-weight: bold;
  line-height: 1;
}

.point-label {
  font-size: 0.65rem;
  margin-top: 0.2rem;
  opacity: 0.9;
}

/* ページネーション */
.allrank-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #eee;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.8rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #007bff;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.pagination-link:hover {
  background: #f0f0f0;
  border-color: #ccc;
}

.pagination-current {
  background: #007bff;
  border-color: #007bff;
  color: #fff;
  font-weight: bold;
}

/* レスポンシブ */
@media (max-width: 900px) {
  .allrank-container {
    flex-direction: column;
  }
  
  .allrank-sidebar {
    position: static;
    flex: none;
    max-height: none;
  }
}

/* ===========================================
 * スマホ対応（768px以下）
 * =========================================== */
@media (max-width: 768px) {
  /* コンテナ */
  .allrank-container {
    flex-direction: column;
    padding: 0.5rem;
  }
  
  /* サイドバーをモーダル風に */
  .allrank-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: white;
    z-index: 1002;
    overflow-y: auto;
    transition: left 0.3s ease-in-out;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
  }
  
  .allrank-sidebar.active {
    left: 0;
  }
  
  /* モバイル用：閉じるボタン */
  .sidebar-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ddd;
  }
  
  .sidebar-mobile-title {
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;
  }
  
  .sidebar-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
  }
  
  .sidebar-close-btn:active {
    transform: scale(0.95);
  }
  
  /* オーバーレイ */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
  }
  
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }
  
  /* 種別切替ボタン（右下） */
  .mobile-filter-btn {
    display: flex !important;
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 1000;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
  }
  
  .mobile-filter-btn:hover {
    background: #5568d3;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
  }
  
  .mobile-filter-btn:active {
    transform: scale(0.95);
  }
  
  /* 上に戻るボタン（右下） */
  .page-top-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 123, 255, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, background 0.2s;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  
  .page-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
  }
  
  .page-top-btn:hover {
    background: rgba(0, 123, 255, 1);
  }
  
  /* メインコンテンツ */
  .allrank-main {
    width: 100%;
  }
  
  .allrank-title {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
  }
  
  .allrank-description {
    font-size: 0.9rem;
  }
  
  /* カード */
  .allrank-card {
    flex-wrap: wrap;
    gap: 0.8rem;
    padding: 0.8rem;
  }
  
  /* 順位バッジ（スマホで小さく） */
  .card-rank {
    flex: 0 0 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  
  /* サムネイル */
  .card-thumb {
    flex: 0 0 100px;
    height: 56px;
  }
  
  .card-thumb a {
    width: 100px;
    height: 56px;
  }
  
  .thumb-placeholder {
    width: 100px;
    height: 56px;
    font-size: 0.7rem;
  }
  
  /* カード情報 */
  .card-info {
    flex: 1;
    min-width: 0;
  }
  
  .card-title {
    font-size: 0.9rem;
  }
  
  .card-meta {
    font-size: 0.75rem;
    gap: 0.5rem;
  }
  
  /* 総合ポイント */
  .card-point {
    min-width: 70px;
    padding: 0.4rem 0.8rem;
  }
  
  .point-number {
    font-size: 1.1rem;
  }
  
  .point-label {
    font-size: 0.6rem;
  }
  
  /* 投稿者情報 */
  .card-uploader {
    flex-basis: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }
  
  .uploader-name {
    max-width: none;
  }
  
  /* ページネーション */
  .allrank-pagination {
    gap: 0.3rem;
  }
  
  .pagination-link {
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  /* カードを縦並びに */
  .allrank-card {
    flex-direction: column;
    align-items: stretch;
  }
  
  /* 上段：順位とポイントを横並び */
  .allrank-card > .card-rank,
  .allrank-card > .card-point {
    display: inline-flex;
  }
  
  /* 順位とポイントをまとめる上段 */
  .allrank-card {
    position: relative;
  }
  
  .card-rank {
    position: absolute;
    top: 0.8rem;
    left: 0.8rem;
    z-index: 2;
  }
  
  .card-point {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    z-index: 2;
  }
  
  /* サムネイルを横幅いっぱいに */
  .card-thumb {
    flex: none;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    margin-top: 3rem;
  }
  
  .card-thumb a {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
  
  .thumb-placeholder {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
  
  /* カード情報 */
  .card-info {
    width: 100%;
  }
}
