/* WordPress 可视化编辑器样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #1e1e1e;
    color: #e0e0e0;
    overflow: hidden;
}

/* 顶部工具栏 */
.editor-header {
    background: #252526;
    border-bottom: 1px solid #3e3e42;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.header-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.project-selector {
    padding: 8px 12px;
    background: #3c3c3c;
    border: 1px solid #555;
    color: #fff;
    border-radius: 4px;
    min-width: 200px;
    cursor: pointer;
}

.project-selector:focus {
    outline: none;
    border-color: #007acc;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #007acc;
    color: #fff;
}

.btn-primary:hover {
    background: #0066aa;
}

.btn-secondary {
    background: #3c3c3c;
    color: #fff;
}

.btn-secondary:hover {
    background: #4a4a4a;
}

.btn-info {
    background: #0e639c;
    color: #fff;
}

.btn-info:hover {
    background: #1177bb;
}

.btn-icon {
    background: transparent;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    border-radius: 3px;
}

.btn-icon:hover {
    background: #3c3c3c;
    color: #fff;
}

/* 预览模式切换按钮 */
#preview-mode-toggle {
    font-size: 12px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: #ccc;
    cursor: pointer;
}

#preview-mode-toggle:hover {
    background: #3c3c3c;
    color: #fff;
}

#preview-mode-toggle span {
    user-select: none;
}

/* 智能识别过滤按钮 */
.analyze-filters {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

.filter-btn {
    padding: 4px 10px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    color: #ccc;
    cursor: pointer;
    border-radius: 3px;
    font-size: 11px;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #3c3c3c;
    color: #fff;
}

.filter-btn.active {
    background: #007acc;
    border-color: #007acc;
    color: #fff;
}

/* 主编辑区域 */
.editor-container {
    display: flex;
    height: calc(100vh - 60px);
    gap: 2px;
    background: #1e1e1e;
}

.editor-panel {
    display: flex;
    flex-direction: column;
    background: #252526;
    border-right: 1px solid #3e3e42;
}

.editor-left {
    flex: 1;
    min-width: 300px;
}

.editor-right {
    flex: 1;
    min-width: 300px;
}

.editor-center {
    flex: 0 0 350px;
    max-width: 350px;
    overflow-y: auto;
    order: 3; /* 移到最右边 */
}

.panel-header {
    background: #2d2d30;
    padding: 10px 15px;
    border-bottom: 1px solid #3e3e42;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}


.panel-actions {
    display: flex;
    gap: 5px;
}

/* 代码编辑器 - VSCode 深色主题样式 */
.code-editor {
    flex: 1;
    background: #1e1e1e;
    color: #d4d4d4;
    border: none;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', 'Menlo', monospace;
    font-size: 14px;
    line-height: 1.8;
    resize: none;
    outline: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    caret-color: #007acc;
    /* 选中文本样式 */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    /* 滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: #424242 #1e1e1e;
}

.code-editor::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.code-editor::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.code-editor::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 5px;
}

.code-editor::-webkit-scrollbar-thumb:hover {
    background: #4e4e4e;
}

.code-editor::selection {
    background-color: #264f78;
    color: #ffffff;
}

.code-editor::-moz-selection {
    background-color: #264f78;
    color: #ffffff;
}

.code-editor:focus {
    background: #1e1e1e;
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(0, 122, 204, 0.3);
}

/* 预览容器 */
.preview-container {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    background: #1e1e1e;
    padding: 20px;
}

/* 预览框架 */
.preview-frame {
    border: none;
    background: #fff;
    transition: all 0.3s ease;
    display: block;
}

/* PC模式：固定16:9宽高比 */
.preview-frame.preview-pc {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 100px);
}

/* 手机模式：固定竖屏比例 */
.preview-frame.preview-mobile {
    width: 375px;
    max-width: 375px;
    height: 667px;
    border: 1px solid #3e3e42;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* 设备切换按钮 */
.device-buttons {
    display: flex;
    gap: 5px;
    margin-right: 10px;
}

.btn-device {
    padding: 4px 10px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    color: #ccc;
    cursor: pointer;
    border-radius: 3px;
    font-size: 11px;
    transition: all 0.2s;
}

.btn-device:hover {
    background: #3c3c3c;
    color: #fff;
}

.btn-device.active {
    background: #007acc;
    border-color: #007acc;
    color: #fff;
}

/* 智能识别搜索框 */
.analyze-search {
    padding: 10px 15px;
    border-bottom: 1px solid #3e3e42;
    background: #2d2d30;
}

.analyze-search-input {
    width: 100%;
    padding: 6px 30px 6px 10px;
    background: #1e1e1e;
    border: 1px solid #3e3e42;
    border-radius: 3px;
    color: #ccc;
    font-size: 12px;
    outline: none;
}

.analyze-search-input:focus {
    border-color: #007acc;
    background: #252526;
}

.analyze-search-input::placeholder {
    color: #666;
}

/* 智能识别面板 */
.analyze-content {
    padding: 15px;
    overflow-y: auto;
}

.analyze-item-type {
    font-size: 10px;
    color: #007acc;
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.analyze-item-text {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 4px;
}

.analyze-item-value {
    font-size: 11px;
    color: #888;
    word-break: break-all;
    margin-bottom: 5px;
}

.analyze-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analyze-item {
    background: #2d2d30;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #3e3e42;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.analyze-item:hover {
    background: #3c3c3c;
    border-color: #007acc;
}

.analyze-item.active {
    background: #1e3a5f;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3);
}

.analyze-item-text {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 4px;
    word-break: break-word;
}

.analyze-item-value {
    font-size: 11px;
    color: #888;
    word-break: break-all;
    margin-bottom: 5px;
}

.analyze-item-input {
    width: 100%;
    padding: 6px;
    background: #1e1e1e;
    border: 1px solid #555;
    color: #fff;
    border-radius: 3px;
    font-size: 12px;
    margin-top: 5px;
}

/* 图片元素特殊样式 */
.analyze-item-image-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.analyze-item-image-preview {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e1e1e;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.analyze-item-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.analyze-item-image-preview .image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e1e1e;
    color: #666;
    font-size: 20px;
}

.analyze-item-image-info {
    flex: 1;
    min-width: 0;
}

.analyze-item-actions {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.analyze-item-actions .analyze-item-input {
    flex: 1;
    margin-top: 0;
}

.btn-upload-image {
    padding: 6px 10px;
    background: #007acc;
    border: 1px solid #007acc;
    color: #fff;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-upload-image:hover {
    background: #005a9e;
    border-color: #005a9e;
}

.btn-upload-image:disabled {
    background: #555;
    border-color: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #252526;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #3e3e42;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    color: #fff;
}

.btn-close {
    background: none;
    border: none;
    color: #ccc;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: #fff;
    background: #3c3c3c;
    border-radius: 4px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #ccc;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    background: #1e1e1e;
    border: 1px solid #555;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #007acc;
}

.form-group small {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* 项目列表 */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.project-item {
    background: #2d2d30;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #3e3e42;
}

.project-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.project-item-name {
    font-weight: 600;
    color: #fff;
}

.project-item-actions {
    display: flex;
    gap: 5px;
}

.project-item-path {
    font-size: 12px;
    color: #888;
    word-break: break-all;
}

/* 加载遮罩层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.loading-content {
    text-align: center;
    color: #fff;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
    color: #fff;
}

.loading-progress {
    font-size: 12px;
    color: #aaa;
    min-height: 20px;
}

/* 响应式 */
@media (max-width: 1200px) {
    .editor-center {
        display: none;
    }
}

