/* ========================================
 * 採点結果詳細テーブル
 * ======================================== */

.sf-result-detail-table,
.sf-result-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.95em;
}

.sf-result-detail-table th,
.sf-result-summary-table th {
    background: #f0f0f0;
    border: 1px solid #ddd;
    padding: 10px;
    font-weight: 600;
    text-align: left;
}

.sf-result-detail-table td,
.sf-result-summary-table td {
    border: 1px solid #ddd;
    padding: 10px;
    word-break: break-word;
}

.sf-result-detail-table tbody tr:nth-child(odd),
.sf-result-summary-table tbody tr:nth-child(odd) {
    background: #fafafa;
}

.sf-overall-comment-display {
    background: #fffbf0;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 4px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ========================================
 * SF Exam Frontend CSS - Tabs & Layout Improvements
 * ======================================== */

.sf-exam-front-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Yu Gothic', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
}

/* ========================================
 * タブシステム（メインタブ - 基本情報/採点/全体コメント）
 * ======================================== */

.sf-exam-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
    flex-wrap: wrap;
}

.sf-exam-tab-button {
    padding: 12px 24px;
    border: none;
    background: #f5f5f5;
    color: #333;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.sf-exam-tab-button:hover {
    background: #e8e8e8;
}

.sf-exam-tab-button.active {
    background: #fff;
    border-bottom-color: #0073aa;
    color: #0073aa;
}

/* ========================================
 * 採点者切り替えタブ（1名 or 2名採点）
 * ======================================== */

.sf-exam-examiner-tabs {
    display: flex;
    gap: 0;
    margin: 0 0 20px 0;
    border-bottom: 2px solid #ddd;
    background: transparent;
    border-radius: 0;
}

.sf-exam-examiner-tab {
    padding: 14px 28px;
    border: none;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    flex: 0 0 auto;
}

.sf-exam-examiner-tab:hover {
    background: #e8e8e8;
    color: #333;
}

.sf-exam-examiner-tab.active {
    background: #fff;
    border-bottom-color: #0073aa;
    color: #0073aa;
}

.sf-exam-examiner-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.sf-exam-examiner-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
 * セクション
 * ======================================== */

.sf-exam-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
}

.sf-exam-section h3 {
    margin: 0 0 15px 0;
    padding: 0 0 10px 0;
    border-bottom: 3px solid #0073aa;
    color: #333;
    font-size: 1.2em;
}

/* ========================================
 * フォームフィールド
 * ======================================== */

.sf-exam-field {
    margin-bottom: 15px;
}

.sf-exam-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.sf-exam-field input[type="text"],
.sf-exam-field input[type="date"],
.sf-exam-field input[type="number"],
.sf-exam-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    box-sizing: border-box;
}

.sf-exam-field input[type="text"]:focus,
.sf-exam-field input[type="date"]:focus,
.sf-exam-field input[type="number"]:focus,
.sf-exam-field select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

.sf-exam-field .description {
    margin: 5px 0 0 0;
    font-size: 0.85em;
    color: #666;
}

/* 必須マーク */
.required {
    color: #d9534f;
    font-weight: bold;
}

/* ラジオボタングループ */
.sf-radio-group {
    margin-bottom: 15px;
}

.sf-radio-options {
    margin: 10px 0 0 0;
    padding: 10px 0;
}

.sf-radio-options div {
    margin-bottom: 8px;
}

.sf-radio-options input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
}

.sf-radio-options label {
    display: inline;
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

/* ========================================
 * スコアボタン - グリッド式（コンパクト）
 * ======================================== */

.sf-score-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 6px;
    margin: 15px 0;
    width: 100%;
}

.sf-score-option {
    position: relative;
    display: flex;
    align-items: stretch;
}

.sf-score-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    margin: 0;
    z-index: 1;
}

.sf-score-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 6px;
    text-align: center;
    border: 2px solid #ccc;
    background: #f9f9f9;
    cursor: pointer;
    user-select: none;
    font-size: 0.95em;
    font-weight: 700;
    border-radius: 5px;
    transition: all 0.25s ease;
    color: #333;
    min-height: 40px;
}

.sf-score-option:hover span {
    background: #e8f4ff;
    border-color: #0073aa;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 115, 170, 0.15);
}

.sf-score-option input[type="radio"]:checked + span {
    border-color: #0073aa;
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 6px 15px rgba(0, 115, 170, 0.4);
}

/* ========================================
 * 採点テーブル（新形式）
 * ======================================== */

.sf-exam-scoring-table {
    width: 100%;
    overflow-x: auto;
}

.sf-exam-items-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: #fff;
}

.sf-exam-items-table thead {
    background: #f5f5f5;
    border-bottom: 2px solid #0073aa;
}

.sf-exam-items-table th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border: 1px solid #ddd;
    white-space: normal;
    word-break: break-word;
}

.sf-exam-items-table tbody tr {
    border-bottom: 1px solid #ddd;
    transition: background-color 0.2s ease;
}

.sf-exam-items-table tbody tr:hover {
    background: #f9f9f9;
}

.sf-exam-items-table tbody tr:nth-child(odd) {
    background: #fafafa;
}

.sf-exam-items-table tbody tr:nth-child(odd):hover {
    background: #f0f7ff;
}

.sf-exam-items-table td {
    padding: 15px 10px;
    border: 1px solid #ddd;
    vertical-align: top;
}

/* 採点項目名の列 */
.sf-col-item {
    width: 30%;
    min-width: 180px;
    max-width: 100%;
    background: #f9f9f9;
    font-weight: 500;
    word-break: break-word;
    white-space: normal;
    overflow: visible;
}

.sf-item-label {
    font-size: 0.9em;
    color: #333;
    font-weight: 600;
    margin-bottom: 5px;
    word-break: break-word;
    line-height: 1.3;
}

.sf-item-section {
    font-size: 0.75em;
    color: #0073aa;
    font-weight: 700;
    background: #e8f4ff;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 4px;
}

.sf-item-subtitle {
    font-size: 0.8em;
    color: #999;
    word-break: break-word;
}

/* スコアボタンの列 */
.sf-col-score {
    width: 50%;
    min-width: 280px;
    padding: 12px 10px !important;
}

/* コメントの列 */
.sf-col-comment {
    width: 20%;
    min-width: 140px;
    padding: 12px 8px !important;
}

/* スコアボタン（採点テーブル内用） */
.sf-exam-items-table .sf-score-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.sf-exam-items-table .sf-score-option {
    flex: 0 0 auto;
}

.sf-exam-items-table .sf-score-option span {
    padding: 18px 12px;
    font-size: 1.1em;
    min-height: 60px;
    min-width: 50px;
}

/* コメント入力欄（採点テーブル内用） */
.sf-exam-items-table .sf-exam-item-comment {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85em;
    resize: vertical;
}

/* テキストエリア */
.sf-exam-item-comment {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9em;
    resize: vertical;
    box-sizing: border-box;
}

.sf-exam-overall-comment {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
    box-sizing: border-box;
}

.sf-exam-overall-comment:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

/* ========================================
 * アクションボタン
 * ======================================== */

.sf-exam-actions {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
}

.sf-exam-submit,
.sf-exam-modify-btn,
.sf-exam-back-btn {
    padding: 10px 16px;
    font-size: 0.95em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    flex: 1;
    min-width: 100px;
}

.sf-exam-submit {
    background: #0073aa;
    color: #fff;
    font-weight: 600;
}

.sf-exam-submit:hover {
    background: #005a87;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.sf-exam-submit:active {
    transform: scale(0.98);
}

.sf-exam-modify-btn,
.sf-exam-back-btn {
    background: #6c757d;
    color: #fff;
    font-weight: 600;
}

.sf-exam-modify-btn:hover,
.sf-exam-back-btn:hover {
    background: #5a6268;
}

/* 完了画面 */
.sf-exam-front-wrapper h2 {
    color: #0073aa;
    text-align: center;
    margin-bottom: 20px;
}

.sf-exam-buttons-section {
    background: #f9f9f9;
    padding: 10px !important;
    margin: 0 !important;
}

.sf-exam-buttons-section .sf-exam-actions {
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
    max-width: 100%;
}

/* ========================================
 * レスポンシブ対応
 * ======================================== */

@media (max-width: 1024px) {
    .sf-col-item {
        width: 35%;
        min-width: 140px;
    }

    .sf-col-score {
        width: 45%;
        min-width: 220px;
    }

    .sf-col-comment {
        width: 20%;
        min-width: 110px;
    }

    .sf-score-buttons {
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
        gap: 5px;
    }

    .sf-score-option span {
        padding: 9px 5px;
        font-size: 0.9em;
        min-height: 38px;
    }

    .sf-exam-items-table .sf-score-buttons {
        gap: 5px;
    }

    .sf-exam-items-table .sf-score-option span {
        padding: 9px 5px;
        font-size: 0.9em;
        min-height: 38px;
    }
}

/* === スマホカード型レイアウト用（768px以下） === */
@media (max-width: 768px) {
    /* カード全体のスタイル */
    .sf-exam-items-table tbody tr {
        border-left: 4px solid #0073aa;
    }

    /* 項目名をカード見出しのように表示 */
    .sf-col-item {
        background: linear-gradient(135deg, rgba(0, 115, 170, 0.05), rgba(0, 115, 170, 0.02));
    }

    .sf-item-label {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .sf-item-label::before {
        content: '';
        display: inline-block;
        width: 4px;
        height: 20px;
        background: #0073aa;
        border-radius: 2px;
    }

    /* スコアセクション */
    .sf-col-score::before {
        content: 'スコア';
        display: block;
        font-weight: 700;
        color: #0073aa;
        font-size: 0.85em;
        margin-bottom: 8px;
        text-transform: uppercase;
    }

    /* コメントセクション */
    .sf-col-comment::before {
        content: 'コメント';
        display: block;
        font-weight: 700;
        color: #666;
        font-size: 0.85em;
        margin-bottom: 8px;
    }

    /* 最後の要素はマージンを0に */
    .sf-exam-items-table tbody tr:last-child {
        margin-bottom: 0;
    }
}
    .sf-exam-front-wrapper {
        margin: 10px;
        padding: 15px;
    }

    .sf-exam-section {
        padding: 15px;
    }

    .sf-exam-examiner-tab {
        padding: 10px 16px;
        font-size: 0.9em;
    }

    /* === スマホ用テーブルレイアウト変更 === */
    .sf-exam-items-table {
        font-size: 1em;
        display: block;
        border: none;
    }

    /* テーブルヘッダーを非表示 */
    .sf-exam-items-table thead {
        display: none;
    }

    /* テーブルボディをカード型に */
    .sf-exam-items-table tbody {
        display: block;
    }

    /* 各行をカード型に */
    .sf-exam-items-table tbody tr {
        display: block;
        border: 1px solid #ddd;
        border-radius: 8px;
        margin-bottom: 20px;
        padding: 15px;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .sf-exam-items-table tbody tr:nth-child(odd) {
        background: #fff;
    }

    .sf-exam-items-table tbody tr:nth-child(odd):hover {
        background: #fff;
    }

    .sf-exam-items-table tbody tr:hover {
        background: #fff;
        box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    }

    /* テーブルセル */
    .sf-exam-items-table td {
        display: block;
        border: none;
        padding: 0 0 15px 0;
        text-align: left;
        word-break: break-word;
    }

    /* 採点項目列を見出しとして表示 */
    .sf-col-item {
        width: 100% !important;
        background: transparent !important;
        padding-bottom: 10px;
        border-bottom: 2px solid #0073aa;
        margin-bottom: 15px;
        min-width: 100% !important;
    }

    .sf-item-label {
        font-size: 13pt;
        color: #0073aa;
        font-weight: 700;
        margin-bottom: 3px;
        word-break: break-word;
        white-space: normal;
        line-height: 1.3;
        display: block;
    }

    .sf-item-subtitle {
        font-size: 11pt;
        color: #999;
        word-break: break-word;
        white-space: normal;
    }

    .sf-item-section {
        font-size: 0.7em;
        color: #fff;
        background: #0073aa;
        padding: 2px 6px;
        border-radius: 3px;
        display: inline-block;
        margin-bottom: 5px;
        font-weight: 700;
    }

    /* スコア列 */
    .sf-col-score {
        width: 100% !important;
        padding: 0 !important;
    }

    /* コメント列 */
    .sf-col-comment {
        width: 100% !important;
        padding: 0 !important;
    }

    /* スコアボタン */
    .sf-exam-items-table .sf-score-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin: 0 0 15px 0;
        width: 100%;
    }

    .sf-exam-items-table .sf-score-option {
        flex: 0 0 calc(25% - 3px);
        min-width: 40px;
    }

    .sf-exam-items-table .sf-score-option span {
        padding: 8px 4px;
        font-size: 0.85em;
        min-height: 38px;
        width: 100%;
    }

    /* コメント欄 */
    .sf-exam-items-table .sf-exam-item-comment {
        min-height: 80px;
        font-size: 0.85em;
        padding: 8px;
        width: 100%;
    }

    .sf-exam-actions {
        flex-direction: column;
        padding: 0;
        margin: 0;
        gap: 10px;
    }

    .sf-exam-submit,
    .sf-exam-modify-btn,
    .sf-exam-back-btn {
        width: 100%;
        padding: 12px 12px;
        font-size: 0.9em;
    }
}
