/* 全体のフォント設定 */
body, .faq-item, .category-header, .subcategory-header, .faq-question, .faq-category {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* rightContentの高さ調整と固定位置 */
#rightContent {
    height: calc(100vh - 0rem);
    width: 100%;
    position: sticky;
    top: 2rem;
    overflow-y: auto;
    background: white;
    z-index: 10;
}

/* 右画面の編集フォームを縮小 */
#rightContent .edit-form {
    padding: 0.5rem !important;
}

#rightContent .form-label {
    font-size: 0.75rem !important;
    margin-bottom: 0.25rem !important;
}

#rightContent .form-input,
#rightContent .form-textarea {
    padding: 0.25rem !important;
    font-size: 0.8rem !important;
}

#rightContent .form-textarea {
    min-height: 50px !important;
}

#rightContent h2 {
    font-size: 0.8rem !important;
    margin-bottom: 0.5rem !important;
}

#rightContent .btn {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.75rem !important;
}

#rightContent [style*="margin-bottom: 1rem"] {
    margin-bottom: 0.5rem !important;
}

#rightContent [style*="gap: 1rem"] {
    gap: 0.5rem !important;
}

/* 設定画面の余白削除 */
.content-right:has(.config-preview) {
    padding: 0;
}

/* 設定画面プレビュー */
.config-preview {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.preview-header {
    padding: 0.5rem;
    background: #e3f2fd;
    border-bottom: 1px solid #bbdefb;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.preview-iframe {
    width: 100%;
    flex: 1;
    border: none;
}

/* 検索・フィルター */
.search-box {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.filter-controls {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.filter-select {
    width: 100%;
    padding: 0.3rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.8rem;
}

/* FAQ一覧 */
.faq-item {
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid #e6f3ff;
    background: #fafafa; /* 薄いグレー背景を追加 */
}

.faq-item:hover {
    background: #f0f0f0; /* ホバー時はより濃いグレー */
    border-color: #007bff;
    border-left-color: #007bff;
}

.faq-item.selected {
    background: #e3f2fd;
    border-color: #2196f3;
    border-left-color: #2196f3;
}

.faq-question {
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.faq-category {
    font-size: 0.8rem;
    color: #666;
    background: #f0f0f0;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    display: inline-block;
    margin-right: 0.5rem;
}

.faq-visibility {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    display: inline-block;
}

.faq-visibility.status-visible {
    background: #d4edda;
    color: #155724;
}

.faq-visibility.status-hidden {
    background: #f8d7da;
    color: #721c24;
}

/* フォーム */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 0.375rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* ボタン */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

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

.btn-success {
    background: #10b981;
    color: white;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    text-align: center;
}

/* カテゴリ表示 */
.category-header {
    padding: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-left: 4px solid #007acc;
}

.category-header:hover {
    background: #e9ecef;
    border-left-color: #0056b3;
}

.subcategory-header {
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-left: 4px solid #b3d9ff;
}

.subcategory-header:hover {
    background: #f8f9fa;
    border-left-color: #007acc;
}

.category-content, .subcategory-content {
    margin-left: 1rem;
    margin-bottom: 0.5rem;
}

/* FAQ項目の階層インデント - padding-leftを使用 */
.faq-item.child {
    border-left-color: #b3d9ff !important;
}

.faq-item.grandchild {
    border-left-color: #80c7ff !important;
}

.faq-item.level-3 {
    border-left-color: #4db5ff !important;
}

.faq-item.level-4 {
    border-left-color: #1aa3ff !important;
}

.faq-item.level-5 {
    border-left-color: #0080ff !important;
}

.faq-item.level-6 {
    border-left-color: #0066cc !important;
}

/* インラインスタイルを完全に無効化 - 削除 */

.arrow {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

/* FAQ編集画面の矢印は左寄せ */
.category-header .arrow,
.subcategory-header .arrow,
.faq-item .arrow {
    margin-left: 0;
    margin-right: 0.25rem;
}

/* FAQ編集画面専用のスクロール修正 */
#leftContent {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4rem);
    overflow: hidden;
}

#faqList {
    overflow-y: auto;
    margin-bottom: 0;
    padding-bottom: 0;
    flex: 1;
}

#faqEditForm {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}
.popular-item {
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popular-question {
    flex: 1;
    font-size: 0.9rem;
}

.popular-controls {
    display: flex;
    gap: 0.5rem;
}

.move-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
}

.move-btn:hover {
    background: #f8f9fa;
}

.move-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* 統合版アクションボタンのスタイル */
.btn-action {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-action:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn-action.btn-add {
    color: #28a745;
}

.btn-action.btn-add:hover {
    background: #d4edda;
    border-color: #28a745;
}

.btn-action.btn-remove {
    color: #dc3545;
}

.btn-action.btn-remove:hover {
    background: #f8d7da;
    border-color: #dc3545;
}

.category-actions,
.faq-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.category-header:hover .category-actions,
.subcategory-header:hover .category-actions,
.faq-item:hover .faq-actions {
    opacity: 1;
}

/* よくある質問ポップアップのスタイル */
.popular-faq-item {
    transition: background-color 0.2s;
}

.popular-faq-item:hover {
    background-color: #e9ecef !important;
}

/* ＋ボタンのスタイル */
.add-btn {
    opacity: 0.8;
    transition: all 0.2s;
    flex-shrink: 0;
}

.add-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* 新規FAQ選択アニメーション */
@keyframes pulse-selection {
    0% {
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(0, 123, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    }
}
/* 画像挿入ボタン */
.image-insert-container {
    margin-bottom: 10px;
}

.image-insert-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.image-insert-btn:hover {
    background: #218838;
}

/* 画像選択モーダル */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.image-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80%;
    display: flex;
    flex-direction: column;
}

.image-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.image-modal-header h3 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.image-modal-tabs {
    display: flex;
    padding: 0 20px;
    border-bottom: 1px solid #ddd;
}

.image-modal-tabs .tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.image-modal-tabs .tab-btn.active {
    border-bottom-color: #007bff;
    color: #007bff;
}

.modal-upload-area {
    padding: 10px 20px;
    border-bottom: 1px solid #eee;
}

.modal-upload-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    color: #888;
    font-size: 13px;
    transition: border-color 0.2s;
}

.modal-upload-dropzone:hover,
.modal-upload-dropzone.dragover {
    border-color: #4a90d9;
    background: #f0f7ff;
}

.modal-upload-link {
    color: #4a90d9;
    text-decoration: underline;
}

.modal-upload-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 13px;
}

.modal-upload-status span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-upload-btn {
    background: #0891b2;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.modal-upload-btn:hover { background: #0e7490; }
.modal-upload-btn:disabled { background: #9ca3af; cursor: not-allowed; }

.modal-upload-cancel {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #999;
}

.image-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.modal-image-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.modal-image-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.modal-image-preview {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.modal-image-name {
    padding: 8px;
    font-size: 12px;
    color: #666;
    text-align: center;
    word-break: break-all;
}

.modal-images-grid .loading,
.modal-images-grid .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
}
/* リッチテキストエディタ */
.editor-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.editor-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 8px;
}

.editor-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s ease;
}

.editor-tab:hover {
    color: #495057;
    background: #f8f9fa;
}

.editor-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: white;
}

.rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.editor-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.editor-btn:hover {
    background: #e9ecef;
}

.editor-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.editor-mode-btn {
    font-weight: bold;
    min-width: auto;
    padding: 4px 12px;
}

.editor-mode-btn.active {
    background: #28a745;
    border-color: #28a745;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 4px;
}

.editor-content {
    position: relative;
}

.rich-editor {
    min-height: 120px;
    padding: 12px;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    background: #fff;
}

.rich-editor:focus {
    background: #fff;
}

.rich-editor p {
    margin: 0 0 8px 0;
}

.rich-editor ul {
    margin: 8px 0;
    padding-left: 20px;
}

.rich-editor img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.rich-editor a {
    color: #007bff;
    text-decoration: underline;
}

/* HTML編集モード時のテキストエリア調整 */
.editor-container .form-textarea {
    border: none;
    border-radius: 0;
    resize: vertical;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: #f8f9fa;
}

/* Quillエディタ調整 */
.editor-container .ql-toolbar {
    border: none;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
}

.editor-container .ql-container {
    border: none;
    font-size: 14px;
}

.editor-container .ql-editor {
    min-height: 250px;
}

.editor-container .ql-editor img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   FAQ UI改善 - 2026年2月2日追加
   ======================================== */

/* アコーディオンのスムーズなアニメーション */
.category-content, .subcategory-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    display: block !important;
}

.category-content:not(.open), .subcategory-content:not(.open) {
    max-height: 0;
    opacity: 0;
}

.category-content.open, .subcategory-content.open {
    max-height: 5000px;
    opacity: 1;
}

/* 初回読み込み時のフェードインアニメーション */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.initial-load .faq-item,
body.initial-load .category-header,
body.initial-load .subcategory-header {
    animation: fadeInUp 0.5s ease-out both;
}

body.initial-load .category-header:nth-of-type(1) { animation-delay: 0s; }
body.initial-load .category-header:nth-of-type(2) { animation-delay: 0.1s; }
body.initial-load .category-header:nth-of-type(3) { animation-delay: 0.2s; }
body.initial-load .category-header:nth-of-type(4) { animation-delay: 0.3s; }
body.initial-load .category-header:nth-of-type(5) { animation-delay: 0.4s; }

body.initial-load .faq-item:nth-child(1) { animation-delay: 0s; }
body.initial-load .faq-item:nth-child(2) { animation-delay: 0.05s; }
body.initial-load .faq-item:nth-child(3) { animation-delay: 0.1s; }
body.initial-load .faq-item:nth-child(4) { animation-delay: 0.15s; }
body.initial-load .faq-item:nth-child(5) { animation-delay: 0.2s; }
body.initial-load .faq-item:nth-child(n+6) { animation-delay: 0.25s; }

/* サブカテゴリヘッダーのpadding統一 */
.subcategory-header {
    padding-left: 15px !important;
}

/* カテゴリ削除ボタンを非表示 */
button.delete-btn,
.subcategory-header .delete-btn,
.category-header .delete-btn {
    display: none !important;
}

/* FAQ項目の階層ごとの色分け（左ボーダー） */
.faq-item:not(.child):not(.grandchild):not(.level-3):not(.level-4):not(.level-5):not(.level-6) {
    border-left-color: #007bff !important;
    border-left-width: 5px !important;
}

.faq-item.child {
    border-left-color: #28a745 !important;
    border-left-width: 5px !important;
}

.faq-item.grandchild {
    border-left-color: #fd7e14 !important;
    border-left-width: 5px !important;
}

.faq-item.level-3 {
    border-left-color: #6f42c1 !important;
    border-left-width: 5px !important;
}

.faq-item.level-4 {
    border-left-color: #e83e8c !important;
    border-left-width: 5px !important;
}

.faq-item.level-5 {
    border-left-color: #795548 !important;
    border-left-width: 5px !important;
}

/* バリデーションエラー表示 */
.faq-item.validation-error {
    background-color: #ffebee !important;
    border: 2px solid #f44336 !important;
    animation: pulse-error 2s infinite;
}

@keyframes pulse-error {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }
}
