/* ===============================
   ファイルアップロードエリア
   =============================== */
.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;
    }
}