/* ===========================================
 * Ranking - ランキングページ固有スタイル
 * ランキングヘッダー、リスト、アイテム、統計表示
 * =========================================== */

/* ===========================================
 * ランキングヘッダー
 * =========================================== */
.ranking-header {
  background: #4a6fa5;
  color: #fff;
  padding: 12px 16px;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.ranking-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: bold;
}

.ranking-header.sp-header {
  background: linear-gradient(135deg, #d63384 0%, #9b2d70 100%);
}

/* 計算式情報 */
.formula-info {
  background: #fff;
  border: 1px solid var(--border-color);
  border-top: none;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===========================================
 * ランキングリスト
 * =========================================== */
.ranking-list {
  background: #fff;
  border: 1px solid var(--border-color);
  border-top: none;
}

.rank-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  gap: 12px;
}

.rank-item:last-child {
  border-bottom: none;
}

.rank-item:hover {
  background: #fafafa;
}

/* ===========================================
 * 順位エリア
 * =========================================== */
.rank-left {
  width: 70px;
  flex-shrink: 0;
  text-align: center;
}

.rank-number {
  font-size: 28px;
  font-weight: bold;
  line-height: 1.1;
}

.rank-number .unit {
  font-size: 14px;
  font-weight: normal;
}

.category-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: keep-all;
}

.category-rank {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: keep-all;
}

.category-rank a {
  color: inherit;
}

/* ===========================================
 * サムネイルエリア
 * =========================================== */
.rank-thumb {
  width: 130px;
  flex-shrink: 0;
  position: relative;
}

.rank-thumb a {
  display: block;
  position: relative;
}

.rank-thumb img,
.rank-thumb .thumb-placeholder {
  width: 130px;
  height: 73px;
  object-fit: cover;
  border-radius: 4px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 11px;
}

.thumb-duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 2px 4px;
  border-radius: 2px;
  font-size: 11px;
  z-index: 2;
}

/* ===========================================
 * メイン情報エリア
 * =========================================== */
.rank-main {
  flex: 1;
  min-width: 0;
}

.rank-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 6px;
  line-height: 1.4;
}

.rank-title a {
  color: var(--link-color);
}

.rank-title a:hover {
  text-decoration: underline;
}

.rank-title .external-icon {
  font-size: 11px;
  color: #999;
  margin-left: 4px;
}

/* ===========================================
 * 統計情報
 * =========================================== */
.rank-stats {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 前回順位 */
.prev-rank {
  font-size: 13px;
  font-weight: bold;
}

.prev-rank.new {
  color: var(--new-color);
}

.prev-rank.up {
  color: var(--success-color);
}

.prev-rank.down {
  color: #999;
}

.prev-rank.stay {
  color: #666;
}

.total-point {
  font-size: 15px;
  font-weight: bold;
  color: var(--text-color);
}

.detail-btn {
  display: inline-block;
  padding: 4px 10px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-color);
  cursor: pointer;
}

.detail-btn:hover {
  background: #e0e0e0;
  text-decoration: none;
}

/* 統計グリッド */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  font-size: 13px;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-icon {
  font-size: 12px;
}

.stat-icon.play { color: #333; }
.stat-icon.comment { color: #f90; }
.stat-icon.mylist { color: #06c; }
.stat-icon.like { color: #e33; }

.stat-rank {
  font-weight: bold;
}

.stat-count {
  color: var(--text-muted);
}

.stat-ratio {
  color: #999;
  font-size: 11px;
}

/* ===========================================
 * 投稿者エリア
 * =========================================== */
.rank-right {
  width: 140px;
  flex-shrink: 0;
  text-align: right;
}

.uploader-info {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.uploader-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e0e0e0;
  object-fit: cover;
}

.uploader-icon-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e0e0e0;
}

.uploader-name {
  font-size: 12px;
  color: var(--text-color);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploader-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.upload-date {
  font-size: 11px;
  color: var(--text-muted);
}

.upload-date-short {
  font-size: 11px;
  color: var(--text-muted);
}

.detail-btn-link {
  display: inline-block;
  margin-top: 8px;
  text-decoration: none;
}

.detail-btn-link:hover {
  text-decoration: none;
}

/* スマホ用の投稿者情報 */
.rank-mobile-info {
  display: none;
}

.mobile-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

/* ===========================================
 * スマホ用：詳細折り畳み
 * =========================================== */
.mobile-details-toggle {
  display: none; /* PC版では非表示 */
}

.rank-item-details {
  display: none; /* デフォルトで非表示 */
}

.rank-item.is-open .rank-item-details {
  display: block; /* 開いた時に表示 */
}