/* 全体レイアウトの初期化とボックスモデルの設定 */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1a1a1f;
    color: #e0e0e3;
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* 全体のスクロールを禁止 */
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* 左側サイドバー */
.sidebar {
    width: 340px;
    background-color: #212129;
    border-right: 1px solid #33333f;
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
}

.app-title {
    font-size: 16px;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #33333f;
    color: #ffffff;
    font-weight: 600;
    text-align: center;
}

.control-group {
    background-color: #282833;
    border: 1px solid #33333f;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}

.control-group h3 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #9e9eb0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ファイルアップロードのデザイン */
.file-upload-btn {
    display: block;
    background-color: #4f46e5;
    color: white;
    text-align: center;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.file-upload-btn:hover {
    background-color: #4338ca;
}

/* ファイル名省略とツールチップの仕組み */
.file-name-display {
    margin-top: 6px;
    font-size: 11px;
    color: #8e8e9c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    width: 100%;
    cursor: default;
}

.radio-group, .checkbox-group-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.radio-group label, .checkbox-group-horizontal label {
    font-size: 12px;
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #cfcfd6;
}

/* Empireフィルタ（残りの高さを占有しここだけスクロール可能にする） */
.empire-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* これを入れることでflexの子要素が縮小可能になります */
    margin-bottom: 0;
}

.empire-bulk-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.empire-bulk-actions button {
    flex: 1;
    background-color: #33333f;
    color: #e0e0e3;
    border: none;
    padding: 6px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
}

.empire-bulk-actions button:hover {
    background-color: #444454;
}

.empire-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #33333f;
    border-radius: 4px;
    background-color: #1a1a1f;
    padding: 4px;
}

/* スクロールバーのカスタマイズ */
.empire-list::-webkit-scrollbar { width: 6px; }
.empire-list::-webkit-scrollbar-track { background: #1a1a1f; }
.empire-list::-webkit-scrollbar-thumb { background: #33333f; border-radius: 3px; }

/* Empireごとの行（名前とカラーピッカーの並び） */
.empire-row {
    display: flex;
    align-items: center;
    padding: 4px;
    border-bottom: 1px solid #282833;
    gap: 6px;
}

.empire-row:last-child {
    border-bottom: none;
}

.empire-row label {
    flex: 1;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #cfcfd6;
}

.empire-row input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}

/* カラーピッカー */
.empire-color-input {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 18px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    background: none;
    padding: 0;
    flex-shrink: 0;
}
.empire-color-input::-webkit-color-swatch { border: 1px solid #33333f; border-radius: 3px; }

/* 右側グラフ表示エリア */
.main-content {
    flex: 1;
    background-color: #121216;
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chart-wrapper {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #1a1a1f;
    border: 1px solid #33333f;
    border-radius: 8px;
    padding: 15px;
}