/* --- タブ全体 --- */
.tab-container {
    margin-top: 20px;
}

.tab-header {
    display: flex;
    border-bottom: 2px solid #ccc;
    margin-bottom: 10px;
}

.tab-header div {
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 6px 6px 0 0;
    background: #e9ecef;
    margin-right: 5px;
}

.tab-header div.active {
    background: #007bff;
    color: #fff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- Body --- */
body {
    font-family: Arial, sans-serif;
    background: #f2f4f7;
    margin: 0;
    padding: 20px;
}

h2,
h3 {
    color: #333;
}

/* --- コンテナ --- */
.container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
    margin-bottom: 25px;
}

/* --- ボタン --- */
button {
    padding: 8px 14px;
    border: none;
    border-radius: 4px;
    margin: 5px 0;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    opacity: 0.85;
}

.btn-primary {
    background: #007bff;
    color: #fff;
}

.btn-export {
    background: #28a745;
    color: #fff;
}

.btn-close {
    background: #dc3545;
    color: #fff;
}

/* --- テーブル --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: #fff;
}

th {
    background: #007bff;
    color: white;
    padding: 8px;
    font-size: 14px;
}

td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
}

tr:hover {
    background: #f1f7ff;
}

/* --- モーダル --- */
#detailModal {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    padding: 40px;
}

.modal-box {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 900px;
    max-height: 80%;
    overflow: auto;
    margin: auto;
}

/* --- JSON / テーブル表示 --- */
#jsonView,
#tableView {
    padding: 10px;
    border: 1px solid #ddd;
    background: #fafafa;
    border-radius: 4px;
    margin-top: 10px;
}

/* --- 入力エリア --- */
input,
select {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-right: 8px;
}

/* --- グラフ --- */
canvas {
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
}

/* ===== Configuration Viewer ===== */

/* セクション */
.cv-section {
    margin-bottom: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
}

.cv-section-header {
    background: #3a6ea5;
    color: #fff;
    padding: 8px 14px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.cv-section-header:hover {
    background: #2d5a8c;
}

.cv-section-header.cv-unknown {
    background: #b85c00;
}

.cv-section-body {
    padding: 0;
    overflow-x: auto;
}

.cv-section-body.cv-collapsed {
    display: none;
}

/* テーブル */
.cv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 0;
}

.cv-table th {
    background: #e8f0fb;
    color: #333;
    padding: 6px 10px;
    font-size: 12px;
    text-align: left;
    border-bottom: 2px solid #b0c4de;
}

.cv-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.cv-table tr:hover td {
    background: #f5f8ff;
}

/* フィールド名列 */
.cv-fieldname {
    font-weight: bold;
    color: #1a3a6b;
    min-width: 220px;
    white-space: nowrap;
}

.cv-attrname {
    color: #1a3a6b;
    padding-left: 20px !important;
}

.cv-indent {
    padding-left: 30px !important;
}

/* 値列 */
.cv-value {
    min-width: 160px;
    word-break: break-all;
}

/* エラー（値不正） */
.cv-error {
    background: #ffe0e0 !important;
    color: #c00;
    font-weight: bold;
}

.cv-error-inline {
    color: #c00;
    cursor: help;
}

/* 仕様外フィールド */
.cv-unknown {
    background: #fff3cd !important;
    color: #7a5c00;
}

/* 未設定 */
.cv-missing {
    color: #aaa;
    font-style: italic;
}

/* サブセクションヘッダー */
.cv-subsection-header {
    background: #ddeeff;
    color: #1a3a6b;
    font-weight: bold;
    padding: 6px 10px !important;
    border-top: 2px solid #b0c4de;
}

/* 追加テーブルヘッダー行（サブセクション内） */
.cv-thead th {
    background: #f0f4ff;
    color: #444;
    font-size: 11px;
    padding: 4px 10px;
}

/* 属性バッジ */
.cv-badge-attr {
    display: inline-block;
    background: #6c757d;
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 4px;
    font-weight: normal;
}

/* カラースウォッチ */
.cv-color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1px solid #666;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 4px;
}

/* 統計バー */
#configViewStatus {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

.cv-stat {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 13px;
    background: #e9ecef;
    color: #333;
}

.cv-stat-error {
    background: #ffe0e0;
    color: #c00;
    font-weight: bold;
}

.cv-stat-warn {
    background: #fff3cd;
    color: #7a5c00;
    font-weight: bold;
}

.cv-stat-miss {
    background: #f0f0f0;
    color: #888;
}

.cv-stat-ok {
    background: #d4edda;
    color: #155724;
    font-weight: bold;
}
