/**
 * 网站可视化编辑器样式
 * NicoSun Lab Editor Styles
 */

/* 编辑器激活状态 */
body.editor-active {
    position: relative;
}

/* 工具栏 */
.editor-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.editor-toolbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
}

.editor-toolbar-left,
.editor-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.editor-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.editor-divider {
    width: 1px;
    height: 25px;
    background: rgba(255, 255, 255, 0.3);
}

.editor-status {
    color: white;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
}

/* 编辑面板 */
.editor-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 320px;
    max-height: calc(100vh - 80px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    overflow: hidden;
}

.editor-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.editor-panel-header h3 {
    margin: 0;
    font-size: 16px;
}

.editor-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.editor-panel-close:hover {
    opacity: 1;
}

.editor-panel-content {
    padding: 20px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.editor-hint {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 20px 0;
}

.editor-group {
    margin-bottom: 15px;
}

.editor-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.editor-group input[type="text"],
.editor-group input[type="number"],
.editor-group textarea,
.editor-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.editor-group input:focus,
.editor-group textarea:focus,
.editor-group select:focus {
    outline: none;
    border-color: #667eea;
}

.editor-group input[type="range"] {
    width: 70%;
    vertical-align: middle;
}

.editor-group input[type="color"] {
    width: 50px;
    height: 30px;
    padding: 0;
    border: none;
    cursor: pointer;
}

.editor-group span {
    font-size: 12px;
    color: #666;
    margin-left: 10px;
}

.editor-margin-inputs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
}

.editor-margin-inputs input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.editor-btn-primary {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.editor-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.editor-btn-primary:active {
    transform: translateY(0);
}

/* 悬浮工具栏 */
.editor-floating {
    position: fixed;
    display: flex;
    gap: 5px;
    background: white;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10001;
}

.editor-float-btn {
    padding: 8px 12px;
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.editor-float-btn:hover {
    background: #667eea;
    color: white;
}

/* 选中元素高亮 */
.editor-selected {
    outline: 2px dashed #667eea !important;
    outline-offset: 2px !important;
    position: relative;
}

.editor-selected::before {
    content: '✏️';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10002;
}

/* 可编辑元素提示 */
body.editor-active [contenteditable="true"]:hover {
    outline: 1px dashed #667eea;
    outline-offset: 2px;
    cursor: text;
}

body.editor-active [contenteditable="true"]:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 图片编辑提示 */
body.editor-active img:hover {
    outline: 2px dashed #764ba2;
    outline-offset: 2px;
    cursor: pointer;
}

/* 卡片编辑提示 */
body.editor-active .bento-item:hover {
    outline: 2px dashed #f093fb;
    outline-offset: 2px;
    cursor: pointer;
}

/* 滚动条样式 */
.editor-panel-content::-webkit-scrollbar {
    width: 6px;
}

.editor-panel-content::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.editor-panel-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.editor-panel-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 动画效果 */
@keyframes editorPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.editor-status {
    animation: editorPulse 2s ease-in-out infinite;
}

/* 响应式 */
@media (max-width: 768px) {
    .editor-toolbar {
        height: auto;
        padding: 10px;
    }
    
    .editor-toolbar-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .editor-toolbar-left {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .editor-panel {
        right: 10px;
        left: 10px;
        width: auto;
        top: auto;
        bottom: 60px;
        max-height: 50vh;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .editor-panel {
        background: #1a1a2e;
        color: #e8e8e8;
    }
    
    .editor-group label {
        color: #e8e8e8;
    }
    
    .editor-group input,
    .editor-group textarea,
    .editor-group select {
        background: #2a2a3e;
        border-color: #444;
        color: #e8e8e8;
    }
    
    .editor-hint {
        color: #666;
    }
}