/* =========================================================
   SFN Feature: Score Management (Archive & Details)
   ========================================================= */

/* --- 0. 共通見出し・コンテナ設定 --- */
.sfn-view-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.sfn-view-title {
    font-size: 24px;
    font-weight: 900;
    border-left: 8px solid #002D58;
    padding: 10px 15px;
    margin-bottom: 30px;
    background: #f4f4f4;
}

.sfn-view-title-sub {
    font-size: 18px;
    font-weight: bold;
    margin: 40px 0 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid #002D58;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

/* --- 1. 検索フォームのデザイン --- */
.sfn-search-box {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #eee;
}

.sfn-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.sfn-search-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sfn-search-field label {
    font-size: 12px;
    font-weight: bold;
    color: #666;
}

.sfn-search-field input,
.sfn-search-field select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px; /* iOSズーム防止 */
    background: #fff;
}

/* セレクトボックスのみの追加設定 */
.sfn-search-field select {
    cursor: pointer;
}

.sfn-search-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.sfn-search-submit {
    background: #002D58;
    color: #fff !important;
    border: none;
    padding: 10px 40px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.sfn-search-submit:hover {
    background: #001a33;
}

.sfn-search-reset {
    font-size: 13px;
    color: #999;
    text-decoration: underline;
}

/* --- 2. アーカイブ一覧：カードグリッド --- */

/* PC・タブレット：2カラム強制 */
body div.sfn-score-archive-wrapper div.sfn-archive-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
    margin-top: 20px !important;
}

/* スマホ：1カラム */
@media (max-width: 600px) {
    body div.sfn-score-archive-wrapper div.sfn-archive-grid {
        grid-template-columns: 1fr !important;
    }
}

/* カード本体 */
body div.sfn-score-archive-wrapper .sfn-score-card {
    background: #fff !important;
    border: 1px solid #eee !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06) !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* カードヘッダー */
body div.sfn-score-archive-wrapper .sfn-card-header {
    background: #fcfcfc !important;
    padding: 12px 15px !important;
    border-bottom: 1px solid #f0f0f0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

body div.sfn-score-archive-wrapper .sfn-card-date {
    font-size: 11px !important;
    color: #999 !important;
    font-weight: bold !important;
}

body div.sfn-score-archive-wrapper .sfn-result-badge {
    font-size: 11px !important;
    font-weight: bold !important;
    padding: 3px 12px !important;
    border-radius: 4px !important;
    color: #fff !important;
}

/* 勝敗色 */
body div.sfn-score-archive-wrapper .is-win .sfn-result-badge { background: #002D58 !important; }
body div.sfn-score-archive-wrapper .is-loss .sfn-result-badge { background: #d32f2f !important; }
body div.sfn-score-archive-wrapper .is-draw .sfn-result-badge { background: #666 !important; }

/* カードボディ */
body div.sfn-score-archive-wrapper .sfn-card-body {
    padding: 30px 15px !important;
    text-align: center !important;
    flex-grow: 1 !important;
}

body div.sfn-score-archive-wrapper .sfn-match-main {
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    margin-bottom: 20px !important;
}

body div.sfn-score-archive-wrapper .sfn-team-box {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
}

body div.sfn-score-archive-wrapper .sfn-team-name {
    font-size: 12px !important;
    font-weight: bold !important;
    color: #888 !important;
}

body div.sfn-score-archive-wrapper .sfn-team-score {
    font-size: 42px !important;
    font-weight: 900 !important;
    color: #333 !important;
    line-height: 1 !important;
}

body div.sfn-score-archive-wrapper .sfn-vs-label {
    font-size: 16px !important;
    font-weight: bold !important;
    color: #ddd !important;
}

body div.sfn-score-archive-wrapper .sfn-match-title {
    font-size: 15px !important;
    font-weight: bold !important;
    color: #444 !important;
    margin-top: 10px !important;
}

/* 詳細ボタン */
body div.sfn-score-archive-wrapper .sfn-archive-btn {
    display: block !important;
    background: #1a1a1a !important;
    color: #fff !important;
    text-align: center !important;
    padding: 16px !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: bold !important;
    transition: background 0.2s;
}

body div.sfn-score-archive-wrapper .sfn-archive-btn:hover {
    background: #002D58 !important;
}

/* --- 3. 詳細表示：テーブル設計 --- */
.sfn-table-scroll-box {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 30px;
    border: 1px solid #eee;
    border-radius: 8px;
}

.sfn-score-table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
    table-layout: fixed;
}

.sfn-score-table th, 
.sfn-score-table td {
    border: 1px solid #eee;
    padding: 12px 5px;
    text-align: center;
    white-space: nowrap;
    font-size: 14px;
}

.sfn-score-table th {
    background: #002D58;
    color: #fff;
    font-weight: bold;
}

.sfn-score-table td.col-name {
    text-align: left !important;
    padding-left: 12px !important;
    font-weight: bold;
    background: #fdfdfd;
}

/* 列幅の個別指定（ここが重要です） */
.is-inning { min-width: 600px; }
.is-inning th:nth-child(1), .is-inning td:nth-child(1) { width: 180px; }

.is-batting { min-width: 800px; }
.is-batting th:nth-child(1), .is-batting td:nth-child(1) { width: 45px; }
.is-batting th:nth-child(2), .is-batting td:nth-child(2) { width: 45px; }
.is-batting th:nth-child(3), .is-batting td:nth-child(3) { width: 160px; }
.is-batting th:nth-child(n+4), .is-batting td:nth-child(n+4) { width: 50px; }

.is-pitching { min-width: 700px; }
.is-pitching th:nth-child(1), .is-pitching td:nth-child(1) { width: 160px; }
.is-pitching th:nth-child(n+2), .is-pitching td:nth-child(n+2) { width: 55px; }

.is-highlight { color: #d32f2f; font-weight: bold; }
.is-total { font-weight: bold; background: #f5f5f5; }
.sfn-no-result { text-align: center; padding: 50px 0; color: #999; }