:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --text-color: #333;
    --bg-color: #f9f9f9;
    --border-color: #ddd;
    --hover-color: #e8f4fc;
    --active-color: #d1e8fb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    overflow: hidden;
}

.container {
    display: flex;
    height: calc(100vh - 60px);
    margin-top: 60px;
}

/* 顶部导航 */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.logo i {
    margin-right: 8px;
    font-size: 24px;
}

.user-actions {
    display: flex;
    align-items: center;
}

.user-actions a {
    margin-left: 15px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.user-actions a:hover {
    color: var(--primary-color);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #2980b9;
}

/* 左侧模块库 */
.modules-panel {
    width: 420px;
    background-color: #fff;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.panel-title {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
}

.search-box {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 10px;
    outline: none;
}
.modules-container {
    overflow-y: auto;
    padding: 10px;
    background-color: #e3e3e3;
}
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
}

.category-btn {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    background-color: #fff;
}

.category-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.module-item {
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
    border-radius: 6px;
    overflow: hidden;
    cursor: move;
    transition: transform 0.2s, box-shadow 0.2s;
}

.module-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.module-preview {
    padding: 15px;
    background-color: #fff;
    position: relative;
}

.module-actions {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: #f5f5f5;
    font-size: 12px;
    color: #666;
}

/* 右侧编辑区域 */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.editor-toolbar {
    height: 50px;
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 15px;
}

.toolbar-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    margin-right: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.toolbar-btn:hover {
    background-color: var(--hover-color);
}

.toolbar-btn:focus {
    outline: none;
    box-shadow: none;
}

.editor-content {
    flex: 1;
    background-color: #fff;
    padding: 20px;
    overflow-y: auto;
    position: relative;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.05);
}

.phone-container {
    width: 420px;
    max-width: 90%;
    height: 80vh;
    margin: 0 auto;
    border: 10px solid #333;
    border-radius: 30px;
    overflow-y: auto;
    position: relative;
    background-color: #fff;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    overflow-x: hidden;
}

/* 自定义滚动条 */
.phone-container::-webkit-scrollbar {
    width: 6px;
}

.phone-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.phone-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.phone-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.phone-content {
    min-height: 100%;
    padding: 15px;
}

/* 编辑模式 */
.editable-module {
    position: relative;
    margin-bottom: 15px;
    transition: box-shadow 0.3s;
    cursor: move;
}

.editable-module:hover {
    box-shadow: 0 0 0 2px var(--primary-color);
}

.editable-module.editing {
    box-shadow: 0 0 0 2px var(--secondary-color);
}

.editable-module.selected {
    box-shadow: 0 0 0 2px var(--secondary-color);
}

/* 模块删除按钮 */
.module-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: rgba(255, 0, 0, 0.7);
    color: white;
    border: none;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
}

.editable-module:hover .module-delete-btn {
    opacity: 1;
}

/* 模块移动按钮 */
.module-move-btns {
    position: absolute;
    top: 5px;
    left: 5px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
}

.editable-module:hover .module-move-btns {
    opacity: 1;
}

.module-move-btn {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 图片替换按钮 */
.replace-image-btn {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 5;
}

.image-container {
    position: relative;
}

.image-container:hover .replace-image-btn {
    opacity: 1;
}

/* 源代码编辑模式 */
.source-code-editor {
    width: 100%;
    height: 100%;
    border: none;
    padding: 10px;
    font-family: monospace;
    resize: none;
    display: none;
    background-color: #f8f8f8;
    color: #333;
}

/* 保存内容面板 */
.saved-content-panel {
    position: fixed;
    right: -400px;
    top: 60px;
    bottom: 0;
    width: 400px;
    background-color: #fff;
    border-left: 1px solid var(--border-color);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s;
    z-index: 99;
    overflow-y: auto;
    padding: 20px;
}

.saved-content-panel.show {
    right: 0;
}

.saved-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.saved-content-title {
    font-size: 18px;
    font-weight: bold;
}

.close-saved-panel {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.saved-item {
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
    border-radius: 6px;
    overflow: hidden;
}

.saved-item-content {
    padding: 15px;
}

/* 编辑器内文本样式 */
[contenteditable=true]:focus {
    outline: none;
}

/* 占位符样式 */
.editor-placeholder {
    text-align: center; 
    color: #999; 
    padding: 30px 0;
}

.editor-placeholder i {
    font-size: 24px;
}

.editor-placeholder p {
    margin-top: 15px;
}

/* 拖动时的样式 */
.dragging {
    opacity: 0.7;
    cursor: grabbing;
}

.drag-over {
    border: 2px dashed var(--primary-color);
    background-color: rgba(52, 152, 219, 0.05);
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* 弹出层 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #fff;
    width: 380px;
    max-width: 90%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

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

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.modal-btn {
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
}

.modal-btn-cancel {
    background-color: #f1f1f1;
    border: 1px solid #ddd;
}

.modal-btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.modal-btn-danger {
    background-color: var(--danger-color);
    color: white;
    border: none;
}

/* HTML插入模块样式 */
.html-editor {
    width: 100%;
    height: 200px;
    border: 1px solid var(--border-color);
    padding: 10px;
    font-family: monospace;
    resize: vertical;
}

/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* 视图切换按钮 */
.view-toggle {
    display: flex;
    margin-left: auto;
}

.view-toggle-btn {
    padding: 6px 12px;
    background-color: #f1f1f1;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.view-toggle-btn:focus {
    outline: none;
    box-shadow: none;
}

.view-toggle-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.view-toggle-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.view-toggle-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 通知提示 */
.notification {
    position: fixed;
    top: 130px;
    right: 20px;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    z-index: 1000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 300px;
}

.notification.show {
    transform: translateX(0);
}

.notification-icon {
    margin-right: 12px;
    font-size: 20px;
}

.notification-success .notification-icon {
    color: var(--secondary-color);
}

.notification-error .notification-icon {
    color: var(--danger-color);
}

.notification-info .notification-icon {
    color: var(--primary-color);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: bold;
    margin-bottom: 3px;
}

.notification-message {
    font-size: 14px;
    color: #666;
}

/* 确认对话框 */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.confirm-dialog.show {
    opacity: 1;
    visibility: visible;
}

.confirm-content {
    background-color: #fff;
    width: 400px;
    max-width: 90%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.confirm-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.confirm-title {
    font-size: 18px;
    font-weight: 600;
}

.confirm-body {
    padding: 20px;
}

.confirm-message {
    font-size: 16px;
    color: #333;
}

.confirm-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* 富文本编辑工具栏 */
.rich-text-toolbar {
    display: none;
    background-color: #fff;
    padding: 10px;
    margin-bottom: 10px;
    position: absolute;
    z-index: 99;
    left: 0;
    top: 0;
    right: 0;
    border-bottom: 1px solid var(--border-color);
}

.rich-text-toolbar.show {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.rich-text-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

.rich-text-btn:focus {
    outline: none;
    box-shadow: none;
}

.rich-text-btn:hover {
    background-color: var(--hover-color);
}

.rich-text-btn.active {
    background-color: var(--active-color);
    border-color: var(--primary-color);
}

.rich-text-separator {
    width: 1px;
    height: 20px;
    background-color: var(--border-color);
    margin: 0 5px;
}

.color-picker {
    width: 30px;
    height: 30px;
    padding: 0;
    background-color: white;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: 3px;
}

/* 添加元素下拉菜单 */
.add-element-dropdown {
    position: relative;
    display: inline-block;
}

.add-element-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    width: 150px;
    padding: 5px 0;
    z-index: 100;
    transform: translateY(10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.add-element-dropdown:hover .add-element-menu {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.add-element-item {
    padding: 8px 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.add-element-item:hover {
    background-color: var(--hover-color);
}

.add-element-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* 加载更多按钮 */
.load-more-btn {
    padding: 10px;
    text-align: center;
    background-color: #f5f5f5;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    margin-top: auto;
    transition: background-color 0.2s;
}

.load-more-btn:hover {
    background-color: #e0e0e0;
}

/* 模块操作工具栏 */
.module-operations {
    display: none;
    padding: 5px 10px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

.module-operations.show {
    display: flex;
    align-items: center;
    gap: 8px;
}

.module-op-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    padding: 3px 5px;
}

.module-op-btn i {
    margin-right: 3px;
}

/* 打赏按钮样式 */
.donate-btn {
    background-color: #ff9500;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14px;
    margin-left: 15px;
    transition: background-color 0.3s;
}

.donate-btn i {
    margin-right: 5px;
}

.donate-btn:hover {
    background-color: #e68600;
}

.donate-qrcode {
    height: 200px;
    margin: 0 auto;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px
}
.donate-qrcode img{
    height: 180px;
}
.donate-text {
    text-align: center;
    margin-top: 15px;
    color: #666;
}

/* 阻止默认样式 */
button:focus, 
select:focus, 
input:focus {
    outline: none;
}