<?php
/**
 * Override editor background color to white (content area only)
 * 
 * @package Sophia
 * @since 1.0.0
 */
// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

/**
 * Set editor content background to white (excluding template chooser)
 */
function sophia_editor_white_background()
{
    // First ensure the editor styles are enqueued
    wp_enqueue_style('wp-edit-blocks');
    
    $custom_css = '
        /* Target only the main editor content area */
        .edit-post-visual-editor .editor-styles-wrapper,
        .edit-post-visual-editor .block-editor-writing-flow,
        .edit-post-visual-editor .wp-block-post-content,
        
        /* For site editor */
        .edit-site-visual-editor .editor-styles-wrapper,
        .edit-site-visual-editor .block-editor-writing-flow,
        
        /* Ensure iframe editor content is white */
        iframe[name="editor-canvas"] {
            background-color: white !important;
        }
        
        /* More specific targeting to avoid template chooser */
        .interface-interface-skeleton__content .editor-styles-wrapper:not(.template-part-converter__preview) {
            background-color: white !important;
        }
    ';
    
    wp_add_inline_style('wp-edit-blocks', $custom_css);
}
add_action('enqueue_block_editor_assets', 'sophia_editor_white_background');