/* css/index.css - index.html専用のスタイル */

/* メインコンテナ */
.main-container { 
    background-color: white; 
    padding: 30px; 
    border-radius: 12px; 
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1); 
    max-width: 600px; 
    width: 100%; 
}

/* フォームのセクション */
fieldset { 
    border: 1px solid #ddd; 
    padding: 20px; 
    margin-bottom: 20px; 
    border-radius: 8px; 
}
legend { 
    font-size: 1.1em; 
    font-weight: bold; 
    color: #333; 
    padding: 0 10px; 
}
label { 
    display: block; 
    margin-top: 15px; 
    margin-bottom: 5px; 
    font-weight: 600; 
}

/* チェックボックスグループのコンテナ */
.checkbox-group { 
    display: flex; 
    flex-wrap: wrap; 
    max-height: 200px; 
    overflow-y: auto; 
    border: 1px solid #ddd; 
    padding: 10px; 
    border-radius: 4px; 
    background-color: #fafafa; 
}

/* 修正: チェックボックスのずれ解消のためのスタイル */
.checkbox-group div { 
    flex: 1 1 45%; 
    margin-right: 5%; 
    margin-bottom: 5px; 
    /* チェックボックスとラベルを垂直方向で揃える */
    display: flex;
    align-items: center;
}

.checkbox-group input[type="checkbox"] { 
    margin-right: 5px; 
    transform: scale(1.1); /* サイズ調整 */
    width: auto; /* input[type=checkbox]は幅を自動に */
}

/* 修正: ラベルのスタイルを統一し、ズレを解消 */
.pref-checkbox-label,
.checkbox-group label {
    display: inline;
    font-weight: normal;
    font-size: 0.95em;
    line-height: 1.4;
    margin: 0;
    flex-grow: 1; /* ラベルが残りのスペースを埋める */
}

/* ---------------------------------------------------- */
/* 🔥 全体開閉UIのヘッダーとアコーディオン要素 */
/* ---------------------------------------------------- */

.line-selection-header {
    /* ラベルとボタンを横並びにする */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px; /* ラベルの上のマージン */
    margin-bottom: 5px; /* ラベルの下のマージン */
}

/* 路線リスト全体を格納するコンテナ */
#company-line-selection { 
    /* 既存のコンテナスタイルをベースに、アコーディオン効果を追加 */
    margin-top: 5px; /* 上のラベルからの距離を調整 */
    border: 1px solid #ccc; 
    border-radius: 8px; 
    background-color: #f0f0f0;
    
    /* 🔥 アコーディオンの制御 */
    /* JSでmax-heightを設定するため、ここは初期値として設定 */
    max-height: 0; 
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out;
    padding: 0 10px; /* 展開時にパディングを追加 */
}

/* 🔥 初期状態（折りたたみ時）のスタイル */
.collapsible-content.collapsed-all {
    max-height: 0 !important; /* JSで上書きされるが念のため */
    padding-top: 0;
    padding-bottom: 0;
    border-top: none;
    border-bottom: none;
}

/* 開閉ボタンのスタイル */
.toggle-button {
    background: #e9e9e9;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1.2em;
    width: 30px;
    height: 30px;
    line-height: 1;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    transition: background-color 0.2s;
}
.toggle-button:hover {
    background-color: #ddd;
}

/* 会社ごとのグループ表示スタイル */
.line-group { 
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 8px;
    background-color: white;
}
.company-header {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    background-color: #f7f7f7;
    border-bottom: 1px solid #ddd;
    margin: 0;
}
/* 会社ごとのチェックボックスグループのスタイル */
.company-lines-group {
    padding: 10px;
    max-height: none; 
    overflow-y: visible;
    border: none;
}


/* ログイン促し文 */
.login-prompt { 
    text-align: center; 
    margin-top: 20px; 
    font-size: 0.9em; 
}

/* スマートフォン向け調整 */
@media (max-width: 600px) {
    .main-container {
        max-width: 95%; 
        padding: 15px;  
    }
    
    .checkbox-group div { 
        flex: 1 1 100%; 
        margin-right: 0; 
        margin-bottom: 8px; 
    }
}