/* =========================================================
 *  WP Front-End Markdown Pro - V3.1 - Final Polish & Mobile Fix
 * ========================================================= */

#wfmp-editor-app {
    display: flex;
    flex-direction: column;
    height: 85vh;
    min-height: 650px;
    width: 100%; /* Changed from 1200px to 100% */
    max-width: 1200px; /* NEW: Use max-width to control size on large screens */
    margin: 2em auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
    box-sizing: border-box;
}

/* --- Fullscreen Mode --- */
#wfmp-editor-app.fullscreen-active {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    max-width: 100%; margin: 0; z-index: 99999; border-radius: 0; border: none;
}

/* --- Top Bar --- */
#wfmp-editor-app .wfmp-top-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; border-bottom: 1px solid #e0e0e0; background-color: #f8f9fa; flex-shrink: 0;
}
#wfmp-editor-app .wfmp-top-bar-left, 
#wfmp-editor-app .wfmp-top-bar-right {
    display: flex; align-items: center; gap: 8px;
}

/* --- Toolbar --- */
#wfmp-editor-app .wfmp-toolbar {
    display: flex; gap: 4px; flex-wrap: wrap;
}
#wfmp-editor-app .wfmp-toolbar-button {
    background: #fff; border: 1px solid #d1d1d1; border-radius: 5px; padding: 4px 8px;
    cursor: pointer; font-size: 13px; font-weight: 500; color: #444; line-height: 1.2;
}
#wfmp-editor-app .wfmp-toolbar-button:hover { background-color: #f0f0f0; border-color: #bbb; }

/* --- Action Buttons (Copy, Fullscreen) --- */
#wfmp-editor-app .wfmp-action-button {
    background: none; border: none; cursor: pointer; color: #555; padding: 4px;
    border-radius: 5px; display: flex; align-items: center; justify-content: center;
}
#wfmp-editor-app .wfmp-action-button:hover { background-color: #e0e0e0; }
#wfmp-editor-app .wfmp-action-button svg { width: 18px; height: 18px; }

/* --- Editor/Preview Panes Layout --- */
#wfmp-editor-app .wfmp-editor-wrapper {
    display: flex; flex-grow: 1; overflow: hidden;
}
#wfmp-editor-app .wfmp-editor-pane {
    flex-grow: 1; min-width: 0; /* Important for flexbox shrinking */
    height: 100%; border-right: 1px solid #e0e0e0; display: flex;
}
#wfmp-editor-app .wfmp-preview-pane {
    width: 45%; /* Use percentage for flexibility */
    max-width: 500px; /* Set a max-width */
    flex-shrink: 0; height: 100%; overflow-y: auto; padding: 25px;
    box-sizing: border-box; background-color: #fdfdfd;
    box-shadow: -5px 0 15px -5px rgba(0,0,0,0.05);
}
#wfmp-editor-app .wfmp-textarea {
    width: 100%; height: 100%; padding: 25px; border: none; outline: none;
    resize: none; font-family: "SFMono-Regular", Consolas, Menlo, Courier, monospace;
    font-size: 15px; line-height: 1.65; background: transparent; box-sizing: border-box;
}

/* --- Status Bar --- */
#wfmp-editor-app .wfmp-status-bar {
    padding: 6px 15px; border-top: 1px solid #e0e0e0; font-size: 12px;
    color: #666; background-color: #f8f9fa; display: flex; gap: 20px; flex-shrink: 0;
}

/* --- Dropdown Menu --- */
#wfmp-editor-app .wfmp-dropdown-container { position: relative; padding-bottom: 10px; }
#wfmp-editor-app .wfmp-copy-button { background-color: #0073aa; color: #fff; padding: 6px 12px; font-size: 13px; font-weight: 500;margin-top: 10px; }
#wfmp-editor-app .wfmp-copy-button:hover { background-color: #005a87; }
#wfmp-editor-app .wfmp-dropdown-menu {
    position: absolute; 
	top: 1; 
	right: 0; margin-top: 0px; background-color: #fff;
    border: 1px solid #ddd; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 10; width: 180px; overflow: hidden; padding: 5px 0;
    transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out; /* 添加过渡效果 */
}
#wfmp-editor-app .wfmp-dropdown-menu a { 
    display: block; 
    padding: 12px 15px; /* 增加垂直内边距 */
    color: #333; 
    text-decoration: none; 
    font-size: 14px; 
    transition: background-color 0.1s ease-in-out; /* 添加过渡效果 */
}
#wfmp-editor-app .wfmp-dropdown-menu a:hover { 
    background-color: #f0f0f0; 
}
#wfmp-editor-app .wfmp-dropdown-menu a.wechat { 
    font-weight: bold; 
    color: #07c160; 
}

/* --- 悬停效果增强 --- */
#wfmp-editor-app .wfmp-dropdown-container:hover .wfmp-copy-button {
    background-color: #005a87; /* 悬停时按钮颜色变化 */
}

/* --- Mobile Compatibility --- */
@media (max-width: 768px) {
    #wfmp-editor-app {
        height: auto; /* Let content determine height */
        min-height: 90vh;
    }
    
    #wfmp-editor-app .wfmp-editor-wrapper {
        flex-direction: column; /* Stack editor and preview vertically */
    }
    
    #wfmp-editor-app .wfmp-editor-pane,
    #wfmp-editor-app .wfmp-preview-pane {
        width: 100%;
        height: 50vh; /* Give each pane a portion of the screen height */
        max-width: 100%;
        box-shadow: none;
    }

    #wfmp-editor-app .wfmp-editor-pane {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    #wfmp-editor-app .wfmp-toolbar {
        overflow-x: auto; /* Allow toolbar to be scrolled horizontally */
        flex-wrap: nowrap;
    }
}


/* --- Other necessary styles (v-cloak, markdown body) --- */
[v-cloak] > * { display: none; }
[v-cloak]::before { content: "正在加载编辑器..."; display: block; padding: 20px; text-align: center; color: #888; }
/* Markdown Body Styles from previous step */
#wfmp-editor-app .wfmp-preview-content.markdown-body { font-size: 16px; line-height: 1.7; color: #333; }
#wfmp-editor-app .markdown-body h1, #wfmp-editor-app .markdown-body h2, #wfmp-editor-app .markdown-body h3, #wfmp-editor-app .markdown-body h4, #wfmp-editor-app .markdown-body h5, #wfmp-editor-app .markdown-body h6 { margin-top: 24px; margin-bottom: 16px; font-weight: 600; line-height: 1.25; border-bottom: 1px solid #eaecef; padding-bottom: .3em; }
#wfmp-editor-app .markdown-body h1 { font-size: 2em; } #wfmp-editor-app .markdown-body h2 { font-size: 1.5em; } #wfmp-editor-app .markdown-body h3 { font-size: 1.25em; }
#wfmp-editor-app .markdown-body p { margin-bottom: 16px; }
#wfmp-editor-app .markdown-body ul, #wfmp-editor-app .markdown-body ol { padding-left: 2em; margin-bottom: 16px; }
#wfmp-editor-app .markdown-body blockquote { margin-left: 0; padding: 0 1em; color: #6a737d; border-left: .25em solid #dfe2e5; margin-bottom: 16px; }
#wfmp-editor-app .markdown-body code { padding: .2em .4em; margin: 0; font-size: 85%; background-color: rgba(27,31,35,.05); border-radius: 3px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; }
#wfmp-editor-app .markdown-body pre { padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45; background-color: #f6f8fa; border-radius: 6px; margin-bottom: 16px; }
#wfmp-editor-app .markdown-body pre code { padding: 0; margin: 0; background-color: transparent; border: 0; }
#wfmp-editor-app .markdown-body a { color: #0366d6; text-decoration: none; }
#wfmp-editor-app .markdown-body a:hover { text-decoration: underline; }

/* =========================================================
 *  V3.2 - HIGH PRIORITY FIXES
 * ========================================================= */

/* --- Fullscreen Mode Fix --- */
/* The key is to apply fullscreen styles directly to the #wfmp-editor-app element when it has the .fullscreen-active class */
#wfmp-editor-app.fullscreen-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important; /* 使用视口单位 */
    height: 100vh !important; /* 使用视口单位 */
    max-width: 100vw !important;
    margin: 0 !important;
    z-index: 2147483647 !important; /* Use a very high z-index to ensure it's on top of everything */
    border-radius: 0 !important;
    border: none !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}