/* 预设模板按钮组 */
.flex-preset-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.flex-preset-btn {
    padding: 6px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.flex-preset-btn:hover {
    border-color: #2196F3;
    color: #2196F3;
    background: rgba(33,150,243,0.05);
}

.flex-preset-btn.active {
    background: #2196F3;
    color: #fff;
    border-color: #2196F3;
}

/* 工具主区域两栏布局 */
.flex-generator-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.flex-settings-panel {
    flex: 0 0 340px;
    max-width: 340px;
}

.flex-preview-panel {
    flex: 1;
    min-width: 0;
}

/* 属性分组 */
.flex-prop-group {
    margin-bottom: 16px;
}

.flex-prop-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #1976D2;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.flex-prop-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.flex-prop-label {
    font-size: 13px;
    color: #666;
    min-width: 90px;
    flex-shrink: 0;
}

.flex-prop-row select,
.flex-prop-row input[type="number"],
.flex-prop-row input[type="text"] {
    flex: 1;
    height: 32px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.flex-prop-row select:focus,
.flex-prop-row input:focus {
    border-color: #2196F3;
}

.flex-prop-row select {
    cursor: pointer;
    background: #fff;
}

/* gap滑块 */
.flex-gap-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
}

.flex-gap-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #2196F3;
    border-radius: 50%;
    cursor: pointer;
}

.flex-gap-value {
    width: 50px;
    text-align: center;
    font-size: 13px;
    color: #333;
}

/* 预览区 */
.flex-preview-container {
    background: #fff;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    min-height: 320px;
    padding: 16px;
    position: relative;
    transition: border-color 0.2s;
}

.flex-preview-container:hover {
    border-color: #2196F3;
}

.flex-preview-label {
    position: absolute;
    top: -10px;
    left: 12px;
    background: #fff;
    padding: 0 8px;
    font-size: 12px;
    color: #999;
}

.flex-container {
    display: flex;
    min-height: 280px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    background: repeating-linear-gradient(
        45deg,
        #fafafa,
        #fafafa 10px,
        #f5f5f5 10px,
        #f5f5f5 20px
    );
    padding: 8px;
    transition: all 0.3s ease;
    overflow: auto;
}

.flex-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 50px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
    flex-shrink: 1;
}

.flex-item:hover {
    opacity: 0.85;
    transform: scale(1.03);
}

.flex-item.selected {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px #2196F3;
    z-index: 1;
}

.flex-item .flex-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #f44336;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.flex-item:hover .flex-delete-btn {
    display: flex;
}

/* 项目颜色 */
.flex-item:nth-child(6n+1) { background: #2196F3; }
.flex-item:nth-child(6n+2) { background: #4CAF50; }
.flex-item:nth-child(6n+3) { background: #FF9800; }
.flex-item:nth-child(6n+4) { background: #9C27B0; }
.flex-item:nth-child(6n+5) { background: #F44336; }
.flex-item:nth-child(6n+6) { background: #00BCD4; }

/* 添加项目按钮 */
.flex-add-item-btn {
    width: 100%;
    padding: 10px;
    border: 2px dashed #2196F3;
    border-radius: 6px;
    background: rgba(33,150,243,0.05);
    color: #2196F3;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.flex-add-item-btn:hover {
    background: rgba(33,150,243,0.1);
}

.flex-add-item-btn:disabled {
    border-color: #ccc;
    color: #aaa;
    cursor: not-allowed;
    background: #f9f9f9;
}

/* 项目属性面板 */
.flex-item-props-panel {
    background: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 6px;
    padding: 14px;
    margin-top: 16px;
}

.flex-item-props-title {
    font-size: 14px;
    font-weight: 600;
    color: #d48806;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 代码输出区 */
.flex-code-output {
    background: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
}

.flex-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
}

.flex-code-header span {
    color: #ccc;
    font-size: 13px;
}

.flex-code-body {
    padding: 16px;
    overflow-x: auto;
}

.flex-code-body pre {
    margin: 0;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.7;
    color: #d4d4d4;
    white-space: pre;
}

/* 代码语法高亮 */
.flex-code-body .prop-name { color: #9cdcfe; }
.flex-code-body .prop-value { color: #ce9178; }
.flex-code-body .selector { color: #d7ba7d; }
.flex-code-body .bracket { color: #808080; }
.flex-code-body .comment { color: #6a9955; }

/* 响应式设计 - 工具特有 */
@media (max-width: 992px) {
    .flex-generator-layout {
        flex-direction: column;
    }

    .flex-settings-panel {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .flex-preset-group {
        gap: 6px;
    }

    .flex-preset-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .flex-prop-row {
        flex-wrap: wrap;
    }

    .flex-prop-label {
        min-width: 80px;
    }
}