/* ZORO页面编辑器样式 */

/* 编辑器工具栏 */
.page-editor-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #1A1A1A;
  color: #FFFFFF;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 9999;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.editor-toolbar-section {
  display: flex;
  gap: 10px;
}

.editor-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
}

.editor-btn:hover {
  background: rgba(255, 107, 0, 0.2);
  border-color: #FF6B00;
  transform: translateY(-2px);
}

.editor-btn.active {
  background: #FF6B00;
  border-color: #FF6B00;
}

/* 可编辑元素 */
.editable-element {
  position: relative;
  outline: 2px dashed transparent;
  transition: outline 0.2s;
  min-width: 100px;
  min-height: 50px;
}

.editable-element:hover {
  outline: 2px dashed rgba(255, 107, 0, 0.5);
}

.editable-element.selected {
  outline: 2px solid #FF6B00;
  z-index: 100;
}

/* 调整大小手柄 */
.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #FF6B00;
  border-radius: 50%;
  display: none;
  cursor: pointer;
  z-index: 101;
}

.editable-element.selected .resize-handle {
  display: block;
}

.resize-handle.nw { 
  top: -5px; 
  left: -5px; 
  cursor: nw-resize; 
}

.resize-handle.n { 
  top: -5px; 
  left: 50%; 
  transform: translateX(-50%); 
  cursor: n-resize; 
}

.resize-handle.ne { 
  top: -5px; 
  right: -5px; 
  cursor: ne-resize; 
}

.resize-handle.w { 
  top: 50%; 
  left: -5px; 
  transform: translateY(-50%); 
  cursor: w-resize; 
}

.resize-handle.e { 
  top: 50%; 
  right: -5px; 
  transform: translateY(-50%); 
  cursor: e-resize; 
}

.resize-handle.sw { 
  bottom: -5px; 
  left: -5px; 
  cursor: sw-resize; 
}

.resize-handle.s { 
  bottom: -5px; 
  left: 50%; 
  transform: translateX(-50%); 
  cursor: s-resize; 
}

.resize-handle.se { 
  bottom: -5px; 
  right: -5px; 
  cursor: se-resize; 
}

/* 编辑面板 */
.edit-panel {
  position: fixed;
  top: 60px;
  right: 20px;
  width: 300px;
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 9998;
  padding: 20px;
  display: none;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.edit-panel.active {
  display: block;
}

.edit-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #F5F5F5;
}

.edit-panel-title {
  font-size: 18px;
  font-weight: 600;
  color: #1A1A1A;
  margin: 0;
}

.edit-panel-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666666;
  padding: 0;
  line-height: 1;
}

.edit-panel-close:hover {
  color: #FF6B00;
}

.edit-panel-section {
  margin-bottom: 20px;
}

.edit-panel-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #1A1A1A;
  font-size: 14px;
}

.edit-panel-input {
  width: 100%;
  padding: 10px;
  border: 1px solid #E0E0E0;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  transition: border-color 0.2s;
}

.edit-panel-input:focus {
  outline: none;
  border-color: #FF6B00;
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.edit-panel-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #E0E0E0;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100px;
  resize: vertical;
  transition: border-color 0.2s;
}

.edit-panel-textarea:focus {
  outline: none;
  border-color: #FF6B00;
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.edit-panel-color-picker {
  width: 100%;
  height: 40px;
  border: 1px solid #E0E0E0;
  border-radius: 4px;
  padding: 5px;
  cursor: pointer;
}

/* 网格覆盖层 */
.editor-grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9997;
  background-image: 
    linear-gradient(rgba(255, 107, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 107, 0, 0.05) 1px, transparent 1px);
  background-size: 10px 10px;
}

/* 预览模式 */
body.preview-mode .page-editor-toolbar {
  pointer-events: none;
  opacity: 0.5;
}

body.preview-mode .editable-element {
  outline: none !important;
}

body.preview-mode .resize-handle {
  display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .page-editor-toolbar {
    flex-wrap: wrap;
    padding: 10px;
  }

  .editor-toolbar-section {
    flex-wrap: wrap;
    margin-bottom: 10px;
  }

  .edit-panel {
    width: 100%;
    right: 0;
    top: 60px;
    max-height: calc(100vh - 150px);
  }
}
