/* ==========================================================================
   LP Preview Manager - フロントエンドスタイル（画像2デザイン復元版）
   ========================================================================== */

/* WordPress テーマとの競合を避けるため、全てのスタイルに .lp-preview-manager-frontend を付与 */

#lp-preview-manager-frontend {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    padding: 20px 0;
    min-height: 100vh;
}

/* プロジェクトヘッダー */
#lp-preview-manager-frontend .lpm-project-header {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

#lp-preview-manager-frontend .lpm-project-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

#lp-preview-manager-frontend .lpm-select,
#lp-preview-manager-frontend .lpm-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

#lp-preview-manager-frontend .lpm-select {
    min-width: 200px;
}

#lp-preview-manager-frontend .lpm-input {
    min-width: 250px;
}

#lp-preview-manager-frontend .lpm-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

#lp-preview-manager-frontend .lpm-btn-primary {
    background: #0073aa;
    color: white;
}

#lp-preview-manager-frontend .lpm-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
}

#lp-preview-manager-frontend .lpm-btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

#lp-preview-manager-frontend .lpm-btn-secondary:hover {
    background: #e0e0e0;
}

#lp-preview-manager-frontend .lpm-btn-danger {
    background: #dc3545;
    color: white;
}

#lp-preview-manager-frontend .lpm-btn-danger:hover {
    background: #c82333;
}

#lp-preview-manager-frontend .lpm-user-info {
    color: #666;
    font-size: 14px;
}

/* メインコンテナ */
#lp-preview-manager-frontend .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

#lp-preview-manager-frontend .header {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#lp-preview-manager-frontend .header h1 {
    color: #4f46e5;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    margin-top: 0;
}

#lp-preview-manager-frontend .header p {
    color: #6b7280;
    font-size: 1.1rem;
    margin: 0;
}

#lp-preview-manager-frontend .main-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* タブナビゲーション */
#lp-preview-manager-frontend .tabs-nav {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0;
    margin: 0;
    list-style: none;
}

#lp-preview-manager-frontend .tab-item {
    flex: 1;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 20px;
    text-align: center;
    border-bottom: 3px solid transparent;
}

#lp-preview-manager-frontend .tab-item.active {
    background: white;
    border-bottom-color: #4f46e5;
}

#lp-preview-manager-frontend .tab-item.completed {
    background: #ecfdf5;
    border-bottom-color: #10b981;
}

#lp-preview-manager-frontend .tab-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #e2e8f0;
    color: #64748b;
    border-radius: 50%;
    font-weight: 600;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

#lp-preview-manager-frontend .tab-item.active .tab-number {
    background: #4f46e5;
    color: white;
}

#lp-preview-manager-frontend .tab-item.completed .tab-number {
    background: #10b981;
    color: white;
}

#lp-preview-manager-frontend .tab-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: #64748b;
}

#lp-preview-manager-frontend .tab-item.active .tab-label {
    color: #4f46e5;
}

#lp-preview-manager-frontend .tab-item.completed .tab-label {
    color: #10b981;
}

/* プログレスバー */
#lp-preview-manager-frontend .progress-bar {
    height: 6px;
    background: #e2e8f0;
    position: relative;
    margin-bottom: 30px;
}

#lp-preview-manager-frontend .progress-indicator {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #10b981);
    transition: width 0.5s ease;
    border-radius: 3px;
}

#lp-preview-manager-frontend .progress-text {
    position: absolute;
    right: 20px;
    top: -30px;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

/* タブコンテンツ */
#lp-preview-manager-frontend .tab-content {
    display: none;
    padding: 30px;
    min-height: 600px;
}

#lp-preview-manager-frontend .tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

#lp-preview-manager-frontend .section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

#lp-preview-manager-frontend .section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: #4f46e5;
    margin-right: 12px;
    border-radius: 2px;
}

/* フォーム要素 */
#lp-preview-manager-frontend .form-group {
    margin-bottom: 24px;
}

#lp-preview-manager-frontend .form-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

#lp-preview-manager-frontend .form-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
}

#lp-preview-manager-frontend .form-textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#lp-preview-manager-frontend .form-textarea.has-content {
    border-color: #10b981;
    background: #f0fdf4;
}

/* ボタン */
#lp-preview-manager-frontend .btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: inherit;
    box-sizing: border-box;
}

#lp-preview-manager-frontend .btn-primary {
    background: #6366f1;
    color: white;
}

#lp-preview-manager-frontend .btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

#lp-preview-manager-frontend .btn-success {
    background: #10b981;
    color: white;
}

#lp-preview-manager-frontend .btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#lp-preview-manager-frontend .btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #d1d5db;
}

#lp-preview-manager-frontend .btn-secondary:hover {
    background: #e5e7eb;
}

#lp-preview-manager-frontend .btn-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* セクション振り分けグリッド */
#lp-preview-manager-frontend .breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

#lp-preview-manager-frontend .breakdown-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
}

#lp-preview-manager-frontend .breakdown-item.has-content {
    border-color: #10b981;
    background: #f0fdf4;
}

#lp-preview-manager-frontend .breakdown-item.distributed {
    border-color: #3b82f6;
    background: #eff6ff;
}

#lp-preview-manager-frontend .breakdown-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

#lp-preview-manager-frontend .breakdown-checkbox {
    margin-right: 12px;
    transform: scale(1.2);
}

#lp-preview-manager-frontend .breakdown-title {
    flex: 1;
}

#lp-preview-manager-frontend .breakdown-title input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

#lp-preview-manager-frontend .breakdown-content textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}

#lp-preview-manager-frontend .breakdown-apply {
    position: absolute;
    bottom: 16px;
    right: 16px;
    padding: 6px 12px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

#lp-preview-manager-frontend .breakdown-apply:hover {
    background: #4f46e5;
}

/* 制御ボタンエリア */
#lp-preview-manager-frontend .distribute-controls {
    display: flex;
    gap: 12px;
    margin: 20px 0;
    justify-content: center;
    flex-wrap: wrap;
}

#lp-preview-manager-frontend .distribute-sections-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* タグ選択エリア */
#lp-preview-manager-frontend .category-selector-wrapper {
    background: #e0f2fe;
    border: 2px solid #0ea5e9;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

#lp-preview-manager-frontend .category-selector-field {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

#lp-preview-manager-frontend .category-selector-field select {
    flex: 1;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    min-width: 200px;
}

#lp-preview-manager-frontend .tag-selection-container {
    background: #f0fdf4;
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

#lp-preview-manager-frontend .tag-selection-header {
    font-weight: 600;
    color: #065f46;
    margin-bottom: 12px;
}

#lp-preview-manager-frontend .tag-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#lp-preview-manager-frontend .tag-radio-item {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

#lp-preview-manager-frontend .tag-radio-item.title-match {
    border-color: #ef4444;
    background: #fef2f2;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

#lp-preview-manager-frontend .tag-radio-item input[type="radio"] {
    display: none;
}

#lp-preview-manager-frontend .tag-radio-item input[type="radio"]:checked + .tag-radio-label,
#lp-preview-manager-frontend .tag-radio-item.selected {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

#lp-preview-manager-frontend .tag-radio-item:hover {
    border-color: #6366f1;
    transform: translateY(-1px);
}

/* セクションエディター */
#lp-preview-manager-frontend .section-editor {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

#lp-preview-manager-frontend .section-editor.has-template {
    border-color: #10b981;
    background: #f0fdf4;
}

#lp-preview-manager-frontend .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

#lp-preview-manager-frontend .section-number-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

#lp-preview-manager-frontend .section-number {
    width: 40px;
    height: 40px;
    background: #6366f1;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

#lp-preview-manager-frontend .section-title-display {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1f2937;
}

/* テンプレートカルーセル */
#lp-preview-manager-frontend .template-carousel {
    margin-bottom: 20px;
}

#lp-preview-manager-frontend .carousel-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 16px 0;
    scroll-behavior: smooth;
}

#lp-preview-manager-frontend .template-card {
    min-width: 200px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#lp-preview-manager-frontend .template-card:hover {
    border-color: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

#lp-preview-manager-frontend .template-card.selected {
    border-color: #10b981;
    background: #f0fdf4;
}

#lp-preview-manager-frontend .template-image {
    width: 100%;
    height: 120px;
    background: #f3f4f6;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 12px;
}

#lp-preview-manager-frontend .template-title {
    font-weight: 600;
    color: #1f2937;
    text-align: center;
    margin-bottom: 12px;
    font-size: 14px;
}

#lp-preview-manager-frontend .template-select-btn {
    width: 100%;
    padding: 8px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

#lp-preview-manager-frontend .template-select-btn:hover {
    background: #4f46e5;
}

/* 2カラムエディター */
#lp-preview-manager-frontend .two-column-editor {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

#lp-preview-manager-frontend .editor-column {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
}

#lp-preview-manager-frontend .editor-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 16px;
}

#lp-preview-manager-frontend .editor-tab {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    color: #64748b;
    transition: all 0.3s ease;
}

#lp-preview-manager-frontend .editor-tab.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
}

#lp-preview-manager-frontend .editor-tab.has-content::after {
    content: '✓';
    margin-left: 6px;
    color: #10b981;
}

#lp-preview-manager-frontend .tab-pane {
    display: none;
}

#lp-preview-manager-frontend .tab-pane.active {
    display: block;
}

#lp-preview-manager-frontend .code-editor {
    width: 100%;
    height: 300px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    resize: vertical;
    background: #fafafa;
    box-sizing: border-box;
}

#lp-preview-manager-frontend .preview-area {
    width: 100%;
    height: 300px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    overflow: auto;
    padding: 16px;
    box-sizing: border-box;
}

#lp-preview-manager-frontend .preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    flex-direction: column;
}

#lp-preview-manager-frontend .preview-placeholder::before {
    content: '👁️';
    font-size: 2rem;
    margin-bottom: 8px;
}

/* アクションボタン */
#lp-preview-manager-frontend .section-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* メッセージ */
#lp-preview-manager-frontend .success-message {
    background: #ecfdf5;
    border: 1px solid #10b981;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

#lp-preview-manager-frontend .success-message.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* 保存ステータス */
#lp-preview-manager-frontend .lpm-save-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#lp-preview-manager-frontend .lpm-save-status.success {
    background: #28a745;
}

#lp-preview-manager-frontend .lpm-save-status.error {
    background: #dc3545;
}

#lp-preview-manager-frontend .lpm-save-status.info {
    background: #17a2b8;
}

/* ログインメッセージ */
#lp-preview-manager-frontend .lpm-login-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
    margin: 20px;
}

/* ==========================================================================
   テンプレートグリッド表示（画像2のデザイン復元）
   ========================================================================== */

/* カテゴリー選択エリア */
.category-selector-wrapper {
    background: #e0f2fe;
    border: 2px solid #0ea5e9;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.category-selector-field {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.category-selector-field select {
    flex: 1;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}

/* テンプレートコンテナ */
.templates-container {
    margin: 15px 0;
    min-height: 200px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    background: #f8fafc;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 0;
}

/* 画像2のデザインに戻すテンプレートカード */
.template-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.template-card:hover {
    border-color: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.template-card.selected {
    border-color: #10b981;
    background: #f0fdf4;
}

.template-card.selected::before {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #10b981;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

/* 画像を横長に戻す（画像2のデザイン） */
.template-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
}

.template-card h4 {
    margin: 8px 0;
    font-size: 14px;
    color: #1f2937;
    line-height: 1.3;
}

.template-card .template-excerpt {
    font-size: 12px;
    color: #6b7280;
    margin: 8px 0;
    line-height: 1.4;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 選択ボタンを復活させる（画像2のデザイン） */
.template-card .select-btn {
    background: #6366f1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    width: 100%;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.template-card .select-btn:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

.template-card.selected .select-btn {
    background: #10b981;
}

.template-card.selected .select-btn:hover {
    background: #059669;
}

/* 状態表示 */
.loading-templates {
    color: #0ea5e9;
}

.loading-templates::before {
    content: '⏳';
    margin-right: 8px;
    font-size: 1.2em;
}

.no-templates {
    color: #ef4444;
}

.no-templates::before {
    content: '📝';
    margin-right: 8px;
    font-size: 1.2em;
}

.no-selection::before {
    content: '👆';
    margin-right: 8px;
    font-size: 1.2em;
}

/* タグ選択の改善 */
.tag-selection-container {
    background: #f0fdf4;
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.tag-selection-header {
    font-weight: 600;
    color: #065f46;
    margin-bottom: 12px;
    font-size: 1.1em;
}

.tag-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-radio-item {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    user-select: none;
}

.tag-radio-item:hover {
    border-color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
}

.tag-radio-item.selected {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.tag-radio-item input[type="radio"] {
    display: none;
}

.tag-radio-label {
    cursor: pointer;
    font-weight: 500;
}

/* テンプレート選択の追加CSS */
.template-selected-message {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* エディタータブの改善 */
.editor-tab.has-content::after {
    content: '✓';
    margin-left: 6px;
    color: #10b981;
    font-weight: bold;
}

.editor-tab[data-tab*="template"].has-content {
    background: #f0fdf4;
    border-color: #10b981;
}

/* テンプレートセクションのヘッダー */
.templates-section h4 {
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* セクションエディターの改善 */
.section-editor.has-template {
    border-color: #10b981;
    background: #f0fdf4;
}

.section-editor.has-template::before {
    content: 'テンプレート適用済み';
    position: absolute;
    top: 10px;
    right: 15px;
    background: #10b981;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    z-index: 1;
}

/* テンプレートプレビューの改善 */
.template-preview-mode .preview-area {
    border: 2px solid #10b981;
    border-radius: 8px;
    background: #f0fdf4;
}

.template-preview-mode .preview-placeholder {
    color: #065f46;
    font-weight: 500;
}

.template-preview-mode .preview-placeholder::before {
    content: '📋 ';
    margin-right: 8px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #lp-preview-manager-frontend {
        padding: 10px 0;
    }
    
    #lp-preview-manager-frontend .container {
        padding: 0 10px;
    }
    
    #lp-preview-manager-frontend .lpm-project-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    #lp-preview-manager-frontend .lpm-project-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    #lp-preview-manager-frontend .lpm-select,
    #lp-preview-manager-frontend .lpm-input {
        min-width: auto;
        width: 100%;
    }
    
    #lp-preview-manager-frontend .tabs-nav {
        flex-direction: column;
    }
    
    #lp-preview-manager-frontend .header h1 {
        font-size: 2rem;
    }
    
    #lp-preview-manager-frontend .breakdown-grid {
        grid-template-columns: 1fr;
    }
    
    #lp-preview-manager-frontend .two-column-editor {
        grid-template-columns: 1fr;
    }
    
    #lp-preview-manager-frontend .btn-group,
    #lp-preview-manager-frontend .distribute-controls,
    #lp-preview-manager-frontend .distribute-sections-container {
        flex-direction: column;
    }
    
    #lp-preview-manager-frontend .category-selector-field {
        flex-direction: column;
        align-items: stretch;
    }
    
    #lp-preview-manager-frontend .category-selector-field select {
        min-width: auto;
        width: 100%;
    }
    
    #lp-preview-manager-frontend .carousel-container {
        overflow-x: scroll;
    }
    
    #lp-preview-manager-frontend .lpm-save-status {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        font-size: 14px;
    }
    
    .category-selector-field {
        flex-direction: column;
        align-items: stretch;
    }
    
    .category-selector-field select {
        min-width: auto;
        width: 100%;
    }
    
    .templates-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 10px;
    }
    
    .template-card {
        padding: 12px;
    }
    
    .template-card img {
        height: 100px;
    }
    
    .tag-radio-group {
        flex-direction: column;
        gap: 6px;
    }
    
    .tag-radio-item {
        text-align: center;
        padding: 12px 16px;
    }
}

/* プリント対応 */
@media print {
    #lp-preview-manager-frontend .lpm-project-header,
    #lp-preview-manager-frontend .btn,
    #lp-preview-manager-frontend .btn-group,
    #lp-preview-manager-frontend .section-actions {
        display: none !important;
    }
    
    #lp-preview-manager-frontend {
        background: white;
        padding: 0;
    }
    
    #lp-preview-manager-frontend .main-content {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    #lp-preview-manager-frontend {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    #lp-preview-manager-frontend .lpm-project-header,
    #lp-preview-manager-frontend .header,
    #lp-preview-manager-frontend .main-content {
        background: #2c2c2c;
        border-color: #404040;
    }
    
    #lp-preview-manager-frontend .form-textarea,
    #lp-preview-manager-frontend .breakdown-title input,
    #lp-preview-manager-frontend .breakdown-content textarea,
    #lp-preview-manager-frontend .code-editor {
        background: #3a3a3a;
        border-color: #555;
        color: #e0e0e0;
    }
    
    #lp-preview-manager-frontend .breakdown-item,
    #lp-preview-manager-frontend .section-editor,
    #lp-preview-manager-frontend .editor-column {
        background: #3a3a3a;
        border-color: #555;
    }
    
    #lp-preview-manager-frontend .template-card {
        background: #3a3a3a;
        border-color: #555;
    }
    
    #lp-preview-manager-frontend .preview-area {
        background: #2c2c2c;
        border-color: #555;
    }
}

/* ==========================================================================
   セクションタブナビゲーション（復活）
   ========================================================================== */

/* セクションタブナビゲーション */
#lp-preview-manager-frontend .section-tabs-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 20px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    border-radius: 16px 16px 0 0;
    overflow-x: auto;
}

#lp-preview-manager-frontend .section-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    padding: 12px 8px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

#lp-preview-manager-frontend .section-tab:hover {
    border-color: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

#lp-preview-manager-frontend .section-tab.active {
    border-color: #6366f1;
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

#lp-preview-manager-frontend .section-tab-number {
    width: 32px;
    height: 32px;
    background: #e2e8f0;
    color: #64748b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

#lp-preview-manager-frontend .section-tab.active .section-tab-number {
    background: #6366f1;
    color: white;
}

#lp-preview-manager-frontend .section-tab-title {
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 4px;
}

#lp-preview-manager-frontend .section-tab.active .section-tab-title {
    color: #6366f1;
}

#lp-preview-manager-frontend .section-tab-status {
    position: absolute;
    top: 8px;
    right: 8px;
}

#lp-preview-manager-frontend .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.3s ease;
}

#lp-preview-manager-frontend .status-dot.active {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* セクションコンテンツエリア */
#lp-preview-manager-frontend .section-content-area {
    min-height: 800px;
    background: white;
}

/* セクションエディター（タブ式レイアウト） */
#lp-preview-manager-frontend .section-editor {
    padding: 30px;
    background: white;
    display: none;
}

#lp-preview-manager-frontend .section-editor.active {
    display: block;
}

/* セクションヘッダー */
#lp-preview-manager-frontend .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

#lp-preview-manager-frontend .section-number-badge {
    display: flex;
    align-items: center;
    gap: 16px;
}

#lp-preview-manager-frontend .section-number {
    width: 48px;
    height: 48px;
    background: #6366f1;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

#lp-preview-manager-frontend .section-title-display {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2937;
}

/* レスポンシブ対応（タブナビゲーション） */
@media (max-width: 1024px) {
    #lp-preview-manager-frontend .section-tabs-navigation {
        justify-content: flex-start;
    }
    
    #lp-preview-manager-frontend .section-tab {
        min-width: 100px;
    }
}

@media (max-width: 768px) {
    #lp-preview-manager-frontend .section-tabs-navigation {
        gap: 4px;
        padding: 16px;
    }
    
    #lp-preview-manager-frontend .section-tab {
        min-width: 80px;
        padding: 8px 4px;
    }
    
    #lp-preview-manager-frontend .section-tab-number {
        width: 24px;
        height: 24px;
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    #lp-preview-manager-frontend .section-tab-title {
        font-size: 11px;
    }
}