/* ===============================
   ファイルアップロードエリア
   =============================== */
.file-upload-area {
    margin: 0;
}

.drop-zone {
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    padding: 40px 20px;
    background: #f8fafc;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover {
    background: #f1f5f9;
    border-color: #3b82f6;
}

.drop-zone.dragover {
    background: #eff6ff;
    border-color: #3b82f6;
}

.drop-zone-info {
    font-size: 14px;
    color: #64748b;
    margin-top: 10px;
}

.drop-zone-info-small {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 5px;
}

/* ===============================
   ファイルアコーディオン表示
   =============================== */
.file-preview-item {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.file-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.file-accordion-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
}

.file-accordion-toggle {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-accordion-toggle:hover {
    background: #f1f5f9;
}

.file-accordion-content {
    padding: 15px;
}

/* マッチしたファイルのスタイル */
.file-matched .file-accordion-header {
    background: #ebf5ff;
    border-color: #bfdbfe;
}

.file-matched .file-accordion-header h3 {
    color: #1e40af;
}

/* 非マッチファイルのスタイル */
.file-unmatched .file-accordion-header {
    background: #f8fafc;
}

/* 折りたたまれたファイル */
.file-collapsed {
    margin-bottom: 10px;
    background: #f8fafc;
}

/* ハイライト効果 */
.highlight-preview {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    animation: highlight-pulse 1.5s;
}

@keyframes highlight-pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* ===============================
   コピーボタン
   =============================== */
.copy-button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.copy-button-group button {
    min-width: 150px;
}

/* ===============================
   CodeMirrorカスタマイズ
   =============================== */
.CodeMirror {
    width: 100% !important;
    min-width: 600px;
    border-radius: 8px;
    padding: 10px 0;
    font-family: 'JetBrains Mono', monospace;
    height: auto !important;
    min-height: 300px;
    border: 1px solid #e2e8f0;
}

.CodeMirror-scroll {
    width: 100% !important;
    min-height: 300px;
}

.CodeMirror-sizer {
    min-width: 600px !important;
    width: 100% !important;
}

.CodeMirror-gutter-wrapper {
    left: -50px !important;
}

.CodeMirror-lines {
    padding: 10px 0;
    width: 100%;
}

.CodeMirror-line {
    padding: 0 12px !important;
}

/* エディタ内のハイライトスタイル */
.cm-searchMatch {
    background-color: rgba(255, 230, 0, 0.3) !important;
    color: #000 !important;
    outline: 1px solid rgba(255, 165, 0, 0.5) !important;
}

.cm-activeLine {
    background-color: rgba(59, 130, 246, 0.2) !important;
    animation: fade-highlight 2s !important;
}

@keyframes fade-highlight {
    0% { background-color: rgba(59, 130, 246, 0.4); }
    100% { background-color: rgba(59, 130, 246, 0.1); }
}

/* テキストエリアの表示設定 */
#code-content {
    display: block !important;
    width: 100%;
    min-height: 300px;
}

/* ===============================
   フォーム要素
   =============================== */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #1e293b;
    font-weight: 500;
}

.file-type-group {
    margin-bottom: 20px;
}

.radio-group {
    display: flex;
    gap: 20px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
}

.radio-label {
    padding: 8px 16px;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
}

.radio-label:hover {
    background: #f1f5f9;
}

input[type="radio"] {
    margin: 0;
}

input[type="radio"]:checked + .radio-label {
    background: #3b82f6;
    color: #fff;
}

#file-name {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.3s ease;
}

#file-name:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* ===============================
   ファイルリスト
   =============================== */
.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.file-list-item {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.file-list-item:hover {
    background: #f1f5f9;
}

.file-search {
    margin-bottom: 15px;
}

#file-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.3s ease;
}

#file-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.sidebar-info {
    margin-top: 20px;
    font-size: 13px;
    color: #64748b;
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
}

/* ===============================
   検索結果
   =============================== */
#search-results {
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: block !important;
    min-height: 50px;
}

.search-summary {
    padding: 10px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 500;
    color: #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-actions {
    display: flex;
    gap: 8px;
}

.button-small {
    font-size: 12px !important;
    padding: 4px 8px !important;
    min-height: 26px !important;
}

.search-result-item {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-item h4 {
    margin: 0;
    font-size: 14px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-actions {
    display: flex;
    gap: 10px;
}

.button-link {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: 13px;
}

.button-link:hover {
    color: #2563eb;
}

.match-count {
    font-size: 12px;
    color: #64748b;
    font-weight: normal;
}

.matched-lines {
    max-height: 200px;
    overflow-y: auto;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin-top: 10px;
}

.matched-line {
    padding: 5px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.matched-line:hover {
    background: #e2e8f0;
}

.matched-line:last-child {
    border-bottom: none;
}

.line-number {
    display: inline-block;
    min-width: 50px;
    color: #64748b;
    font-weight: 500;
}

.matched-line pre {
    display: inline;
    margin: 0;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 非マッチファイルセクション */
.unmatched-files-section {
    margin-top: 15px;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
}

.unmatched-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
}

.unmatched-header h4 {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

.unmatched-list {
    max-height: 200px;
    overflow-y: auto;
    background: #f8fafc;
    border-radius: 6px;
    margin-top: 5px;
    border: 1px solid #e2e8f0;
}

.unmatched-file-item {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.unmatched-info {
    padding: 10px 12px;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    text-align: center;
}

/* ファイル表示状態 */
.file-hidden {
    display: none;
}

/* ===============================
   ブログリスト非表示
   =============================== */
#search-results ul.p-postList,
.p-postList.-type-card,
ul.p-postList.-pc-col3.-sp-col2 {
    display: none !important;
}

/* ===============================
   レスポンシブ対応
   =============================== */
@media screen and (max-width: 1200px) {
    .cfm-container {
        flex-direction: column;
    }
    
    .cfm-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        height: auto;
        margin-bottom: 20px;
    }
    
    .file-list {
        max-height: 200px;
    }
}

/* ===============================
   ファイル階層ツリー
   =============================== */
#file-tree-container {
    margin-top: 20px;
}

#file-tree-header {
    font-size: 16px;
    color: #1e293b;
    margin: 0 0 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    word-break: break-all;
}

.file-tree {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    padding: 8px 0;
}

.file-tree-root {
    list-style: none;
    margin: 0;
    padding: 0;
}

.folder-item, 
.file-tree-item {
    padding: 6px 8px 6px 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
}

.folder-item {
    color: #1e293b;
    font-weight: 500;
}

.file-tree-item {
    color: #475569;
    padding-left: 20px;
}

.folder-item:hover,
.file-tree-item:hover {
    background: #f1f5f9;
}

.folder-icon,
.file-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.folder-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%236366f1"><path d="M2 6a2 2 0 0 1 2-2h5l2 2h9a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6z"/></svg>');
}

.folder-item:hover .folder-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234f46e5"><path d="M2 6a2 2 0 0 1 2-2h5l2 2h9a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6z"/></svg>');
}

.folder-content {
    display: none;
    list-style: none;
    margin: 0;
    padding-left: 18px;
}

.folder-expanded {
    display: block;
}

/* ファイルアイコン */
.file-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23475569"><path d="M14,2H6C4.9,2,4,2.9,4,4v16c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V6L14,2z M14,8V4l4,4H14z"/></svg>');
}

.file-icon-php {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23777BB4"><path d="M14,2H6C4.9,2,4,2.9,4,4v16c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V6L14,2z M14,8V4l4,4H14z"/></svg>');
}

.file-icon-html {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23E34F26"><path d="M14,2H6C4.9,2,4,2.9,4,4v16c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V6L14,2z M14,8V4l4,4H14z"/></svg>');
}

.file-icon-css {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%231572B6"><path d="M14,2H6C4.9,2,4,2.9,4,4v16c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V6L14,2z M14,8V4l4,4H14z"/></svg>');
}

.file-icon-js {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23F7DF1E"><path d="M14,2H6C4.9,2,4,2.9,4,4v16c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V6L14,2z M14,8V4l4,4H14z"/></svg>');
}

/* ファイルツリーのレスポンシブ対応 */
@media screen and (max-width: 1200px) {
    .file-tree {
        max-height: 300px;
    }
}


/* ===============================
   仮想スクロール関連スタイル
   =============================== */

.virtual-scroll-container {
    margin: 20px 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.virtual-scroll-header {
    padding: 15px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.file-counter {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.virtual-scroll-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-prev-page, .btn-next-page {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-prev-page:hover, .btn-next-page:hover {
    background: #2563eb;
}

.btn-prev-page:disabled, .btn-next-page:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.page-info {
    font-size: 13px;
    color: #64748b;
    padding: 0 8px;
    min-width: 40px;
    text-align: center;
}

.items-per-page {
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
}

.virtual-scroll-content {
    min-height: 200px;
    max-height: 80vh;
    overflow-y: auto;
}

/* 仮想ファイルアイテムのスタイル */
.virtual-file-item {
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

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

.virtual-file-item .file-accordion-header {
    padding: 12px 20px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.virtual-file-item.file-collapsed .file-accordion-header {
    background: #f8fafc;
}

.virtual-file-item h3 {
    margin: 0;
    font-size: 14px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    word-break: break-all;
}

.file-number {
    background: #3b82f6;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    min-width: 30px;
    text-align: center;
}

.file-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-sm {
    font-size: 12px !important;
    padding: 4px 8px !important;
    min-height: 24px !important;
    border-radius: 4px;
}

.btn-remove-file {
    background: #ef4444;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-remove-file:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.virtual-file-item .file-accordion-content {
    padding: 15px 20px;
    background: #fff;
}

.virtual-file-item.file-collapsed .file-accordion-content {
    display: none;
}

/* ハイライト効果の強化 */
.virtual-file-item.highlight-preview {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    animation: highlight-pulse-virtual 2s;
}

@keyframes highlight-pulse-virtual {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* 進行状況バーのスタイル */
.processing-indicator .progress-bar {
    margin-top: 15px;
}

.processing-indicator .progress-fill {
    background: linear-gradient(90deg, #3b82f6, #60a5fa, #3b82f6);
    background-size: 200% 100%;
    animation: progress-shimmer 1.5s infinite;
}

@keyframes progress-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* メモリ使用量警告表示 */
.memory-warning {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fef3c7;
    color: #92400e;
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid #fcd34d;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    font-size: 13px;
    max-width: 300px;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
    .virtual-scroll-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .virtual-scroll-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .virtual-file-item .file-accordion-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .file-actions {
        justify-content: flex-end;
    }
    
    .virtual-file-item h3 {
        font-size: 13px;
    }
    
    .file-number {
        align-self: flex-start;
    }
}

@media screen and (max-width: 480px) {
    .virtual-scroll-header {
        padding: 10px 15px;
    }
    
    .virtual-file-item .file-accordion-header {
        padding: 10px 15px;
    }
    
    .virtual-file-item .file-accordion-content {
        padding: 10px 15px;
    }
    
    .virtual-scroll-controls {
        font-size: 11px;
    }
    
    .btn-prev-page, .btn-next-page {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* 既存のプレビューエリアを非表示（仮想スクロール使用時） */
.virtual-scroll-active #file-preview {
    display: none;
}


/* ===============================
   リセットボタンのスタイル
   =============================== */

.nav-tab-reset {
    background: #ef4444 !important;
    color: #fff !important;
    margin-left: auto;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
}

.nav-tab-reset:hover {
    background: #dc2626 !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.nav-tab-reset:focus {
    background: #dc2626 !important;
    color: #fff !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

/* 確認ダイアログのスタイル */
.reset-confirmation-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: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reset-confirmation-modal.show {
    opacity: 1;
}

.reset-confirmation-content {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.reset-confirmation-modal.show .reset-confirmation-content {
    transform: scale(1);
}

.reset-confirmation-content h3 {
    margin: 0 0 15px;
    color: #ef4444;
    font-size: 18px;
}

.reset-confirmation-content p {
    margin: 0 0 25px;
    color: #64748b;
    line-height: 1.5;
}

.reset-confirmation-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.reset-confirm-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.reset-confirm-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.reset-cancel-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-cancel-btn:hover {
    background: #e2e8f0;
}

/* リセット成功メッセージ */
.reset-success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    z-index: 10001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.reset-success-message.show {
    transform: translateX(0);
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
    .nav-tab-wrapper {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .nav-tab-reset {
        margin-left: 0;
        width: 100%;
        order: 3;
    }
    
    .reset-confirmation-content {
        padding: 20px;
        margin: 20px;
    }
}