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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e8eaed;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* 顶部工具栏 */
.toolbar {
    background: #4285f4;
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

.toolbar .menu-bar {
    display: flex;
    gap: 4px;
}

.toolbar .dropdown {
    position: relative;
}

.toolbar .dropdown-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.toolbar .dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.toolbar .dropdown:hover .dropdown-content {
    display: block;
}

.toolbar .dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.toolbar .dropdown-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background 0.15s;
}

.toolbar .dropdown-item:hover {
    background: #f1f3f4;
}

.toolbar .dropdown-separator {
    height: 1px;
    background: #e8eaed;
    margin: 4px 0;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 左侧组件面板 */
.left-panel {
    width: 280px;
    background: white;
    padding: 15px;
    overflow-y: auto;
    border-right: 1px solid #dadce0;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.left-panel.hidden {
    width: 0;
    padding: 0;
    border-right: none;
    overflow: hidden;
}

.left-panel h3 {
    font-size: 14px;
    font-weight: 600;
    color: #5f6368;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8eaed;
}

.component-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.component-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s;
}

.component-item:hover {
    background: #e8f0fe;
    border-color: #4285f4;
    transform: translateY(-2px);
}

.component-item:active {
    cursor: grabbing;
}

.component-item .icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.component-item .label {
    font-size: 12px;
    color: #5f6368;
}

/* 拖拽条样式 */
.resizer {
    width: 6px;
    background: #e8eaed;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.2s;
}

.resizer:hover {
    background: #4285f4;
}

.resizer.hidden {
    display: none;
}

/* 中间画布区 */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f1f3f4;
    padding: 20px;
    overflow: auto;
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

.canvas-container {
    background: #333;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#canvas {
    border: 2px solid #555;
    border-radius: 4px;
    background: black;
    cursor: crosshair;
}

.canvas-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.canvas-controls button {
    padding: 8px 16px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #5f6368;
}

.canvas-controls button:hover {
    background: #f1f3f4;
}

/* 右侧属性面板 */
.right-panel {
    width: 280px;
    background: white;
    overflow-y: auto;
    border-left: 1px solid #dadce0;
    flex-shrink: 0;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
}

.right-panel.hidden {
    width: 0;
    padding: 0;
    border-left: none;
    overflow: hidden;
}

/* Tab样式 */
.right-panel .tab-header {
    display: flex;
    border-bottom: 1px solid #e8eaed;
    background: #f8f9fa;
    flex-shrink: 0;
}

.right-panel .tab-btn {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: #5f6368;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.right-panel .tab-btn:hover {
    background: #e8eaed;
}

.right-panel .tab-btn.active {
    color: #4285f4;
    border-bottom-color: #4285f4;
    background: white;
}

.right-panel .tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.right-panel .tab-panel {
    display: none;
}

.right-panel .tab-panel.active {
    display: block;
}

.right-panel .no-selection {
    color: #9aa0a6;
    font-size: 13px;
    text-align: center;
    padding: 40px 20px;
}

/* 组件列表样式 */
.components-list-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.components-list-item:hover {
    background: #e8f0fe;
    border-color: #4285f4;
}

.components-list-item.selected {
    background: #e8f0fe;
    border-color: #4285f4;
}

.components-list-item .item-icon {
    font-size: 20px;
    margin-right: 10px;
}

.components-list-item .item-info {
    flex: 1;
}

.components-list-item .item-type {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.components-list-item .item-id {
    font-size: 11px;
    color: #9aa0a6;
}

.components-list-empty {
    text-align: center;
    color: #9aa0a6;
    font-size: 13px;
    padding: 30px 10px;
}

.property-group {
    margin-bottom: 20px;
}

.property-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #5f6368;
}

.property-group input[type="text"],
.property-group input[type="number"],
.property-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.property-group input[type="text"]:focus,
.property-group input[type="number"]:focus,
.property-group select:focus {
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.property-group .color-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.property-group input[type="color"] {
    width: 40px;
    height: 34px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
}

.property-group .checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.property-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.delete-btn {
    width: 100%;
    padding: 10px;
    background: #fff1f0;
    color: #d93026;
    border: 1px solid #ffccc7;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 20px;
}

.delete-btn:hover {
    background: #ffccc7;
}

/* 底部状态栏 */
.status-bar {
    background: white;
    padding: 8px 15px;
    border-top: 1px solid #dadce0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #5f6368;
}

.status-bar .info {
    display: flex;
    gap: 20px;
}

.status-bar .element-count {
    display: flex;
    gap: 10px;
}

.status-bar .element-count span {
    padding: 2px 8px;
    background: #f1f3f4;
    border-radius: 12px;
}

/* 代码预览面板 */
.code-preview-panel {
    max-width: 900px;
}

.code-preview-panel textarea {
    min-height: 400px;
    font-size: 12px;
    line-height: 1.5;
}

/* 提示对话框 */
.alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.alert-overlay.show {
    display: flex;
}

.alert-box {
    background: white;
    border-radius: 12px;
    padding: 30px 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    animation: alertSlideIn 0.2s ease;
}

@keyframes alertSlideIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.alert-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.alert-message {
    font-size: 15px;
    color: #333;
    line-height: 1.6;
    margin-bottom: 25px;
}

.alert-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.alert-btn {
    padding: 10px 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.alert-btn.primary {
    background: #4285f4;
    color: white;
}

.alert-btn.primary:hover {
    background: #3367d6;
}

.alert-btn.secondary {
    background: #f1f3f4;
    color: #5f6368;
}

.alert-btn.secondary:hover {
    background: #e8eaed;
}

/* 元素选择高亮 */
.selected-element {
    outline: 2px solid #4285f4;
    outline-offset: 2px;
}

/* 拖拽提示 */
.drop-hint {
    border: 2px dashed #4285f4 !important;
    background: rgba(66, 133, 244, 0.1) !important;
}

/* JSON面板样式 */
.json-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.json-panel-overlay.show {
    display: flex;
}

.json-panel {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.json-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e8eaed;
}

.json-panel-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1a73e8;
}

.json-panel-header button {
    padding: 6px 12px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.json-panel-header button:hover {
    background: #1557b0;
}

.json-panel-header .close-btn {
    background: transparent;
    color: #5f6368;
    font-size: 20px;
    line-height: 1;
    padding: 0 10px;
}

.json-panel-header .close-btn:hover {
    background: #f1f3f4;
}

.json-panel-body {
    padding: 15px 20px;
    max-height: 60vh;
    overflow: auto;
}

.json-panel-body textarea {
    width: 100%;
    height: 300px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    padding: 12px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    resize: none;
    background: #f8f9fa;
    color: #333;
}

.json-panel-body textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.json-panel-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e8eaed;
}

.json-panel-footer button {
    padding: 8px 16px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.json-panel-footer button.primary {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

.json-panel-footer button.primary:hover {
    background: #1557b0;
}

.json-panel-footer button.secondary:hover {
    background: #f1f3f4;
}

.copy-success {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #1a73e8;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    display: none;
    z-index: 1001;
}

.copy-success.show {
    display: block;
}

/* 右键菜单样式 */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    z-index: 1000;
    min-width: 120px;
    display: none;
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: #f1f3f4;
}

.context-menu-item.delete {
    color: #d93026;
}

.context-menu-item.delete:hover {
    background: #fff1f0;
}

.context-menu-separator {
    height: 1px;
    background: #e8eaed;
    margin: 4px 0;
}