/* 颜色面板样式 */
.color-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 300px;
    display: none;
}

.color-panel-content {
    padding: 20px;
}

.color-panel h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.color-option {
    margin-bottom: 15px;
}

.color-option label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

.color-option select,
.color-option input[type="color"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.color-option input[type="color"] {
    height: 40px;
    cursor: pointer;
}

.color-panel-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.color-panel-actions .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.color-panel-actions .btn-primary {
    background-color: #007bff;
    color: white;
}

.color-panel-actions .btn-primary:hover {
    background-color: #0056b3;
}

.color-panel-actions .btn-secondary {
    background-color: #6c757d;
    color: white;
}

.color-panel-actions .btn-secondary:hover {
    background-color: #545b62;
}

/* 预设尺寸按钮样式 */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.preset-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.preset-btn:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.preset-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* 尺寸输入组样式 */
.size-inputs {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

.input-group input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* 模板尺寸指示器 */
#template-size-indicator {
    background-color: #e3f2fd;
    color: #1976d2;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 10px;
    border-left: 3px solid #1976d2;
}

/* 内联颜色选择样式 */
.color-count-selection {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.color-count-btn {
    padding: 4px 8px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.color-count-btn:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.color-count-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* 颜色方案下拉选择 */
.color-scheme-dropdown {
    margin-bottom: 15px;
}

.color-scheme-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.color-scheme-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.color-scheme-preview {
    display: flex;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    border: 1px solid #ddd;
}

.color-scheme-preview .color-bar {
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
}

.color-scheme-preview:hover .color-bar {
    transform: scaleY(1.1);
}

/* 自定义颜色部分 */
.custom-colors-section {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    position: relative;
}

.sub-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 8px;
}

.custom-colors-container {
    margin-bottom: 12px;
    position: relative;
}

.selected-colors-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 32px;
    align-items: flex-start;
}

.add-color-btn {
    width: 28px;
    height: 28px;
    border: 2px dashed #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.add-color-btn:hover {
    border-color: #007bff;
    color: #007bff;
    background-color: #f8f9fa;
}

/* 嵌入式颜色选择器 */
.embedded-color-picker {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 8px;
    animation: slideDown 0.3s ease;
    position: relative;
    z-index: 1001;
    width: 100%;
    max-width: 280px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.color-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    position: relative;
    z-index: 1;
}

.color-picker-header span {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.close-color-picker {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-color-picker:hover {
    background-color: #f8f9fa;
    color: #333;
}

.preset-colors-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.preset-color {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.preset-color:hover {
    border-color: #007bff;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.preset-color:active {
    transform: scale(0.95);
}

.custom-color-input-section {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.custom-color-input-section label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.custom-color-input {
    width: 40px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.custom-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.custom-color-item {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 2px solid #ddd;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.custom-color-item:hover {
    border-color: #007bff;
    transform: scale(1.1);
}

.custom-color-item .remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.custom-color-item:hover .remove-btn {
    display: flex;
}

/* 重置按钮 */
.reset-colors-btn {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.reset-colors-btn:hover {
    border-color: #007bff;
    color: #007bff;
    background-color: white;
}

.reset-colors-btn i {
    font-size: 11px;
}

/* 颜色标签页样式 */
.color-settings-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
    padding: 0 10px;
}

.color-tab {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
}

.color-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.color-tab-content {
    display: none;
}

.color-tab-content.active {
    display: block;
}

/* 自定义颜色样式 */
.selected-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    min-height: 60px;
}

.selected-color-item {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.selected-color-item.add-color {
    background-color: #f8f9fa;
    border-style: dashed;
    color: #666;
}

.selected-color-item.add-color:hover {
    border-color: #007bff;
    color: #007bff;
}

.selected-color-item i {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.selected-color-item:hover i {
    opacity: 1;
}

/* 清除颜色按钮 */
.clear-colors-btn {
    width: calc(100% - 20px);
    margin: 0 10px 10px 10px;
    padding: 8px;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.clear-colors-btn:hover {
    border-color: #007bff;
    color: #007bff;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .color-panel {
        min-width: 90%;
        max-width: 90%;
    }
    
    .preset-buttons {
        flex-direction: column;
    }
    
    .preset-btn {
        width: 100%;
        text-align: center;
    }
    
    .size-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .color-settings-panel {
        width: 280px;
    }
    
    .selected-colors {
        padding: 8px;
    }
    
    .selected-color-item {
        width: 25px;
        height: 25px;
    }
}