/* ===================================
   レイアウト修正CSS
   編集エリアとFTPモーダルの余白問題を解決
   =================================== */

/* 記事編集ページの修正 */
/* カテゴリー選択エリアの余白を完全に削除（より高い優先度） */
body #editForm > div.mb-4:has(#category) {
    margin-bottom: 0 !important;
}

/* カテゴリー選択の次の要素の上余白を削除 */
body #editForm > div.mb-4:has(#category) + div {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 記事内容ラベルとツールバー間の余白を削除 */
body #editForm > div.mb-4:has(.editor-toolbar) > div:first-child {
    margin-bottom: 0 !important;
}

/* エディタツールバーの上下余白を調整 */
body .editor-toolbar {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* エディタツールバーとエディタ本体を密着させる */
body .editor-toolbar + div {
    margin-top: 0 !important;
}

/* エディタコンテナの余白調整 */
body div:has(> #editorWrapper) {
    margin-top: 0 !important;
}

/* mb-2クラスの余白を完全に削除 */
body #editForm .mb-2:has(.editor-toolbar) {
    margin-bottom: 0 !important;
}

/* FTPモーダルの修正 - 余白問題を解決 */
#ftpSelectModal .modal-dialog {
    /* コンテンツに応じてサイズを自動調整 */
    width: auto !important;
    max-width: 500px !important;
}

#ftpSelectModal .modal-content {
    /* 高さを自動調整 */
    height: auto !important;
}

#ftpSelectModal .modal-body {
    /* 固定高さとスクロールを完全に削除 */
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    padding: 1rem 1.25rem !important;
}

/* モーダルボディ内の余計な空白を削除 */
#ftpSelectModal .modal-body:before,
#ftpSelectModal .modal-body:after {
    content: none !important;
    display: none !important;
}

/* FTPプロファイルリストのスタイル調整 */
#ftpSelectModal .list-group {
    /* リストの余白を最適化 */
    margin-bottom: 0;
}

#ftpSelectModal .ftp-profile-item {
    /* アイテムの余白を適切に設定 */
    margin-bottom: 0.5rem;
}

#ftpSelectModal .ftp-profile-item:last-child {
    margin-bottom: 0;
}

/* FTPプロファイルが多い場合のみスクロール可能にする */
#ftpSelectModal .list-group:has(.ftp-profile-item:nth-child(5)) {
    max-height: 300px;
    overflow-y: auto;
}