/**
 * TopPage New UI Styles
 * 新UIトップページ用スタイル
 */

/* メインコンテンツ */
.toppage-new {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
}

/* === 最近の更新セクション === */
.recent-updates-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.recent-updates-section h2 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #333;
    font-size: 1.3rem;
}

/* タブナビゲーション */
.update-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #e8e8e8;
}

.tab-btn.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* 更新リスト */
.update-list {
    max-height: 500px;
    overflow-y: auto;
}

.update-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

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

.update-date {
    min-width: 50px;
    color: #888;
    font-size: 0.85rem;
}

.update-icon {
    min-width: 30px;
    text-align: center;
    font-size: 1rem;
}

.update-player {
    flex-shrink: 0;
}

.update-player a {
    color: #333;
    font-weight: bold;
    text-decoration: none;
}

.update-player a:hover {
    text-decoration: underline;
    color: #0066cc;
}

.update-team {
    color: #666;
    font-size: 0.85rem;
    margin-left: 5px;
    flex-shrink: 0;
}

.update-content {
    color: #888;
    font-size: 0.85rem;
    margin-left: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === セクション別表示 === */
.update-section-block {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.update-section-block:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.section-block-title {
    margin: 0 0 12px 0;
    font-size: 1rem;
}

.section-grid {
    grid-template-columns: repeat(3, 1fr) !important;
}

@media screen and (max-width: 1024px) {
    .section-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media screen and (max-width: 768px) {
    .section-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media screen and (max-width: 480px) {
    .section-grid {
        grid-template-columns: 1fr !important;
    }
}

/* === ニュースリストレイアウト === */
.news-list-f {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.news-item-f {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    align-items: flex-start;
}

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

.news-item-f:hover {
    background: #f9fafb;
}

.news-body-f {
    flex: 1;
    min-width: 0;
}

/* 1行目: 日付 + 選手名 + チーム名 */
.news-player-line-f {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.news-date-f {
    font-size: 0.85rem;
    color: #6b7280;
    flex-shrink: 0;
}

.news-player-name-f {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
}

.news-team-f {
    font-size: 0.85rem;
    color: #6b7280;
}

/* 2行目: ソースバッジ + 記事タイトル */
.news-article-line-f {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding-left: 2px;
}

.news-source-badge-f {
    display: inline-block;
    padding: 1px 6px;
    background: #10b981;
    border-radius: 3px;
    font-size: 0.7rem;
    color: #fff;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}

.news-title-f {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #4b5563;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* OGP画像（右端に小さく表示） */
.news-thumb-f {
    width: 64px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f3f4f6;
}

/* カードフッター評価ドーナツ */
.card-footer-score-f {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.card-footer-score-f .score-value {
    font-size: 0.7rem;
    font-weight: 600;
}

/* もっと見るラッパー */
.section-more-wrap {
    text-align: center;
    margin-top: 12px;
}

/* ========================================
   パターンF: シンプルタイル レイアウト
   ======================================== */

/* カードグリッド */
.update-grid-f {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

/* 個別カード */
.update-card-f {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    background: #fff;
}

a.update-card-f,
a.update-card-f:link,
a.update-card-f:visited,
a.update-card-f:hover,
a.update-card-f:active,
.update-card-f *,
.update-card-f a,
.update-card-f a:link,
.update-card-f a:visited,
.update-card-f a:hover,
.update-card-f a:active {
    text-decoration: none !important;
}

.update-card-f:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.update-card-f.no-data {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

/* カードヘッダー */
.card-header-f {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
}

.type-badge-f {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

/* ===========================================
   タイプ別カラー（CSS化によるソース軽量化）
   =========================================== */

/* 成績更新 (shiai) */
.card-header-f.type-shiai { background: #eff6ff; }
.type-badge-f.type-shiai { background: #3b82f6; }

/* ニュース (news) */
.card-header-f.type-news { background: #ecfdf5; }
.type-badge-f.type-news { background: #10b981; }

/* 進路 (team) */
.card-header-f.type-team { background: #fffbeb; }
.type-badge-f.type-team { background: #f59e0b; }

/* 追加更新 (info) */
.card-header-f.type-info { background: #eef2ff; }
.type-badge-f.type-info { background: #6366f1; }

/* コメント (estimation) */
.card-header-f.type-estimation { background: #f5f3ff; }
.type-badge-f.type-estimation { background: #8b5cf6; }

/* 注目登録 (follow) */
.card-header-f.type-follow { background: #fefce8; }
.type-badge-f.type-follow { background: #eab308; }

/* 指名予想 (nominate) */
.card-header-f.type-nominate { background: #fdf2f8; }
.type-badge-f.type-nominate { background: #ec4899; }

.datetime-f {
    font-size: 0.75rem;
    color: #6b7280;
}

/* カードボディ */
.card-body-f {
    padding: 12px;
    flex: 1;
}

.player-name-f {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.player-info-f {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 8px;
}

.content-preview-f {
    font-size: 0.8rem;
    color: #4b5563;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dotted #d1d5db;
}

/* コメント詳細（ユーザー名・評価点数） */
.estimation-detail-f {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dotted #d1d5db;
}

/* コメントカード: estimation-detail-fの後のcontent-previewは二重線を防ぐ */
.card-body-f .estimation-detail-f ~ .content-preview-f {
    border-top: none;
    margin-top: 6px;
    padding-top: 0;
}

.user-name-f {
    font-size: 0.75rem;
    color: #6b7280;
}

.individual-score-f {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.individual-score-f .mini-donut-f {
    width: 18px;
    height: 18px;
}

.individual-score-f .mini-donut-f::after {
    width: 10px;
    height: 10px;
}

/* 投手/野手評価スコアチャート */
.score-charts-f {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.score-item-f {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
}

.score-label-f {
    color: #6b7280;
    font-size: 0.65rem;
}

.score-value-f {
    font-weight: 600;
    font-size: 0.75rem;
}

/* 写真サムネイル */
.photo-thumbnail-f {
    margin-top: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.photo-thumbnail-f img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

/* 選手名横のポジション（進路カード用） */
.player-position-inline-f {
    font-size: 0.8rem;
    font-weight: 400;
    color: #6b7280;
}

/* 進路変更表示 */
.team-change-f {
    font-size: 0.85rem;
    color: #4b5563;
    line-height: 1.5;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dotted #d1d5db;
}

/* 注目登録詳細 */
.follow-detail-f {
    font-size: 0.8rem;
    color: #4b5563;
    margin-bottom: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dotted #d1d5db;
}

/* 注目カード: follow-detail-fの後のcontent-previewは二重線を防ぐ */
.card-body-f .follow-detail-f ~ .content-preview-f {
    border-top: none;
    margin-top: 6px;
    padding-top: 0;
}

.follow-rank-f {
    font-weight: 600;
    color: #eab308;
}

/* カードフッター */
.card-footer-f {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-top: 1px solid #f3f4f6;
    background: #f9fafb;
}

.rank-badge-f {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: var(--rank-null-solid, #9ca3af); /* デフォルト */
}

/* ランク別カラー（variables.cssの--rank-*変数を使用） */
.rank-badge-f.rank-s { background: var(--rank-s-solid); }
.rank-badge-f.rank-tokua { background: var(--rank-tokua-solid); }
.rank-badge-f.rank-a { background: var(--rank-a-solid); }
.rank-badge-f.rank-a-minus { background: var(--rank-a-minus-gradient); }
.rank-badge-f.rank-b-plus { background: var(--rank-b-plus-gradient); }
.rank-badge-f.rank-b { background: var(--rank-b-solid); }
.rank-badge-f.rank-b-minus { background: var(--rank-b-minus-gradient); }
.rank-badge-f.rank-c-plus { background: var(--rank-c-plus-gradient); }
.rank-badge-f.rank-c { background: var(--rank-c-solid); }
.rank-badge-f.rank-c-minus { background: var(--rank-c-minus-gradient); }
.rank-badge-f.rank-d { background: var(--rank-d-solid); }
.rank-badge-f.rank-e { background: var(--rank-e-solid); }

.score-display-f {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ミニドーナツチャート */
.mini-donut-f {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    position: relative;
}

.mini-donut-f::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
}

.score-value-f {
    font-size: 0.85rem;
    font-weight: 600;
}

/* ページネーション */
.pagination-f {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.page-btn-f {
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s ease;
}

.page-btn-f:hover {
    background: #f3f4f6;
}

.page-btn-f.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* レスポンシブ対応 - パターンF */
@media screen and (max-width: 1024px) {
    .update-grid-f {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .news-thumb-f {
        width: 56px;
        height: 42px;
    }

    .news-player-name-f {
        font-size: 0.9rem;
    }

    .news-title-f {
        font-size: 0.8rem;
    }
}

@media screen and (max-width: 640px) {
    .update-grid-f {
        grid-template-columns: 1fr;
    }

    .card-header-f {
        padding: 6px 10px;
    }

    .card-body-f {
        padding: 10px;
    }

    .card-footer-f {
        padding: 6px 10px;
    }

    .player-name-f {
        font-size: 0.95rem;
    }
}

/* もっと見るボタン */
.more-updates {
    text-align: center;
    padding: 15px 0;
}

.more-btn-f {
    padding: 12px 40px;
    background: #fff;
    color: #333;
    border: 2px solid #333;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.more-btn-f:hover {
    background: #333;
    color: #fff;
}

.more-link {
    text-align: center;
    padding-top: 15px;
}

.more-link a {
    display: inline-block;
    padding: 10px 30px;
    background: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
}

.more-link a:hover {
    background: #555;
}

/* === ランキングセクション === */
.rankings-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.rankings-section h2 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #333;
    font-size: 1.3rem;
}

.rankings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.rankings-grid-4col {
    grid-template-columns: repeat(4, 1fr);
}

.ranking-column {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 15px;
}

.ranking-column h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #333;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: ranking;
}

.ranking-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    display: flex;
    align-items: baseline;
}

.ranking-list li:last-child {
    border-bottom: none;
}

.ranking-list li::before {
    counter-increment: ranking;
    content: counter(ranking) ".";
    min-width: 20px;
    color: #888;
    font-weight: bold;
}

.ranking-list li a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.ranking-list li a:hover {
    text-decoration: underline;
    color: #0066cc;
}

.ranking-list .team-name {
    font-size: 0.8rem;
    color: #888;
    margin-left: 8px;
}

.ranking-list .speed {
    font-size: 0.8rem;
    color: #e65100;
    font-weight: bold;
    margin-left: 8px;
}

/* === クラス別ランキンググリッド === */
.class-rankings-section {
    margin-top: 20px;
}

.class-section-title {
    margin: 20px 0 10px 0;
    padding: 8px 12px;
    background: #333;
    color: #fff;
    border-radius: 4px;
    font-size: 1rem;
}

.class-section-title:first-of-type {
    margin-top: 0;
}

.class-ranking-column h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: #333;
    padding-bottom: 6px;
    border-bottom: 1px solid #ddd;
}

.class-rankings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.class-rankings-grid-4col {
    grid-template-columns: repeat(4, 1fr);
}

.class-ranking-column {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 12px;
}

.class-ranking-column h3 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: #333;
    padding-bottom: 6px;
    border-bottom: 1px solid #ddd;
}

.class-ranking-column .ranking-list li {
    padding: 6px 0;
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 4px;
}

.class-ranking-column .ranking-list li a {
    font-size: 0.85rem;
}

.class-ranking-column .ranking-list .team-name {
    font-size: 0.75rem;
    display: block;
    width: 100%;
    margin-left: 20px;
    margin-top: 2px;
}

.rank-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    margin-left: 6px;
    vertical-align: middle;
}

/* レスポンシブ対応 - クラス別ランキング */
@media screen and (max-width: 1024px) {
    .class-rankings-grid-4col {
        grid-template-columns: repeat(2, 1fr);
    }
    .class-rankings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .rankings-grid-4col {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 640px) {
    .class-rankings-grid,
    .class-rankings-grid-4col {
        grid-template-columns: 1fr;
    }
    .rankings-grid-4col {
        grid-template-columns: 1fr;
    }
}

/* 広告 */
.toppage-new .ad {
    text-align: center;
    padding: 20px 0;
}

.toppage-new .ad p {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 10px;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
    .toppage-new {
        padding: 10px;
    }

    .rankings-grid {
        grid-template-columns: 1fr;
    }

    .update-tabs {
        justify-content: center;
    }

    .tab-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .update-item {
        flex-wrap: wrap;
    }

    .update-content {
        width: 100%;
        margin-left: 0;
        margin-top: 5px;
    }
}

@media screen and (max-width: 640px) {
    .update-tabs {
        gap: 3px;
    }

    .tab-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
}

/* ===========================================
   旧コメントブロック互換（CommentPane.inc.tpl用）
   style.css廃止に伴う移植
   =========================================== */

.comment-block {
    margin-bottom: 16px;
    clear: both;
}

.comment-list,
.comment-list2 {
    padding: 12px;
    margin-bottom: 8px;
    background-size: cover;
    background-position: center;
}

.box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ローディングスピナー */
.loading-spinner {
    display: inline-block;
    padding: 10px 20px;
    color: #666;
    font-size: 0.9rem;
}

.loading-spinner::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid #ddd;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
