/* チェーン店マップスタイル */

/* パネルセクションの共通スタイル */
.panel-section:first-child {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

/* ライブラリ切り替えコンテナ */
.library-switcher {
    padding: 8px;
    background-color: #f0f0f0;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 1px;
}

.library-switcher label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

/* ライブラリ選択プルダウン */
#library-select {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
}

#library-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* リセットとベーススタイル - 全要素のマージン・パディングをリセットし、box-sizingを統一 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ページ全体のベーススタイル - フォントファミリーと背景色を設定 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
}

/* CSS変数の初期化 - JavaScriptから動的に設定される値 */
:root {
    --toggle-panel-width: 300px;
    /* デフォルト値、APP_CONFIGから上書き可能 */
}

/* メインコンテナ - マップとサイドパネルを横並びに配置するFlexコンテナ */
.container {
    display: flex;
    height: 100vh;
}

/* マップコンテナ - 地図表示エリア、残りの幅を占有 */
#map {
    flex: 1;
    height: 100vh;
}

/* トグルパネル - 右側のサイドパネル、チェーン店の表示切り替えと駅検索機能を含む */
.toggle-panel {
    width: var(--toggle-panel-width, 300px);
    background-color: white;
    border-left: 1px solid #ddd;
    padding: 15px;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* トグルパネルヘッダー - タイトルと設定ボタンを横並びに配置 */
.toggle-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

/* トグルパネルのタイトル */
.toggle-panel h2 {
    color: #333;
    font-size: 18px;
    margin: 0;
}

/* 設定ボタン - 設定ダイアログを開くためのボタン */
.settings-button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

/* 設定ボタンのホバー効果 */
.settings-button:hover {
    background-color: #0056b3;
}

/* トグルコントロール - 各チェーン店の表示/非表示を切り替えるチェックボックス項目 */
.chain-toggle {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    padding: 3px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background-color: #fafafa;
}

/* チェーン店トグルのチェックボックス - サイズを大きくして操作しやすく */
.chain-toggle input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

/* チェーン店名のラベル - クリック可能で残りの幅を占有 */
.chain-toggle label {
    flex: 1;
    cursor: pointer;
    font-weight: 500;
}

/* ローディングインジケーター - データ読み込み中に画面中央に表示される */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 5px;
    z-index: 1000;
}

/* エラーメッセージ - エラー発生時に表示される警告メッセージ */
.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 15px;
    margin: 10px;
    border-radius: 5px;
    border-left: 4px solid #c62828;
}

/* 店舗ポップアップスタイル - マップ上の店舗マーカークリック時に表示される情報ポップアップ */
.store-popup h3 {
    margin: 0 0 10px 0;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 5px;
}

/* ポップアップ内のテキスト */
.store-popup p {
    margin: 8px 0;
    color: #555;
}

/* MapLibre GL JS ポップアップのカスタムスタイル - MapLibreライブラリのデフォルトポップアップスタイルを上書き */
.maplibregl-popup {
    z-index: 1000;
}

/* MapLibreポップアップのコンテンツ部分 - 角丸、影、フォントなどの外観を調整 */
.maplibregl-popup-content {
    border-radius: 12px !important;
    padding: 1px !important;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;
    background: white !important;
    color: #333 !important;
    font-family: "Helvetica Neue", Arial, Helvetica, sans-serif !important;
    font-size: 0.75rem !important;
    line-height: 1.5 !important;
    min-width: 50px !important;
    width: auto !important;
    text-align: left !important;
}

/* MapLibreポップアップ内の見出し - 店舗名などのタイトル表示 */
.maplibregl-popup-content h3 {
    margin: 0 0 10px 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #333 !important;
    line-height: 1.2 !important;
    padding-bottom: 5px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* MapLibreポップアップ内の段落テキスト - 住所や詳細情報の表示 */
.maplibregl-popup-content p {
    margin: 8px 0 !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    color: #555 !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* ポップアップ内の強調テキスト */
.maplibregl-popup-content p strong {
    color: #333 !important;
    font-weight: 600 !important;
}

/* MapLibreポップアップの閉じるボタン - ポップアップを閉じるためのXボタンのスタイル改善 */
.maplibregl-popup-close-button {
    position: absolute !important;
    right: 3px !important;
    top: 3px !important;
    width: 20px !important;
    height: 20px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    color: #c3c3c3 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    z-index: 1001 !important;
}

/* 閉じるボタンのホバー効果 */
.maplibregl-popup-close-button:hover {
    background: rgba(255, 255, 255, 0.8) !important;
    color: #999 !important;
}

/* MapLibreポップアップの矢印部分 - ポップアップとマーカーを繋ぐ三角形 */
.maplibregl-popup-tip {
    border-top-color: white !important;
    border-width: 10px !important;
    border-bottom-width: 0 !important;
}

/* ポップアップラッパー - ポップアップ内容の外側パディング設定 */
.popup-wrapper {
    padding: 13px 24px 13px 20px;
}

/* 駅検索セクション - 近くの駅を検索する機能のセクション */
#station-search-section {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

.station-finder-section {
    margin-top: 0px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

/* 駅検索セクションのヘッダー */
.station-finder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* 駅検索セクションのタイトル */
.station-finder-section h3 {
    margin: 0;
    color: #333;
    font-size: 16.5px;
}

/* 駅検索設定ボタン */
.station-settings-button {
    background: linear-gradient(135deg, #f6f8fa 0%, #e7ebef 100%);
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #495057;
    min-width: 30px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.station-settings-button:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

/* 距離選択コントロール - 検索範囲を指定するセレクトボックス */
.distance-selector {
    margin-bottom: 13px;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 距離選択のラベル */
.distance-selector label {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
    margin: 0;
}

/* 距離選択のセレクトボックス */
.distance-selector select {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
}

/* 距離選択内の検索ボタン */
.distance-selector .search-button {
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 駅検索実行ボタン - 現在地周辺の駅を検索するボタン */
.search-button {
    padding: 6px 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* 検索ボタンのホバー効果 */
.search-button:hover {
    background-color: #0056b3;
}

/* 検索ボタンの無効状態 - 位置情報取得中など */
.search-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* 駅検索結果 - 検索された駅のリスト表示エリア */
.station-results {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

.station-results h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

/* 駅リストコンテナ - スクロール可能な駅一覧 */
.station-list {
    overflow-y: auto;
    flex-grow: 1;
}

/* 駅項目 - 各駅の情報を表示するカード */
.station-item {
    padding: 4px 8px;
    margin-bottom: 4px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fafafa;
    cursor: pointer;
    transition: background-color 0.2s;
}

/* 駅項目のホバー効果 */
.station-item:hover {
    background-color: #f0f0f0;
    border-color: #007bff;
}

/* 選択された駅項目のスタイル */
.station-item.selected {
    background-color: #e3f2fd;
    border-color: #007bff;
    border-width: 2px;
}

/* 駅名表示 */
.station-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

/* 駅の詳細情報 */
.station-info {
    font-size: 12px;
    color: #666;
}

/* チェーン店数の表示 */
.chain-count {
    font-weight: 500;
    color: #007bff;
    margin-bottom: 3px;
}

/* チェーン店詳細情報 */
.chain-details {
    line-height: 1.3;
}

/* 検索結果なしの表示 */
.no-results {
    padding: 10px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* 設定ダイアログ - 表示するチェーン店を選択するモーダルダイアログ */
.settings-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* 駅検索詳細設定ダイアログ */
.station-settings-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.station-settings-dialog-content {
    background-color: white;
    border-radius: 8px;
    padding: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.station-settings-dialog h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 18px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 6px;
}

.settings-description {
    margin-bottom: 12px;
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

.exclude-section {
    margin-bottom: 15px;
}

.exclude-section h4 {
    margin-bottom: 8px;
    color: #333;
    font-size: 15px;
}

.enable-section {
    margin-bottom: 10px;
    padding: 8px;
    background-color: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 4px;
}

.enable-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #1976d2;
}

.enable-checkbox {
    margin-right: 8px;
    transform: scale(1.2);
}

.exclude-info {
    margin-bottom: 10px;
    padding: 6px 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
}

.preset-section,
.custom-section {
    margin-bottom: 12px;
}

.preset-section h5,
.custom-section h5 {
    margin-bottom: 6px;
    color: #333;
    font-size: 13px;
    font-weight: 600;
}

.preset-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
    margin-bottom: 10px;
    max-height: 280px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fafafa;
}

.preset-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    padding: 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.preset-item:hover {
    background-color: #f0f0f0;
}

.preset-item input[type="checkbox"] {
    margin-right: 6px;
    transform: scale(0.9);
}

.custom-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 8px;
}

.custom-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.custom-list {
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fafafa;
}

.custom-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

.custom-item:last-child {
    border-bottom: none;
}

.remove-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.remove-btn:hover {
    background-color: #c82333;
}

.station-settings-dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

/* 設定ダイアログのコンテンツ部分 */
.settings-dialog-content {
    background-color: white;
    border-radius: 8px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* 設定ダイアログのタイトル */
.settings-dialog h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

/* 設定ダイアログのボタンエリア - OK/キャンセルボタンの配置 */
.settings-dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* ダイアログボタンの基本スタイル */
.dialog-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

/* プライマリボタン（OK/保存ボタン） */
.dialog-button.primary {
    background-color: #007bff;
    color: white;
}

/* プライマリボタンのホバー効果 */
.dialog-button.primary:hover {
    background-color: #0056b3;
}

/* セカンダリボタン（キャンセルボタン） */
.dialog-button.secondary {
    background-color: #6c757d;
    color: white;
}

/* セカンダリボタンのホバー効果 */
.dialog-button.secondary:hover {
    background-color: #545b62;
}

/* チェーン選択リスト - 設定ダイアログ内のチェーン店選択リスト */
.chain-selection-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
}

/* チェーン選択項目 - 各チェーン店の選択項目 */
.chain-selection-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fafafa;
    cursor: pointer;
    transition: background-color 0.2s;
}

/* チェーン選択項目のホバー効果 */
.chain-selection-item:hover {
    background-color: #f0f0f0;
}

/* 選択されたチェーン項目のスタイル */
.chain-selection-item.selected {
    background-color: #e3f2fd;
    border-color: #007bff;
}

/* チェーン選択のチェックボックス */
.chain-selection-item input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

/* チェーン店の色インジケーター - 各チェーン店の識別色を表示する円 */
.chain-selection-item .color-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 10px;
    border: 1px solid #333;
}

/* チェーン選択項目のラベル */
.chain-selection-item label {
    flex: 1;
    cursor: pointer;
    font-weight: 500;
}

/* 選択情報表示 - 現在の選択状況を示すインフォメーション */
.selection-info {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
}

/* ズームコントロールのスタイル - マップ上のズームイン/アウトボタン */
.maplibregl-ctrl.zoom-controls,
.leaflet-control.zoom-controls {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    z-index: 1000 !important;
    background: white;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(0,0,0,.1);
    display: flex;
    flex-direction: column;
}

/* ズームコントロールボタンの基本スタイル */
.zoom-controls button {
    width: 30px;
    height: 30px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    outline: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

/* ズームインボタン（+）の特別なスタイル */
.zoom-controls .zoom-in-button {
    border-radius: 4px 4px 0 0;
}

/* ズームアウトボタン（-）の特別なスタイル */
.zoom-controls .zoom-out-button {
    border-radius: 0 0 4px 4px;
    border-top: 1px solid #ddd;
}

/* ズームボタンのホバー効果 */
.zoom-controls button:hover {
    background-color: #f0f0f0;
}

/* ズームボタンのフォーカス時のアウトライン */
.zoom-controls button:focus {
    outline: 2px solid #007bff !important;
    outline-offset: 2px !important;
}

/* ズームボタンのアクティブ状態（クリック時） */
.zoom-controls button:active {
    background-color: #e0e0e0 !important;
    transform: scale(0.95) !important;
}

/* Leaflet用カスタムポップアップスタイル */
.leaflet-popup-custom .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-custom .leaflet-popup-content {
    font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
    font-size: 0.75rem;
    line-height: 1.5;
    margin: 1px;
}

.leaflet-popup-content div p {
    margin: 8px 0;
}

.leaflet-popup-custom .leaflet-popup-close-button {
    position: absolute;
    right: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    font-size: 16px;
    font-weight: bold;
    color: #c3c3c3;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
    text-decoration: none;
    z-index: 1001;
}

.leaflet-popup-custom .leaflet-popup-close-button:hover {
    background: rgba(255, 255, 255, 0.8);
    color: #999;
}

/* Leaflet用カスタムマーカーアイコン */
.custom-marker-icon {
    background: transparent !important;
    border: none !important;
}

/* レスポンシブデザイン - モバイル端末（768px以下）での表示調整 */
@media (max-width: 768px) {

    /* モバイルでは縦並びレイアウトに変更 */
    .container {
        flex-direction: column;
    }

    /* モバイル用トグルパネル - 全幅で高さ制限 */
    .toggle-panel {
        width: 100%;
        height: 300px;
        border-left: none;
        border-top: 1px solid #ddd;
    }

    /* モバイル用マップ - パネル分を除いた高さ */
    #map {
        height: calc(100vh - 300px);
    }

    /* モバイル用駅リスト - 高さを制限してスクロール */
    .station-list {
        max-height: 150px;
    }

    /* モバイル用設定ダイアログ - より大きな幅とコンパクトなパディング */
    .settings-dialog-content {
        width: 95%;
        padding: 16px;
    }

    /* モバイル用チェーン選択リスト - 高さを制限 */
    .chain-selection-list {
        max-height: 300px;
    }

    /* モバイル用駅検索設定ダイアログ */
    .station-settings-dialog-content {
        width: 95%;
        padding: 12px;
        max-height: 90vh;
    }

    .preset-container {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        max-height: 120px;
    }

    .custom-list {
        max-height: 80px;
    }
}

/* 
ライブラリ切り替えUI */
.library-switcher {
    margin-top: 1px;
    padding: 8px;
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
}

.library-switcher label {
    display: inline-block;
    margin-right: 8px;
    font-weight: bold;
    font-size: 12px;
}

.library-switcher select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
    background-color: white;
}

.auto-selection-status {
    margin-top: 5px;
    margin-left: 3px;
    padding: 4px 2px;
    background-color: #e8f5e8;
    border: 1px solid #4caf50;
    border-radius: 3px;
    font-size: 11px;
    color: #2e7d32;
    text-align: center;
    cursor: help;
    position: relative;
}

/* GPU詳細情報ツールチップ */
.gpu-details-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.4;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    display: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    max-width: 300px;
    white-space: normal;
    margin-bottom: 8px;
    pointer-events: none;
}

/* ツールチップが下に表示される場合のスタイル */
.gpu-details-tooltip.show-below {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 8px;
}

/* ツールチップの矢印（上向き - デフォルト） */
.gpu-details-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

/* ツールチップが下に表示される場合の矢印（下向き） */
.gpu-details-tooltip.show-below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #333;
}

/* 左寄せ表示時の矢印位置調整 */
.gpu-details-tooltip.align-left::after {
    left: 20px;
    transform: translateX(0);
}

/* 右寄せ表示時の矢印位置調整 */
.gpu-details-tooltip.align-right::after {
    left: auto;
    right: 20px;
    transform: translateX(0);
}

.auto-selection-status:hover .gpu-details-tooltip {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

.gpu-details-tooltip .gpu-info-section {
    margin-bottom: 8px;
}

.gpu-details-tooltip .gpu-info-section:last-child {
    margin-bottom: 0;
}

.gpu-details-tooltip .gpu-info-label {
    font-weight: bold;
    color: #4caf50;
}

.gpu-details-tooltip .gpu-info-value {
    margin-left: 4px;
}

.gpu-details-tooltip .gpu-reasons {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #555;
}

.gpu-details-tooltip .gpu-reason-item {
    margin-bottom: 2px;
    font-size: 10px;
    color: #ccc;
}

/* 必須店舗・施設設定セクション */
.required-section {
    margin-bottom: 15px;
}

.required-section h4 {
    margin-bottom: 8px;
    color: #333;
    font-size: 15px;
}

.required-enable-section {
    margin-bottom: 10px;
    padding: 8px;
    background-color: #fff3e0;
    border: 1px solid #ff9800;
    border-radius: 4px;
}

.required-enable-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #f57c00;
}

.required-enable-checkbox {
    margin-right: 8px;
    transform: scale(1.2);
}

.required-info {
    margin-bottom: 10px;
    padding: 6px 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
}

.required-chains-section {
    margin-bottom: 10px;
}

.required-chains-section h5 {
    margin-bottom: 6px;
    color: #333;
    font-size: 13px;
    font-weight: 600;
}

.required-chains-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px;
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fafafa;
}

.required-chain-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
    padding: 3px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.required-chain-item:hover {
    background-color: #f0f0f0;
}

.required-chain-item input[type="checkbox"] {
    margin-right: 6px;
    transform: scale(0.9);
}

.no-chains-message {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 15px;
    font-size: 13px;
}

/* モバイル用必須店舗・施設設定の追加スタイル */
@media (max-width: 768px) {
    .required-chains-container {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        max-height: 100px;
    }
}