/* ===============================
   基本レイアウト
   =============================== */
.cfm-container {
    display: flex;
    gap: 30px;
    padding: 20px;
    margin: 20px auto;
    background: #f8fafc;
    position: relative;
}

.cfm-sidebar {
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 32px;
    height: calc(100vh - 150px);
    overflow-y: auto;
}

.cfm-main {
    flex: 1;
    min-width: 0; /* Flexboxのバグ防止 */
}

/* ===============================
   サイドバー検索
   =============================== */
.search-container {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-container h3 {
    font-size: 16px;
    color: #1e293b;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.search-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

#search-target {
    width: 100%;
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
}

/* ===============================
   タブナビゲーション
   =============================== */
.nav-tab-wrapper {
    margin: 0 0 20px 0;
    border: none;
    background: #fff;
    padding: 5px;
    border-radius: 8px;
    display: inline-flex;
    gap: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-tab {
    float: none;
    border: none;
    margin: 0;
    padding: 10px 20px;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-tab:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.nav-tab-active {
    background: #3b82f6 !important;
    color: #fff !important;
    font-weight: 500;
}

/* ===============================
   タブコンテンツ
   =============================== */
.tab-content {
    display: none;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tab-content.active {
    display: block;
    opacity: 1;
}

/* ===============================
   検索結果
   =============================== */
#search-results {
    margin-top: 15px;
    max-height: 500px;
    overflow-y: auto;
}

/* ===============================
   ボタンスタイル
   =============================== */
.button-primary {
    background: #3b82f6;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    color: #fff;
    font-weight: 500;
    transition: all 0.3s ease;
}

.button-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.button-secondary {
    background: #f1f5f9;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    color: #475569;
    transition: all 0.3s ease;
}

.button-secondary:hover {
    background: #e2e8f0;
}

/* ===============================
   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;
}

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

/* ===============================
   ブログの投稿リストを非表示
   =============================== */
#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;
    }
}