/* Simple Markdown to PowerPoint CSS - 更新版（テキストボックス統合・リスト統合対応） */

.simple-markdown-to-ppt-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.simple-markdown-to-ppt-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1400px;
    margin: 20px auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* Header Controls */
.simple-editor-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.simple-header-left {
    display: flex;
    gap: 20px;
}

.simple-header-right .simple-status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
}

.simple-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #28a745;
}

.simple-status-dot.ready {
    background: #48bb78;
    animation: none;
}

.simple-status-dot.error {
    background: #f56565;
    animation: none;
}

/* Main Editor Area - 2 Columns */
.simple-main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 800px;
}

/* Left Column: Original Markdown */
.simple-input-section {
    background: #f8f9ff;
    border-right: 2px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

/* Right Column: HTML Preview */
.simple-output-section {
    background: #fff;
    display: flex;
    flex-direction: column;
}

.simple-section-header {
    background: #4a5568;
    color: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1.3rem;
    font-weight: 600;
}

.simple-input-section .simple-section-header {
    background: #2b6cb0;
}

.simple-output-section .simple-section-header {
    background: #38a169;
}

.simple-markdown-input {
    width: 100%;
    height: 550px;
    border: none;
    padding: 30px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.8;
    resize: none;
    background: #f8f9ff;
    color: #2d3748;
    box-sizing: border-box;
}

.simple-markdown-input:focus {
    outline: none;
    background: #fff;
    box-shadow: inset 0 0 0 3px #667eea;
}

.simple-auto-split-rules {
    background: #e8f4fd;
    border-top: 1px solid #0ea5e9;
    padding: 25px 30px;
}

.simple-auto-split-rules h4 {
    margin: 0 0 15px 0;
    color: #0ea5e9;
    font-size: 1.1rem;
}

.simple-auto-split-rules ul {
    margin: 0;
    padding-left: 25px;
}

.simple-auto-split-rules li {
    margin-bottom: 8px;
    color: #0369a1;
    font-size: 1rem;
}

/* HTML Preview Container */
.simple-html-preview-container {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    max-height: 550px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.simple-no-splits-message {
    text-align: center;
    color: #6c757d;
    padding: 80px 30px;
    font-style: italic;
    font-size: 1.1rem;
}

/* Split Preview Sections - 統合テキストボックス対応 */
.simple-split-preview-section {
    background: #f8f9fa;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 25px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.simple-split-preview-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.simple-split-preview-section.section-1 {
    border-color: #4facfe;
}

.simple-split-preview-section.section-2 {
    border-color: #38a169;
}

.simple-split-preview-section.section-3 {
    border-color: #ed8936;
}

.simple-split-preview-section.section-4 {
    border-color: #ec4899;
}

/* Split Preview Header */
.simple-split-preview-header {
    background: #e2e8f0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #cbd5e0;
}

.simple-split-preview-section.section-1 .simple-split-preview-header {
    background: #4facfe;
    color: white;
}

.simple-split-preview-section.section-2 .simple-split-preview-header {
    background: #38a169;
    color: white;
}

.simple-split-preview-section.section-3 .simple-split-preview-header {
    background: #ed8936;
    color: white;
}

.simple-split-preview-section.section-4 .simple-split-preview-header {
    background: #ec4899;
    color: white;
}

.simple-section-number {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 1.1rem;
}

.simple-section-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    color: #4facfe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.simple-split-preview-section.section-1 .simple-section-badge {
    color: #4facfe;
}

.simple-split-preview-section.section-2 .simple-section-badge {
    color: #38a169;
}

.simple-split-preview-section.section-3 .simple-section-badge {
    color: #ed8936;
}

.simple-split-preview-section.section-4 .simple-section-badge {
    color: #ec4899;
}

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

.simple-delete-section-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: #dc3545;
    color: white;
}

.simple-delete-section-btn:hover {
    background: #c82333;
    transform: scale(1.15);
}

/* Split Preview Content - 統合テキストボックス対応 */
.simple-split-preview-content {
    padding: 0;
    background: white;
    position: relative;
}

.simple-direct-editable-area {
    padding: 25px;
    background: white;
    min-height: 120px;
    border: 2px solid transparent;
    outline: none;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    line-height: 1.7;
    font-size: 15px;
    color: #2d3748;
    cursor: text;
}

.simple-direct-editable-area:focus {
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.simple-direct-editable-area:hover {
    background: #f8f9fa;
    border-color: #e2e8f0;
}

.simple-direct-editable-area.empty::before {
    content: "ここで直接編集できます...";
    color: #a0aec0;
    font-style: italic;
    pointer-events: none;
}

/* 統合テキストボックススタイル - 分割しないコンテンツ */
.simple-unified-textbox {
    background: #fef8e7;
    border: 2px dashed #f6cc50;
    border-radius: 12px;
    padding: 25px;
    margin: 15px 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
}

.simple-unified-textbox::before {
    content: "📝 統合テキストボックス";
    position: absolute;
    top: -12px;
    left: 15px;
    background: #fef8e7;
    padding: 0 10px;
    font-size: 12px;
    font-weight: bold;
    color: #d69e2e;
}

.simple-unified-textbox .simple-textbox-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    line-height: 1.6;
    color: #2d3748;
    font-size: 16px;
    border: 1px solid #f6cc50;
}

/* 統合リストスタイル - リストを1つにまとめる */
.simple-unified-list {
    background: #f0fff4;
    border: 2px dashed #48bb78;
    border-radius: 12px;
    padding: 25px;
    margin: 15px 0;
    position: relative;
}

.simple-unified-list::before {
    content: "📋 統合リスト";
    position: absolute;
    top: -12px;
    left: 15px;
    background: #f0fff4;
    padding: 0 10px;
    font-size: 12px;
    font-weight: bold;
    color: #38a169;
}

.simple-unified-list ul {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 0;
    list-style-type: none;
    border: 1px solid #48bb78;
}

.simple-unified-list li {
    margin: 12px 0;
    padding: 8px 0 8px 25px;
    position: relative;
    color: #2d3748;
    font-size: 16px;
    line-height: 1.6;
    border-bottom: 1px solid #e6fffa;
}

.simple-unified-list li:last-child {
    border-bottom: none;
}

.simple-unified-list li::before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #38a169;
    font-weight: bold;
}

/* Bottom Controls */
.simple-editor-footer {
    background: #f1f3f5;
    border-top: 1px solid #dee2e6;
    padding: 25px 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.simple-footer-center {
    display: flex;
    gap: 20px;
    align-items: center;
}

.simple-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
    text-decoration: none;
    display: inline-block;
}

.simple-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.simple-btn-primary {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.simple-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
    color: white;
    text-decoration: none;
}

.simple-btn-secondary {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

.simple-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.3);
    color: white;
    text-decoration: none;
}

.simple-btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.simple-btn-success:hover {
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
}

.simple-loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Section Separator */
.simple-section-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.simple-section-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, transparent, #dc3545, transparent);
    z-index: 1;
}

.simple-section-separator-text {
    background: white;
    padding: 8px 20px;
    color: #dc3545;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid #dc3545;
    border-radius: 20px;
    position: relative;
    z-index: 2;
    display: inline-block;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .simple-main-content {
        grid-template-columns: 1fr;
    }
    
    .simple-input-section {
        border-right: none;
        border-bottom: 2px solid #e2e8f0;
    }
    
    .simple-markdown-input {
        height: 400px;
    }
    
    .simple-html-preview-container {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .simple-editor-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px 25px;
    }
    
    .simple-editor-footer {
        flex-direction: column;
        gap: 15px;
        padding: 20px 25px;
    }
    
    .simple-footer-center {
        order: -1;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .simple-split-preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .simple-markdown-input {
        padding: 20px;
        font-size: 14px;
    }
    
    .simple-html-preview-container {
        padding: 20px;
    }
    
    .simple-direct-editable-area {
        padding: 20px;
        font-size: 14px;
    }
}

/* WordPress テーマとの競合を防ぐ */
.simple-markdown-to-ppt-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

.simple-markdown-to-ppt-container * {
    box-sizing: border-box !important;
}

/* プレビュー内のマークダウン表示の改善 - ヘッダー独立表示対応 */
.simple-direct-editable-area h1,
.simple-direct-editable-area h2,
.simple-direct-editable-area h3,
.simple-direct-editable-area h4,
.simple-direct-editable-area h5,
.simple-direct-editable-area h6 {
    margin: 20px 0 15px 0 !important; /* マージンを調整 */
    padding: 12px 0 !important; /* パディングを追加 */
    font-weight: 600 !important;
    line-height: 1.4 !important;
    background: none !important; /* 背景をクリア */
    border-radius: 0 !important; /* 角丸をクリア */
}

.simple-direct-editable-area h1 {
    font-size: 2.2rem !important; /* フォントサイズを拡大 */
    color: #2563eb !important; /* 青色 */
    border-bottom: 3px solid #2563eb !important;
    padding-bottom: 15px !important;
}

.simple-direct-editable-area h2 {
    font-size: 1.8rem !important; /* フォントサイズを拡大 */
    color: #2563eb !important; /* 青色 */
    border-bottom: 2px solid #3b82f6 !important;
    padding-bottom: 10px !important;
}

.simple-direct-editable-area h3 {
    font-size: 1.4rem !important; /* フォントサイズを拡大 */
    color: #1d4ed8 !important; /* 青色 */
    border-bottom: 1px solid #60a5fa !important;
    padding-bottom: 8px !important;
}

/* ヘッダーを統合テキストボックスから除外するスタイル */
.simple-unified-textbox .simple-textbox-content h1,
.simple-unified-textbox .simple-textbox-content h2,
.simple-unified-textbox .simple-textbox-content h3 {
    /* ヘッダーが統合テキストボックス内に入った場合の緊急対応 */
    margin: 0 !important;
    padding: 8px 0 !important;
    background: #f0f7ff !important;
    border-left: 4px solid #2563eb !important;
    padding-left: 12px !important;
}

/* 統合テキストボックス内での通常テキスト処理 */
.simple-unified-textbox .simple-textbox-content p,
.simple-unified-textbox .simple-textbox-content div {
    margin: 12px 0 !important; /* マージンを調整 */
    padding: 0 !important;
    line-height: 1.7 !important; /* 行間を拡大 */
    color: #374151 !important; /* テキスト色を調整 */
}

.simple-unified-textbox .simple-textbox-content strong,
.simple-unified-textbox .simple-textbox-content b {
    font-weight: 600 !important;
    color: #1f2937 !important;
}

/* 統合リスト内でのリスト処理 */
.simple-direct-editable-area ul,
.simple-direct-editable-area ol {
    margin: 0 0 18px 0 !important;
    padding: 0 0 0 25px !important;
    list-style-position: outside !important;
}

.simple-direct-editable-area li {
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
    line-height: 1.7 !important;
    color: #4a5568 !important;
}

.simple-direct-editable-area li:last-child {
    margin-bottom: 0 !important;
}

.simple-direct-editable-area p {
    margin: 0 0 15px 0 !important;
    padding: 0 !important;
    line-height: 1.7 !important;
    color: #4a5568 !important;
}

.simple-direct-editable-area p:last-child {
    margin-bottom: 0 !important;
}

.simple-direct-editable-area strong,
.simple-direct-editable-area b {
    font-weight: 600 !important;
    color: #2d3748 !important;
}

.simple-direct-editable-area em,
.simple-direct-editable-area i {
    font-style: italic !important;
    color: #718096 !important;
}

.simple-direct-editable-area code {
    background: #f1f5f9 !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    font-family: 'Courier New', monospace !important;
    font-size: 0.9em !important;
    color: #e53e3e !important;
    border: none !important;
    box-shadow: none !important;
}

/* 特別な統合処理指示のスタイル */
.simple-content-merge-indicator {
    background: #fff2cd;
    border: 2px dashed #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    text-align: center;
    font-weight: bold;
    color: #856404;
    font-size: 14px;
}

.simple-content-merge-indicator::before {
    content: "🔗 ";
}

/* 統合指示が含まれているセクションのマーク */
.simple-split-preview-section.has-merge-instruction {
    border-left: 5px solid #ffc107;
}

.simple-split-preview-section.has-merge-instruction .simple-split-preview-header {
    background: linear-gradient(135deg, #ffc107 0%, #ffed4e 100%) !important;
    color: #744210 !important;
}

.simple-split-preview-section.has-merge-instruction .simple-section-badge {
    background: #744210 !important;
    color: white !important;
}

/* 結合モード時のヘッダーカラー調整 */
.simple-direct-editable-area h1,
.simple-direct-editable-area h2,
.simple-direct-editable-area h3,
.simple-direct-editable-area h4,
.simple-direct-editable-area h5,
.simple-direct-editable-area h6 {
    margin: 20px 0 15px 0 !important;
    padding: 12px 0 !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    background: none !important;
    border-radius: 0 !important;
}

.simple-direct-editable-area h1 {
    font-size: 2.2rem !important;
    color: #2563eb !important; /* 青色 */
    border-bottom: 3px solid #2563eb !important;
    padding-bottom: 15px !important;
}

.simple-direct-editable-area h2 {
    font-size: 1.8rem !important;
    color: #2563eb !important; /* 青色 */
    border-bottom: 2px solid #3b82f6 !important;
    padding-bottom: 10px !important;
}

.simple-direct-editable-area h3 {
    font-size: 1.4rem !important;
    color: #1d4ed8 !important; /* 青色 */
    border-bottom: 1px solid #60a5fa !important;
    padding-bottom: 8px !important;
}

/* 統合テキストボックスの改良 - 黒文字テキスト */
.simple-unified-textbox {
    background: #fef8e7;
    border: 2px dashed #f6cc50;
    border-radius: 12px;
    padding: 25px;
    margin: 15px 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
}

.simple-unified-textbox::before {
    content: "📝 統合テキストボックス";
    position: absolute;
    top: -12px;
    left: 15px;
    background: #fef8e7;
    padding: 0 10px;
    font-size: 12px;
    font-weight: bold;
    color: #d69e2e;
}

.simple-unified-textbox .simple-textbox-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    line-height: 1.6;
    color: #2d3748 !important; /* 黒文字 */
    font-size: 16px;
    border: 1px solid #f6cc50;
}

/* 統合リストの改良 - 黒文字リスト */
.simple-unified-list {
    background: #f0fff4;
    border: 2px dashed #48bb78;
    border-radius: 12px;
    padding: 25px;
    margin: 15px 0;
    position: relative;
}

.simple-unified-list::before {
    content: "📋 統合リスト";
    position: absolute;
    top: -12px;
    left: 15px;
    background: #f0fff4;
    padding: 0 10px;
    font-size: 12px;
    font-weight: bold;
    color: #38a169;
}

.simple-unified-list ul {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 0;
    list-style-type: none;
    border: 1px solid #48bb78;
}

.simple-unified-list li {
    margin: 12px 0;
    padding: 8px 0 8px 25px;
    position: relative;
    color: #2d3748 !important; /* 黒文字 */
    font-size: 16px;
    line-height: 1.6;
    border-bottom: 1px solid #e6fffa;
}

.simple-unified-list li:last-child {
    border-bottom: none;
}

.simple-unified-list li::before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #38a169;
    font-weight: bold;
}

/* 分割/結合ラジオボタンのスタイル */
.simple-mode-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin: 0 10px;
}

.simple-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.simple-radio-label:hover {
    background: #e9ecef;
}

.simple-radio-label input[type="radio"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: #28a745;
}

.simple-radio-text {
    color: #495057;
    white-space: nowrap;
    font-weight: 500;
}

.simple-radio-label input[type="radio"]:checked + .simple-radio-text {
    color: #28a745;
    font-weight: 600;
}

/* 結合モード時のセクション強調 */
.simple-split-preview-section.has-merge-instruction {
    border-left: 5px solid #28a745 !important;
    background: #f8fff9 !important;
}

.simple-split-preview-section.has-merge-instruction .simple-split-preview-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    color: white !important;
}

.simple-split-preview-section.has-merge-instruction .simple-section-badge {
    background: #155724 !important;
    color: white !important;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .simple-mode-selector {
        flex-direction: column;
        gap: 10px;
        margin: 10px 0;
    }
    
    .simple-radio-label {
        justify-content: center;
        width: 100%;
    }
    
    .simple-unified-textbox,
    .simple-unified-list {
        padding: 15px;
        margin: 10px 0;
    }
    
    .simple-unified-textbox .simple-textbox-content,
    .simple-unified-list ul {
        padding: 15px;
        font-size: 14px;
    }
}